Beispiel #1
0
        public override void KeyPressHandle(Key k)
        {
            if (k == Key.Start)
            {
                if (!Paused)
                {
                    Paused = true;

                    if (ActiveAbility != null)
                    {
                        ActiveAbility.ActionTimer.Pause();
                    }

                    foreach (BattleIcon icon in _battleIcons)
                    {
                        icon.AnimationTimer.Pause();
                    }

                    Party.Clock.Pause();

                    CombatantClocks.PauseAllClocks();
                }
                else
                {
                    CombatantClocks.UnpauseAllClocks();

                    Party.Clock.Unpause();

                    foreach (BattleIcon icon in _battleIcons)
                    {
                        icon.AnimationTimer.Unpause();
                    }

                    if (ActiveAbility != null)
                    {
                        ActiveAbility.ActionTimer.Unpause();
                    }

                    Paused = false;
                }
            }

            if (!Paused)
            {
                switch (k)
                {
                case Key.Select:
                    Screen.InfoBar.Visible = !Screen.InfoBar.Visible;
                    break;

                case Key.Square:
                    _holdingSquare = true;
                    break;

                case Key.Triangle:
                    if (Commanding != null)
                    {
                        _turnQueue.Enqueue(Commanding);
                        ClearControl();
                    }
                    break;

                default:
                    break;
                }
            }

            if (Commanding != null && !Victory)
            {
                Screen.Control.ControlHandle(k);
            }
        }
Beispiel #2
0
        protected override void InternalInit()
        {
            ScreenState state = new ScreenState
            {
                Width  = Seven.Configuration.WindowWidth,
                Height = Seven.Configuration.WindowHeight
            };

            _victoryEvent = new EndOfBattleEvent("Victory!");
            _lossEvent    = new EndOfBattleEvent("Annihilated!");

            Screen = new BattleScreen(this, state);

            SpeedValue = (32768 / (120 + (Seven.Party.BattleSpeed * 15 / 8)));

            GlobalClock = new BattleClock(SpeedValue);

            Allies = new Ally[Party.PARTY_SIZE];

            int[] e = _formation.GetAllyTurnTimersElapsed(Party);

            for (int i = 0; i < Party.PARTY_SIZE; i++)
            {
                if (Party[i] != null)
                {
                    Allies[i] = new Ally(this, i, e[i]);
                    Allies[i].InitMenu(state);
                }
            }

            if (Allies.All(a => a == null))
            {
                throw new GameDataException("Must have at least one ally in battle.");
            }

            EnemyList = _formation.GetEnemyList(this);

            foreach (Ally ally in Allies)
            {
                if (ally != null)
                {
                    CombatantClocks.Add(ally.TurnTimer);
                    CombatantClocks.Add(ally.V_Timer);
                    CombatantClocks.Add(ally.C_Timer);
                    ally.TurnTimer.Unpause();
                }
            }

            foreach (Enemy enemy in EnemyList)
            {
                CombatantClocks.Add(enemy.TurnTimer);
                CombatantClocks.Add(enemy.V_Timer);
                CombatantClocks.Add(enemy.C_Timer);
                enemy.EnterBattle();
            }

            foreach (Enemy enemy in EnemyList)
            {
                enemy.TurnTimer.Unpause();
            }
        }