public bool Update(float elapsedTime)
        {
            switch (battleState)
            {
            case BattleStateEnum.Running:

                foreach (var enemy in EnemyParty.Enemies)
                {
                    if (enemy.TimeLapse(timeIncrement))
                    {
                        var target = enemy.Action(Party);
                        Effects.Add(new DialogEffect(_graphics, _dialog, $"{enemy.Name} attacked."));
                        Effects.Add(new HpEffect(_graphics, "1", target.X, target.Y));
                    }
                }

                foreach (var actor in Party.Actors)
                {
                    if (actor.TimeLapse(timeIncrement))
                    {
                        battleState        = BattleStateEnum.Idle;
                        Party.ActivePlayer = actor;
                        break;
                    }
                }
                break;

            case BattleStateEnum.Idle:

                if (_inputManager.JustPressedInput((int)Input.FaceButtonDown, (int)Input.Up))
                {
                    var enemy  = EnemyParty.Enemies.First();
                    int damage = Party.ActivePlayer.Attack(enemy);
                    Effects.Add(new HpEffect(_graphics, damage.ToString(), 60, 200));

                    Party.ActivePlayer = null;

                    battleState = BattleStateEnum.Running;

                    if (EnemyParty.IsDead())
                    {
                        return(false);
                    }
                }
                break;
            }

            return(true);
        }
示例#2
0
        /// <summary>
        /// Set the Battle State
        /// </summary>
        public virtual bool SetBattleStateEnum(BattleStateEnum data)
        {
            EngineSettings.BattleStateEnum = data;

            return(true);
        }