Ejemplo n.º 1
0
        public void nextTurn()
        {
            activePlayer          = manager.NextEntity().GetComponent <BrainManager>();
            text.text             = "Current Player: " + activePlayer.GetName();
            activePlayer.isMyTurn = true;

            // Reset Turn Behaviors
            activePlayer.GetComponent <UniqueCreature>().movementLeft = activePlayer.GetComponent <UniqueCreature>().stats.movement;
            activePlayer.GetComponent <UniqueCreature>().action       = true;
        }
Ejemplo n.º 2
0
        void Start()
        {
            winCanvas.enabled     = false;
            loseCanvas.enabled    = false;
            manager               = new TurnOrderController(units.ToArray());//, new RandomShuffler<GameObject>());
            activePlayer          = manager.NextEntity().GetComponent <BrainManager>();
            text.text             = "Current Player: " + activePlayer.GetName();
            activePlayer.isMyTurn = true;

            // Reset Turn Behaviors
            activePlayer.GetComponent <UniqueCreature>().movementLeft = activePlayer.GetComponent <UniqueCreature>().stats.movement;
            activePlayer.GetComponent <UniqueCreature>().action       = true;
        }
        // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
        override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
        {
            brain = animator.GetComponent <BrainManager>();
            brain.indicatorRend.enabled = true;

            creature = animator.GetComponent <UniqueCreature>();
            brain.outline.enabled = true;
            ms = animator.GetComponent <MovementSystem>();
            ms.finishedMoving = true;

            List <Ability> abilityList = brain.GetComponent <UnitAbilitiesContainer>().abilities;

            abilityCanvas                  = brain.manager.hotbar;
            abilitySelector                = abilityCanvas.GetComponent <AbilitySelector>();
            abilitySelector.abilityList    = abilityList;
            abilitySelector.setAbilityList = true;
            abilitySelector.SelectedAbilityButton(-1);
            abilityButtons = abilitySelector.AbilityButtons;
            for (int i = 0; i < abilityButtons.Length; i++)
            {
                if (i < abilityList.Count)
                {
                    abilityButtons[i].GetComponent <Button>().interactable = true;
                    abilityButtons[i].GetComponent <AbilityButtonHighlight>().isEnabled = true;
                    abilityButtons[i].GetComponent <AbilityButtonHighlight>().ability   = abilityList[i];
                }
                else
                {
                    abilityButtons[i].GetComponent <Button>().interactable = false;
                    abilityButtons[i].GetComponent <AbilityButtonHighlight>().isEnabled = false;
                }
            }
            possible = ms.GetPossible(creature.movementLeft);
        }
Ejemplo n.º 4
0
        public void Move(Tile tile, bool displayPath)
        {
            int         left = brain.GetComponent <UniqueCreature>().movementLeft;
            List <Tile> path = star.FindPath(tile, grid, this);

            if (path.Count > left)
            {
                path = path.GetRange(path.Count - left - 1, left + 1);
            }
            if (displayPath)
            {
                lr.enabled = true;
                show.Display(lr, path);
            }
            brain.GetComponent <UniqueCreature>().movementLeft -= (path.Count - 1);
            FollowPath(path);
        }