Ejemplo n.º 1
0
        public void EndTurn()
        {
            if (!IsEnemyTurn)
            {
                foreach (var actor in PlayerParty.Where(p => p.PlayerControllable))
                {
                    actor.RemoveActionPoints();
                }

                if (PlayerParty.Any(p => !p.PlayerControllable && p.CanAIAct))
                {
                    AutoEndTurn = true;
                    PlayerAIAct();
                    return;
                }
            }

            switch (State)
            {
            case BattleGameStateType.AbilitySelected:
            case BattleGameStateType.PartyIdle: {
                IsEnemyTurn = !IsEnemyTurn;
                AutoEndTurn = false;

                ToIdleState();

                if (IsEnemyTurn)
                {
                    foreach (var actor in EnemyParty)
                    {
                        actor.NewTurn();
                    }
                    foreach (var actor in PlayerParty)
                    {
                        actor.EndTurn();
                    }

                    SetSelection(null);

                    EnemyAIAct();
                }
                else
                {
                    foreach (var actor in PlayerParty)
                    {
                        actor.NewTurn();
                    }
                    foreach (var actor in EnemyParty)
                    {
                        actor.EndTurn();
                    }

                    SetSelection(PlayerParty.FirstOrDefault(s => s.CanAct));
                }
                break;
            }
            }
        }
Ejemplo n.º 2
0
        private void AbilityExecuted()
        {
            AbilitySelectedRoot.gameObject.SetActive(false);

            if (GameOverCheck())
            {
                return;
            }

            EndTurnButton.interactable = !IsEnemyTurn;

            foreach (var a in Abilities)
            {
                a.Disable = false;
            }

            ToIdleState();

            if (IsEnemyTurn)
            {
                EnemyAIAct();
            }
            else
            {
                if (!SelectedActor.CanAct)
                {
                    SetSelection(PlayerParty.FirstOrDefault(s => s.CanAct));
                }

                if (PlayerParty.Where(p => p.PlayerControllable).All(p => !p.CanAct))
                {
                    PlayerAIAct();
                }
                else
                {
                    if (AutoEndTurn && !PlayerParty.Any(p => p.CanAct))
                    {
                        EndTurn();
                    }
                }
            }
        }