Merge branch 'Integration'
This commit is contained in:
commit
0727e44b80
103 changed files with 10380 additions and 861 deletions
|
@ -9,28 +9,24 @@ public class GameManager : MonoBehaviourSingletonPersistent<GameManager>
|
|||
[SerializeField] private List<string> levelNames;
|
||||
[SerializeField] private List<string> levelMusics;
|
||||
[SerializeField] private List<int> levelsMoney;
|
||||
int current_level = -1;
|
||||
int current_level = 0;
|
||||
|
||||
[SerializeField] GameObject GameUI;
|
||||
[SerializeField] GameObject LoseUI;
|
||||
[SerializeField] GameObject WinUI;
|
||||
GameObject _gameUI;
|
||||
GameObject _loseUI;
|
||||
GameObject _winUI;
|
||||
|
||||
// for compativility with other team
|
||||
public bool fightStarted = false;
|
||||
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
private void Update()
|
||||
{
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
// Delete, use only for Debug
|
||||
if (Input.GetKeyDown(KeyCode.Space))
|
||||
{
|
||||
StartFightForAll();
|
||||
GoNextLevel();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void StartFightForAll()
|
||||
{
|
||||
AbstractUnit[] units = FindObjectsByType<AbstractUnit>(FindObjectsSortMode.None);
|
||||
|
@ -38,6 +34,7 @@ public class GameManager : MonoBehaviourSingletonPersistent<GameManager>
|
|||
{
|
||||
unit.StartFight();
|
||||
}
|
||||
fightStarted = true;
|
||||
}
|
||||
|
||||
private void SetGlobals(int current_level)
|
||||
|
@ -47,6 +44,8 @@ public class GameManager : MonoBehaviourSingletonPersistent<GameManager>
|
|||
GlobalsVariable.QueenA = null;
|
||||
GlobalsVariable.QueenB = null;
|
||||
GlobalsVariable.money = levelsMoney[current_level];
|
||||
fightStarted = false;
|
||||
|
||||
}
|
||||
|
||||
public void ReloadLevel()
|
||||
|
@ -58,23 +57,19 @@ public class GameManager : MonoBehaviourSingletonPersistent<GameManager>
|
|||
|
||||
public void GoNextLevel()
|
||||
{
|
||||
if (current_level < levelNames.Count)
|
||||
if (current_level <= levelNames.Count)
|
||||
{
|
||||
current_level++;
|
||||
SetGlobals(current_level);
|
||||
SceneManager.LoadScene(levelNames[current_level]);
|
||||
SoundManager.Instance.PlayMusic(levelMusics[current_level]);
|
||||
}
|
||||
else
|
||||
{
|
||||
current_level = 0;
|
||||
}
|
||||
|
||||
throw new Exception("Bro there is no next level like stop pls");
|
||||
SetGlobals(current_level);
|
||||
SceneManager.LoadScene(levelNames[current_level]);
|
||||
SoundManager.Instance.PlayMusic(levelMusics[current_level]);
|
||||
|
||||
}
|
||||
|
||||
public void Losing()
|
||||
{
|
||||
|
||||
LoseUI.SetActive(true);
|
||||
this.enabled = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
26
Assets/Scripts/Transition.cs
Normal file
26
Assets/Scripts/Transition.cs
Normal file
|
@ -0,0 +1,26 @@
|
|||
using UnityEngine;
|
||||
|
||||
public class Transition : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private WinCanvas _winCanvas;
|
||||
[SerializeField] private LoseUI _loseUI;
|
||||
[SerializeField] private GameUI _gameUI;
|
||||
|
||||
// Update is called once per frame
|
||||
void LateUpdate()
|
||||
{
|
||||
if (GlobalsVariable.QueenA == null)
|
||||
{
|
||||
_winCanvas.gameObject.SetActive(true);
|
||||
_gameUI.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Space))
|
||||
{
|
||||
print("YOU LOSE");
|
||||
_loseUI.gameObject.SetActive(true);
|
||||
_gameUI.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
2
Assets/Scripts/Transition.cs.meta
Normal file
2
Assets/Scripts/Transition.cs.meta
Normal file
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 152b725e5ef4d734a85ca1350a98f253
|
|
@ -4,7 +4,7 @@ using UnityEngine.SceneManagement;
|
|||
|
||||
public class LoseUI : MonoBehaviour
|
||||
{
|
||||
[SerializeField] GameUI gameUI;
|
||||
[SerializeField] private GameUI gameUI;
|
||||
|
||||
[SerializeField] TextMeshProUGUI time;
|
||||
|
||||
|
@ -14,15 +14,9 @@ public class LoseUI : MonoBehaviour
|
|||
time.text = gameUI.GetComponent<GameUI>().time.ToString();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Retry()
|
||||
{
|
||||
SceneManager.LoadSceneAsync(SceneManager.GetActiveScene().name);
|
||||
GameManager.Instance.ReloadLevel();
|
||||
}
|
||||
|
||||
public void MainMenu()
|
||||
|
|
|
@ -5,16 +5,18 @@ using UnityEngine.SceneManagement;
|
|||
public class WinCanvas : MonoBehaviour
|
||||
{
|
||||
[SerializeField] TextMeshProUGUI time;
|
||||
[SerializeField] GameObject gameUI;
|
||||
private GameUI gameUI;
|
||||
|
||||
void Start()
|
||||
{
|
||||
gameUI = GameObject.FindWithTag("GameUI").GetComponent<GameUI>();
|
||||
time.text = gameUI.GetComponent<GameUI>().time.ToString();
|
||||
}
|
||||
|
||||
|
||||
public void NextLevel()
|
||||
{
|
||||
GameManager.Instance.GoNextLevel();
|
||||
SceneManager.LoadSceneAsync(SceneManager.GetActiveScene().buildIndex + 1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ public class OffensiveBehaviour : AbstractBehaviour
|
|||
if (GlobalsVariable.QueenA == null) return;
|
||||
}
|
||||
|
||||
CurrentMinecraftUnit.MovementHandler.TargetUnit = GlobalsVariable.QueenB;
|
||||
CurrentMinecraftUnit.MovementHandler.TargetUnit = CurrentMinecraftUnit.IsTeamA ? GlobalsVariable.QueenB : GlobalsVariable.QueenA;
|
||||
Vector3 targetPos = CurrentMinecraftUnit.MovementHandler.TargetUnit.transform.position;
|
||||
Vector3 goalPos = targetPos + (transform.position - targetPos).normalized * distanceGoal;
|
||||
CurrentMinecraftUnit.MovementHandler.MoveTowards(goalPos);
|
||||
|
|
|
@ -16,6 +16,8 @@ public class MinecraftUnit : AbstractUnit
|
|||
[field: SerializeField] public BaseCapacity Capacity { get; private set; }
|
||||
// Not required
|
||||
[field: SerializeField] public Animator Animator { get; private set; }
|
||||
|
||||
public bool isActive { get; private set; }
|
||||
|
||||
|
||||
|
||||
|
@ -66,6 +68,7 @@ public class MinecraftUnit : AbstractUnit
|
|||
|
||||
public override void StartFight()
|
||||
{
|
||||
isActive = true;
|
||||
Component[] components = GetComponents<Component>();
|
||||
|
||||
foreach (Component component in components)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue