private void ShowWinScreen() { if (PlayerControler.GetInstance().FirstPlayerTurn()) { lightLableT.SetActive(true); lightButtonT.SetActive(true); darkLableT.SetActive(false); darkButtonT.SetActive(false); } else { lightLableT.SetActive(false); lightButtonT.SetActive(false); darkLableT.SetActive(true); darkButtonT.SetActive(true); } if (playerControler.FirstPlayerTurn()) { winBoxT.text = @"Перемога сил світла!"; } else { winBoxT.text = @"Перемога сил темряви!"; } winScreen.SetActive(true); }
public PathFinder() { cells = CellManager.GetInstance(); selectedUnit = UnitSelection.GetInstance(); units = UnitsList.GetInstance(); playerControler = PlayerControler.GetInstance(); }
public static PlayerControler GetInstance() { if (instance == null) { instance = new PlayerControler(); } return(instance); }
private void Awake() { playerControler = PlayerControler.GetInstance(); unitSelection = UnitSelection.GetInstance(); cellManager = CellManager.GetInstance(); actionBT = new Button[3] { pathMoveBT, healBT, captureBT }; }
private void Start() { playerControler = PlayerControler.GetInstance(); GameEvents.GetInstance().OnWin += ShowWinScreen; GameEvents.GetInstance().OnPlayerChanged += RefreshButtons; GameEvents.GetInstance().OnActionDone += RefreshButtons; GameEvents.GetInstance().OnUnitSpawned += UpdateEnergyValue; ShowChangingScreen(); instruction.SetActive(true); }
private Target DefineTarget(Vector3 targetPosition) { var currentPlayer = PlayerControler.GetInstance().GetCurrentPlayer(); if (unitsList.ContainsInLeft(targetPosition)) { if (currentPlayer == PlayerControler.Player.Light) { return(Target.FriendUnit); } if (currentPlayer == PlayerControler.Player.Dark) { return(Target.EnemyUnit); } } else if (unitsList.ContainsInRight(targetPosition)) { if (currentPlayer == PlayerControler.Player.Light) { return(Target.EnemyUnit); } if (currentPlayer == PlayerControler.Player.Dark) { return(Target.FriendUnit); } } else if (cellManager.GetCell(targetPosition).type == Cell.CellType.LightPortal) { if (currentPlayer == PlayerControler.Player.Light) { return(Target.FriendPortal); } if (currentPlayer == PlayerControler.Player.Dark) { return(Target.EnemyPortal); } } else if (cellManager.GetCell(targetPosition).type == Cell.CellType.DarkPortal) { if (currentPlayer == PlayerControler.Player.Light) { return(Target.EnemyPortal); } if (currentPlayer == PlayerControler.Player.Dark) { return(Target.FriendPortal); } } return(Target.Cell); }
public Unit[] GetAllFriends() { if (PlayerControler.GetInstance().GetCurrentPlayer() == PlayerControler.Player.Light) { lightUnits.RemoveAll(unit => unit == null); return(lightUnits.ToArray()); } else { darkUnits.RemoveAll(unit => unit == null); return(darkUnits.ToArray()); } }
public Unit SpawnUnit(string name, Vector3 position) { Unit instance; if (PlayerControler.GetInstance().FirstPlayerTurn()) { instance = Instantiate(prefabsList.GetLeftUnit(name), position, Quaternion.identity, CellClasses.CellManager.GetInstance().transform); } else { instance = Instantiate(prefabsList.GetRightUnit(name), position, Quaternion.identity, CellClasses.CellManager.GetInstance().transform); } instance.transform.position = position; instance.GetComponent <AudioSource>().volume = MainMenu.soundsVolume; return(instance); }
public void MakeActiveUnits() { if (PlayerControler.GetInstance().GetCurrentPlayer() == PlayerControler.Player.Light) { foreach (Unit unit in lightUnits) { if (unit != null) { unit.Activate(); unit.statHUD.HighlightAsFriend(); unit.MakeFriendlyStatHUD(); } } foreach (Unit unit in darkUnits) { if (unit != null) { unit.MakeNeutralStatHUD(); } } } if (PlayerControler.GetInstance().GetCurrentPlayer() == PlayerControler.Player.Dark) { foreach (Unit unit in darkUnits) { if (unit != null) { unit.Activate(); unit.statHUD.HighlightAsFriend(); unit.MakeFriendlyStatHUD(); } } foreach (Unit unit in lightUnits) { if (unit != null) { unit.MakeNeutralStatHUD(); } } } }