예제 #1
0
 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);
 }
예제 #2
0
 public PathFinder()
 {
     cells           = CellManager.GetInstance();
     selectedUnit    = UnitSelection.GetInstance();
     units           = UnitsList.GetInstance();
     playerControler = PlayerControler.GetInstance();
 }
예제 #3
0
 public static PlayerControler GetInstance()
 {
     if (instance == null)
     {
         instance = new PlayerControler();
     }
     return(instance);
 }
예제 #4
0
 private void Awake()
 {
     playerControler = PlayerControler.GetInstance();
     unitSelection   = UnitSelection.GetInstance();
     cellManager     = CellManager.GetInstance();
     actionBT        = new Button[3] {
         pathMoveBT, healBT, captureBT
     };
 }
예제 #5
0
 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);
 }
예제 #6
0
        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);
        }
예제 #7
0
 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());
     }
 }
예제 #8
0
        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);
        }
예제 #9
0
        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();
                    }
                }
            }
        }