Esempio n. 1
0
 public override void DoUpdate(GameTime gameTime)
 {
     if (ActiveInputManager.InputConfirmPressed())
     {
         if (ConfirmMenuChoice == 0)
         {
             RemoveAllActionPanels();
             AddToPanelListAndSelect(new ActionPanelPhaseChange(Map));
         }
         else if (ConfirmMenuChoice == 1)
         {
             RemoveFromPanelList(this);
         }
     }
     else if (ActiveInputManager.InputCancelPressed())
     {
         RemoveFromPanelList(this);
     }
     else if (ActiveInputManager.InputLeftPressed())
     {
         if (ConfirmMenuChoice == 1)
         {
             ConfirmMenuChoice = 0;
         }
     }
     else if (ActiveInputManager.InputRightPressed())
     {
         if (ConfirmMenuChoice == 0)
         {
             ConfirmMenuChoice = 1;
         }
     }
 }
Esempio n. 2
0
        private void UpdateSquadMemberSelection(GameTime gameTime)
        {
            if (ActiveInputManager.InputDownPressed())
            {
                Map.BattleMenuCursorIndexSecond += Map.BattleMenuCursorIndexSecond < ActiveSquad.UnitsAliveInSquad - 1 ? 1 : 0;
                Map.sndSelection.Play();
            }
            else if (ActiveInputManager.InputUpPressed())
            {
                Map.BattleMenuCursorIndexSecond -= Map.BattleMenuCursorIndexSecond > 1 ? 1 : 0;
                Map.sndSelection.Play();
            }
            if (ActiveInputManager.InputConfirmPressed())
            {
                if (Map.BattleMenuCursorIndexSecond == 1)
                {
                    Map.BattleMenuCursorIndexThird = (int)ActiveSquad.CurrentWingmanA.BattleDefenseChoice;
                }
                else if (Map.BattleMenuCursorIndexSecond == 2)
                {
                    Map.BattleMenuCursorIndexThird = (int)ActiveSquad.CurrentWingmanB.BattleDefenseChoice;
                }

                Map.BattleMenuStage = BattleMenuStages.ChooseSquadMemberDefense;
                Map.sndConfirm.Play();
            }
            else if (ActiveInputManager.InputCancelPressed())
            {
                Map.BattleMenuStage = BattleMenuStages.Default;
                Map.sndCancel.Play();
            }
        }
Esempio n. 3
0
        public override void DoUpdate(GameTime gameTime)
        {
            NavigateThroughNextChoices(Map.sndSelection, Map.sndConfirm);

            if (ActiveInputManager.InputConfirmPressed())
            {//Make sure the mouse is inside the menu.
                AddToPanelListAndSelect(ListNextChoice[ActionMenuCursor]);

                foreach (InteractiveProp ActiveProp in Map.LayerManager[(int)ActiveSquad.Position.Z].ListProp)
                {
                    foreach (Vector3 MovedOverPoint in ListMVHoverPoints)
                    {
                        ActiveProp.OnMovedOverBeforeStop(ActiveSquad, MovedOverPoint, CursorPosition);
                    }
                }

                Map.sndConfirm.Play();
            }
            else if (ActiveInputManager.InputCancelPressed())
            {
            }
            if (ActiveInputManager.InputUpPressed())
            {
                ActionMenuCursor -= (ActionMenuCursor > 0) ? 1 : 0;

                Map.sndSelection.Play();
            }
            else if (ActiveInputManager.InputDownPressed() && ActiveSquad.CurrentLeader.CanAttack)
            {
                ActionMenuCursor += (ActionMenuCursor < ListNextChoice.Count - 1) ? 1 : 0;

                Map.sndSelection.Play();
            }
        }
Esempio n. 4
0
 public override void DoUpdate(GameTime gameTime)
 {
     if (ActiveInputManager.InputConfirmPressed() || ActiveInputManager.InputCancelPressed())
     {
         //Reset the cursor.
         RemoveFromPanelList(this);
     }
 }
Esempio n. 5
0
        public override void DoUpdate(GameTime gameTime)
        {
            if (ActiveInputManager.InputConfirmPressed())
            {
                List <Squad> ListOtherSquads = FindOtherSquad("Tower");
                Unit         NewLeader       = Unit.FromType("Normal", "Electric Wall", Map.Content, Map.DicUnitType, Map.DicRequirement, Map.DicEffect, Map.DicAutomaticSkillTarget);
                NewLeader.ArrayCharacterActive = new Character[0];

                //Initialise the Unit stats.
                NewLeader.Init();
                Map.SpawnSquad(0, new Squad("Tower", NewLeader), 0, Map.CursorPosition, (int)Map.CursorPosition.Z);

                if (ListOtherSquads.Count > 0)
                {
                    foreach (Squad ActiveOtherSquad in ListOtherSquads)
                    {
                        Vector3 Position = ActiveOtherSquad.Position;

                        while ((Map.CursorPosition.X != Position.X && Map.CursorPosition.Y == Position.Y) ||
                               (Map.CursorPosition.X == Position.X && Map.CursorPosition.Y != Position.Y))
                        {
                            Vector3 Diff = Map.CursorPosition - Position;

                            Position.X += Math.Sign(Diff.X);
                            Position.Y += Math.Sign(Diff.Y);
                            Position.Z += Math.Sign(Diff.Z);

                            if (!Map.CheckForObstacleAtPosition(Position, Vector3.Zero))
                            {
                                NewLeader = Unit.FromType("Normal", "Electric Wall", Map.Content, Map.DicUnitType, Map.DicRequirement, Map.DicEffect, Map.DicAutomaticSkillTarget);
                                NewLeader.ArrayCharacterActive = new Character[0];

                                //Initialise the Unit stats.
                                NewLeader.Init();
                                Map.SpawnSquad(Map.ActivePlayerIndex, new Squad("Tower", NewLeader), 0, Position, (int)Position.Z);
                            }
                        }
                    }
                }
                Map.sndConfirm.Play();
                CancelPanel();
            }
            else if (ActiveInputManager.InputCancelPressed())
            {
            }
            else
            {
                Map.CursorControl(ActiveInputManager);
            }

            Map.LayerManager.AddDrawablePoints(ListBuildTerrain, Color.Coral);
        }
Esempio n. 6
0
        private void UpdateSupportSelection(GameTime gameTime)
        {
            if (ActiveInputManager.InputUpPressed())
            {
                --ActiveSquadSupport.ActiveSquadSupportIndex;
                if (ActiveSquadSupport.ActiveSquadSupportIndex < -1)
                {
                    ActiveSquadSupport.ActiveSquadSupportIndex = ActiveSquadSupport.Count - 1;
                }

                Map.sndSelection.Play();
            }
            else if (ActiveInputManager.InputDownPressed())
            {
                ++ActiveSquadSupport.ActiveSquadSupportIndex;
                if (ActiveSquadSupport.ActiveSquadSupportIndex >= ActiveSquadSupport.Count)
                {
                    ActiveSquadSupport.ActiveSquadSupportIndex = -1;
                }

                Map.sndSelection.Play();
            }
            else if (ActiveInputManager.InputConfirmPressed())
            {
                if (ActiveSquadSupport.ActiveSquadSupportIndex >= 0)
                {
                    Map.BattleMenuStage = BattleMenuStages.ChooseSupportAttack;
                    //Update weapons so you know which one is in attack range.

                    ActiveSquadSupport.ActiveSquadSupport.CurrentLeader.DisableAllAttacks();
                    ActiveSquadSupport.ActiveSquadSupport.CurrentLeader.UpdateAllAttacks(
                        ActiveSquadSupport.ActiveSquadSupport.Position,
                        TargetSquad.Position, TargetSquad.ArrayMapSize, TargetSquad.CurrentMovement,
                        ActiveSquadSupport.ActiveSquadSupport.CanMove);

                    Map.WeaponIndexOld = ActiveSquadSupport.ActiveSquadSupport.CurrentLeader.AttackIndex;
                    ActiveSquadSupport.ActiveSquadSupport.CurrentLeader.AttackIndex = 0;//Make sure you select the first weapon.
                }
                else
                {
                    Map.BattleMenuStage = BattleMenuStages.Default;
                }
                Map.sndConfirm.Play();
            }
            else if (ActiveInputManager.InputCancelPressed())
            {
                Map.BattleMenuStage = BattleMenuStages.Default;
                Map.sndCancel.Play();
            }
        }
Esempio n. 7
0
        public override void DoUpdate(GameTime gameTime)
        {
            if (TimeSinceSaveInSeconds == 0)
            {
                Map.SaveTemporaryMap();
                TimeSinceSaveInSeconds = gameTime.ElapsedGameTime.TotalSeconds;
            }
            else
            {
                TimeSinceSaveInSeconds += gameTime.ElapsedGameTime.TotalSeconds;

                if (ActiveInputManager.InputConfirmPressed() || ActiveInputManager.InputCancelPressed() || TimeSinceSaveInSeconds > 3)
                {
                    RemoveAllSubActionPanels();
                }
            }
        }
Esempio n. 8
0
        private void UpdateSupportAttackSelection(GameTime gameTime)
        {
            if (ActiveInputManager.InputUpPressed())
            {
                --ActiveSquadSupport.ActiveSquadSupport.CurrentLeader.AttackIndex;
                if (ActiveSquadSupport.ActiveSquadSupport.CurrentLeader.AttackIndex < 0)
                {
                    ActiveSquadSupport.ActiveSquadSupport.CurrentLeader.AttackIndex = ListAttackActiveSquadSupport.Count - 1;
                }

                Map.sndSelection.Play();
            }
            else if (ActiveInputManager.InputDownPressed())
            {
                ++ActiveSquadSupport.ActiveSquadSupport.CurrentLeader.AttackIndex;
                if (ActiveSquadSupport.ActiveSquadSupport.CurrentLeader.AttackIndex >= ListAttackActiveSquadSupport.Count)
                {
                    ActiveSquadSupport.ActiveSquadSupport.CurrentLeader.AttackIndex = 0;
                }

                Map.sndSelection.Play();
            }
            else if (ActiveInputManager.InputConfirmPressed())
            {
                if (ActiveSquadSupport.ActiveSquadSupport.CurrentLeader.CurrentAttack.CanAttack)
                {
                    Map.BattleMenuStage = BattleMenuStages.Default;
                    Map.sndConfirm.Play();
                }
                else
                {
                    Map.sndDeny.Play();
                }
            }
            else if (ActiveInputManager.InputCancelPressed())
            {
                ActiveSquadSupport.ActiveSquadSupportIndex = ActiveSquadSupportIndexOld;
                Map.BattleMenuStage = BattleMenuStages.ChooseSupport;
                Map.sndCancel.Play();
            }
        }
Esempio n. 9
0
        public override void DoUpdate(GameTime gameTime)
        {
            if (PhaseTime >= 0)
            {
                if (ActiveInputManager.InputConfirmPressed() || ActiveInputManager.InputCancelPressed() || ActiveInputManager.InputSkipPressed())
                {
                    PhaseTime = 0;
                }
                else
                {
                    PhaseTime--;
                }

                if (PhaseTime > 0)
                {
                    return;
                }
                else if (PhaseTime == 0)//Phase start.
                {
                    StartPlayerPhase(Map, Map.ListPlayer[Map.ActivePlayerIndex]);
                }
            }
        }
Esempio n. 10
0
 public override void DoUpdate(GameTime gameTime)
 {
     if (ActiveInputManager.InputCancelPressed())
     {
         RemoveFromPanelList(this);
     }
     else if (ActiveInputManager.InputConfirmPressed())
     {
         Map.CursorPosition        = ListMapMenuUnitPosition[MapUnitListChoice].Item2;
         Map.CursorPositionVisible = Map.CursorPosition;
         Map.PushScreen(new BattleMapScreen.CenterOnSquadCutscene(Map.CenterCamera, Map, Map.CursorPosition));
     }
     else if (ActiveInputManager.InputUpPressed())
     {
         MapUnitListChoice -= (MapUnitListChoice > 0) ? 1 : 0;
     }
     else if (ActiveInputManager.InputDownPressed())
     {
         ++MapUnitListChoice;
         if (MapUnitListChoice >= UnitListMaxPerPage)
         {
             MapUnitListChoice = UnitListMaxPerPage - 1;
         }
         else if ((MapUnitListCurrentPage - 1) * UnitListMaxPerPage + MapUnitListChoice >= ListMapMenuUnitPosition.Count)
         {
             MapUnitListChoice = (ListMapMenuUnitPosition.Count - 1) % UnitListMaxPerPage;
         }
     }
     else if (ActiveInputManager.InputLeftPressed())
     {
         MapUnitListCurrentPage -= (MapUnitListCurrentPage > 1) ? 1 : 0;
     }
     else if (ActiveInputManager.InputRightPressed())
     {
         MapUnitListCurrentPage += (MapUnitListCurrentPage < MapUnitListCurrentPageMax) ? 1 : 0;
     }
 }
Esempio n. 11
0
        private void UpdateAttackSelection(GameTime gameTime)
        {
            if (ActiveInputManager.InputUpPressed())
            {
                --TargetSquad.CurrentLeader.AttackIndex;
                if (TargetSquad.CurrentLeader.AttackIndex < 0)
                {
                    TargetSquad.CurrentLeader.AttackIndex = ListAttackTargetSquad.Count - 1;
                }

                Map.sndSelection.Play();
            }
            else if (ActiveInputManager.InputDownPressed())
            {
                ++TargetSquad.CurrentLeader.AttackIndex;
                if (TargetSquad.CurrentLeader.AttackIndex >= ListAttackTargetSquad.Count)
                {
                    TargetSquad.CurrentLeader.AttackIndex = 0;
                }

                Map.sndSelection.Play();
            }
            //Exit the weapon panel.
            if (ActiveInputManager.InputConfirmPressed())
            {
                if (TargetSquad.CurrentLeader.CurrentAttack.CanAttack)
                {
                    TargetSquad[Map.BattleMenuCursorIndexSecond].BattleDefenseChoice = Unit.BattleDefenseChoices.Attack;

                    if (TargetSquad.CurrentLeader.CurrentAttack.Pri == WeaponPrimaryProperty.ALL)
                    {
                        Map.BattleMenuDefenseFormationChoice = FormationChoices.ALL;

                        if (TargetSquad.CurrentLeader.BattleDefenseChoice == Unit.BattleDefenseChoices.Attack &&
                            TargetSquad.CurrentLeader.CurrentAttack.Pri == WeaponPrimaryProperty.ALL)
                        {
                            Map.BattleMenuDefenseFormationChoice = FormationChoices.ALL;

                            if (TargetSquad.CurrentWingmanA != null)
                            {
                                TargetSquad.CurrentWingmanA.BattleDefenseChoice = Unit.BattleDefenseChoices.Defend;
                            }

                            if (ActiveSquad.CurrentWingmanA != null)
                            {
                                TargetSquad.CurrentLeader.MAPAttackAccuracyA = Map.CalculateHitRate(TargetSquad.CurrentLeader, TargetSquad,
                                                                                                    ActiveSquad.CurrentWingmanA, ActiveSquad, ActiveSquad.CurrentWingmanA.BattleDefenseChoice).ToString() + "%";
                            }
                            else
                            {
                                TargetSquad.CurrentLeader.MAPAttackAccuracyA = "0%";
                            }

                            if (TargetSquad.CurrentWingmanB != null)
                            {
                                TargetSquad.CurrentWingmanB.BattleDefenseChoice = Unit.BattleDefenseChoices.Defend;
                            }

                            if (ActiveSquad.CurrentWingmanB != null)
                            {
                                TargetSquad.CurrentLeader.MAPAttackAccuracyB = Map.CalculateHitRate(TargetSquad.CurrentLeader, TargetSquad,
                                                                                                    ActiveSquad.CurrentWingmanB, ActiveSquad, ActiveSquad.CurrentWingmanB.BattleDefenseChoice).ToString() + "%";
                            }
                            else
                            {
                                TargetSquad.CurrentLeader.MAPAttackAccuracyB = "0%";
                            }
                        }
                    }
                    else
                    {
                        if (Map.BattleMenuDefenseFormationChoice == FormationChoices.ALL)
                        {
                            Map.BattleMenuDefenseFormationChoice = FormationChoices.Focused;
                        }

                        Map.UpdateWingmansSelection(TargetSquad, ActiveSquad, Map.BattleMenuOffenseFormationChoice);
                    }
                    Map.BattleMenuStage = BattleMenuStages.Default;

                    TargetSquad.CurrentLeader.BattleDefenseChoice = Unit.BattleDefenseChoices.Attack;

                    //Simulate offense reaction.
                    PrepareAttackSquadForBattle(Map, ActiveSquad, TargetSquad);
                    //The Defense Leader now attack.
                    TargetSquad.CurrentLeader.AttackAccuracy = Map.CalculateHitRate(TargetSquad.CurrentLeader, TargetSquad,
                                                                                    ActiveSquad.CurrentLeader, ActiveSquad, Unit.BattleDefenseChoices.Attack).ToString() + "%";

                    Map.sndConfirm.Play();
                }
                else
                {
                    Map.sndDeny.Play();
                }
            }
            else if (ActiveInputManager.InputCancelPressed())
            {
                Map.BattleMenuStage = BattleMenuStages.Default;
                Map.sndCancel.Play();
            }
        }
Esempio n. 12
0
        private void UpdateSquadMemberDefenseSelection(GameTime gameTime)
        {
            if (ActiveInputManager.InputUpPressed())
            {
                Map.BattleMenuCursorIndexThird++;
                if (Map.BattleMenuCursorIndexThird >= 3)
                {
                    if (Map.BattleMenuCursorIndexSecond > 0 && Map.BattleMenuCursorIndexThird >= 3 &&
                        (!ActiveSquad[Map.BattleMenuCursorIndexSecond].CanAttack || ActiveSquad.CurrentLeader.BattleDefenseChoice != Unit.BattleDefenseChoices.Attack || Map.BattleMenuOffenseFormationChoice == FormationChoices.ALL))
                    {
                        Map.BattleMenuCursorIndexThird = 1;
                    }
                    else
                    {
                        Map.BattleMenuCursorIndexThird = 0;
                    }
                }

                Map.sndSelection.Play();
            }
            else if (ActiveInputManager.InputDownPressed())
            {
                Map.BattleMenuCursorIndexThird--;
                if (Map.BattleMenuCursorIndexSecond > 0 && Map.BattleMenuCursorIndexThird <= 0 &&
                    (!ActiveSquad[Map.BattleMenuCursorIndexSecond].CanAttack || ActiveSquad.CurrentLeader.BattleDefenseChoice != Unit.BattleDefenseChoices.Attack || Map.BattleMenuOffenseFormationChoice == FormationChoices.ALL))
                {
                    Map.BattleMenuCursorIndexThird = 2;
                }
                else if (Map.BattleMenuCursorIndexThird < 0)
                {
                    Map.BattleMenuCursorIndexThird = 2;
                }

                Map.sndSelection.Play();
            }
            if (ActiveInputManager.InputConfirmPressed())
            {
                ActiveSquad[Map.BattleMenuCursorIndexSecond].BattleDefenseChoice = (Unit.BattleDefenseChoices)Map.BattleMenuCursorIndexThird;

                if (ActiveSquad[Map.BattleMenuCursorIndexSecond].BattleDefenseChoice == Unit.BattleDefenseChoices.Attack)
                {
                    //Simulate defense reaction.
                    PrepareDefenseSquadForBattle(Map, ActivePlayerIndex, ActiveSquadIndex, TargetPlayerIndex, TargetSquadIndex);

                    if (Map.BattleMenuOffenseFormationChoice == FormationChoices.Spread)
                    {
                        if (Map.BattleMenuCursorIndexSecond == 1)
                        {
                            ActiveSquad.CurrentWingmanA.AttackIndex    = ActiveSquad.CurrentWingmanA.PLAAttack;
                            ActiveSquad.CurrentWingmanA.AttackAccuracy = Map.CalculateHitRate(ActiveSquad.CurrentWingmanA, ActiveSquad,
                                                                                              TargetSquad.CurrentWingmanA, TargetSquad, TargetSquad.CurrentWingmanA.BattleDefenseChoice).ToString() + "%";
                        }
                        else if (Map.BattleMenuCursorIndexSecond == 2)
                        {
                            ActiveSquad.CurrentWingmanB.AttackIndex    = ActiveSquad.CurrentWingmanB.PLAAttack;
                            ActiveSquad.CurrentWingmanB.AttackAccuracy = Map.CalculateHitRate(ActiveSquad.CurrentWingmanB, ActiveSquad,
                                                                                              TargetSquad.CurrentWingmanB, TargetSquad, TargetSquad.CurrentWingmanB.BattleDefenseChoice).ToString() + "%";
                        }
                    }
                    else if (Map.BattleMenuOffenseFormationChoice == FormationChoices.Focused)
                    {
                        if (Map.BattleMenuCursorIndexSecond == 1)
                        {
                            ActiveSquad.CurrentWingmanA.AttackIndex    = ActiveSquad.CurrentWingmanA.PLAAttack;
                            ActiveSquad.CurrentWingmanA.AttackAccuracy = Map.CalculateHitRate(ActiveSquad.CurrentWingmanA, ActiveSquad,
                                                                                              TargetSquad.CurrentLeader, TargetSquad, TargetSquad.CurrentLeader.BattleDefenseChoice).ToString() + "%";
                        }
                        else if (Map.BattleMenuCursorIndexSecond == 2)
                        {
                            ActiveSquad.CurrentWingmanB.AttackIndex    = ActiveSquad.CurrentWingmanB.PLAAttack;
                            ActiveSquad.CurrentWingmanB.AttackAccuracy = Map.CalculateHitRate(ActiveSquad.CurrentWingmanB, ActiveSquad,
                                                                                              TargetSquad.CurrentLeader, TargetSquad, TargetSquad.CurrentLeader.BattleDefenseChoice).ToString() + "%";
                        }
                    }
                }

                Map.BattleMenuStage = BattleMenuStages.Default;
                Map.sndConfirm.Play();
            }
            else if (ActiveInputManager.InputCancelPressed())
            {
                Map.BattleMenuStage = BattleMenuStages.ChooseSquadMember;
                Map.sndCancel.Play();
            }
        }
Esempio n. 13
0
        private void UpdateBaseMenu(GameTime gameTime)
        {
            if (ActiveInputManager.InputLeftPressed())
            {
                Map.BattleMenuCursorIndex--;

                if (Map.BattleMenuCursorIndex == BattleMenuChoices.Formation)
                {//Can't pick Formation. (No wingmans or ALL attack)
                    if (TargetSquad.UnitsAliveInSquad == 1 || Map.BattleMenuDefenseFormationChoice == FormationChoices.ALL)
                    {
                        Map.BattleMenuCursorIndex = BattleMenuChoices.Action;
                    }
                }
                else if (Map.BattleMenuCursorIndex < BattleMenuChoices.Start)
                {
                    Map.BattleMenuCursorIndex = BattleMenuChoices.Demo;
                }

                Map.sndSelection.Play();
            }
            else if (ActiveInputManager.InputRightPressed())
            {
                Map.BattleMenuCursorIndex++;

                if (Map.BattleMenuCursorIndex == BattleMenuChoices.Formation)
                {//Can't pick Formation. (No wingmans or ALL attack)
                    if (TargetSquad.UnitsAliveInSquad == 1 || Map.BattleMenuDefenseFormationChoice == FormationChoices.ALL)
                    {
                        Map.BattleMenuCursorIndex = BattleMenuChoices.Support;
                    }
                }
                else if (Map.BattleMenuCursorIndex > BattleMenuChoices.Demo)
                {
                    Map.BattleMenuCursorIndex = BattleMenuChoices.Start;
                }

                Map.sndSelection.Play();
            }
            else if (ActiveInputManager.InputMovePressed())
            {
                if (ActiveInputManager.IsInZone(0, Constants.Height - 30, 125, Constants.Height))
                {
                    Map.BattleMenuCursorIndex = BattleMenuChoices.Start;
                }
                else if (ActiveInputManager.IsInZone(125, Constants.Height - 30, 255, Constants.Height))
                {
                    Map.BattleMenuCursorIndex = BattleMenuChoices.Action;
                }
                else if (ActiveInputManager.IsInZone(255, Constants.Height - 30, 385, Constants.Height) &&
                         (ActiveSquad.UnitsAliveInSquad > 1 && Map.BattleMenuDefenseFormationChoice != FormationChoices.ALL))
                {
                    Map.BattleMenuCursorIndex = BattleMenuChoices.Formation;
                }
                else if (ActiveInputManager.IsInZone(385, Constants.Height - 30, 510, Constants.Height) && ActiveSquadSupport.Count > 0)
                {
                    Map.BattleMenuCursorIndex = BattleMenuChoices.Support;
                }
                else if (ActiveInputManager.IsInZone(510, Constants.Height - 30, 635, Constants.Height))
                {
                    Map.BattleMenuCursorIndex = BattleMenuChoices.Demo;
                }
            }
            else if (ActiveInputManager.InputCommand2Pressed())
            {
                Constants.ShowAnimation = !Constants.ShowAnimation;

                Map.sndSelection.Play();
            }
            if (ActiveInputManager.InputConfirmPressed())
            {
                switch (Map.BattleMenuCursorIndex)
                {
                case BattleMenuChoices.Start:
                    Map.ComputeTargetPlayerOffense(ActivePlayerIndex, ActiveSquadIndex, ActiveSquadSupport, TargetPlayerIndex, TargetSquadIndex, TargetSquadSupport);
                    break;

                case BattleMenuChoices.Action:
                    Map.BattleMenuCursorIndexSecond = 0;
                    if (TargetSquad.UnitsAliveInSquad == 1)
                    {
                        Map.BattleMenuStage             = BattleMenuStages.ChooseDefense;
                        Map.BattleMenuCursorIndexSecond = (int)TargetSquad.CurrentLeader.BattleDefenseChoice;
                    }
                    else
                    {
                        Map.BattleMenuStage = BattleMenuStages.ChooseSquadMember;    //Choose squad member.
                    }
                    break;

                case BattleMenuChoices.Formation:
                    if (Map.BattleMenuDefenseFormationChoice != FormationChoices.ALL)
                    {
                        Map.BattleMenuCursorIndexSecond = (int)Map.BattleMenuDefenseFormationChoice;
                        Map.BattleMenuStage             = BattleMenuStages.ChooseFormation;
                    }
                    break;

                case BattleMenuChoices.Support:
                    Map.BattleMenuCursorIndexSecond = 0;
                    Map.BattleMenuStage             = BattleMenuStages.ChooseSupport;
                    break;

                case BattleMenuChoices.Demo:
                    Constants.ShowAnimation = !Constants.ShowAnimation;
                    break;
                }

                Map.sndConfirm.Play();
            }
            else if (ActiveInputManager.InputCancelPressed() && Map.ListPlayer[ActivePlayerIndex].IsPlayerControlled)//Can't cancel out of AI attacks.
            {
                CancelPanel();
            }
        }
Esempio n. 14
0
        private void UpdateFormationSelection(GameTime gameTime)
        {
            if (ActiveInputManager.InputUpPressed())
            {
                Map.BattleMenuCursorIndexSecond -= Map.BattleMenuCursorIndexSecond > 0 ? 1 : 0;
                Map.sndSelection.Play();
            }
            else if (ActiveInputManager.InputDownPressed())
            {
                Map.BattleMenuCursorIndexSecond += Map.BattleMenuCursorIndexSecond < 1 ? 1 : 0;
                Map.sndSelection.Play();
            }
            if (ActiveInputManager.InputConfirmPressed())
            {
                if (Map.BattleMenuCursorIndexSecond == 0)
                {
                    Map.BattleMenuOffenseFormationChoice = FormationChoices.Focused;
                }
                else if (Map.BattleMenuCursorIndexSecond == 1)
                {
                    Map.BattleMenuOffenseFormationChoice = FormationChoices.Spread;
                }

                Map.UpdateWingmansSelection(ActiveSquad, TargetSquad, Map.BattleMenuOffenseFormationChoice);

                if (ActiveSquad.CurrentWingmanA != null)
                {
                    if (ActiveSquad.CurrentWingmanA.CanAttack)
                    {
                        ActiveSquad.CurrentWingmanA.BattleDefenseChoice = Unit.BattleDefenseChoices.Attack;
                    }
                    else
                    {
                        ActiveSquad.CurrentWingmanA.BattleDefenseChoice = Unit.BattleDefenseChoices.Defend;
                    }
                }
                if (ActiveSquad.CurrentWingmanB != null)
                {
                    if (ActiveSquad.CurrentWingmanB.CanAttack)
                    {
                        ActiveSquad.CurrentWingmanB.BattleDefenseChoice = Unit.BattleDefenseChoices.Attack;
                    }
                    else
                    {
                        ActiveSquad.CurrentWingmanB.BattleDefenseChoice = Unit.BattleDefenseChoices.Defend;
                    }
                }

                //Simulate defense reaction.
                PrepareDefenseSquadForBattle(Map, ActivePlayerIndex, ActiveSquadIndex, TargetPlayerIndex, TargetSquadIndex);
                PrepareAttackSquadForBattle(Map, ActiveSquad, TargetSquad);

                Map.BattleMenuStage = BattleMenuStages.Default;
                Map.sndConfirm.Play();
            }
            else if (ActiveInputManager.InputCancelPressed())
            {
                Map.BattleMenuStage = BattleMenuStages.Default;
                Map.sndCancel.Play();
            }
        }
Esempio n. 15
0
        private void UpdateAttackSelection(GameTime gameTime)
        {
            if (ActiveInputManager.InputUpPressed())
            {
                --ActiveSquad.CurrentLeader.AttackIndex;
                if (ActiveSquad.CurrentLeader.AttackIndex < 0)
                {
                    ActiveSquad.CurrentLeader.AttackIndex = ListAttackActiveSquadSupport.Count - 1;
                }

                Map.sndSelection.Play();
            }
            else if (ActiveInputManager.InputDownPressed())
            {
                ++ActiveSquad.CurrentLeader.AttackIndex;
                if (ActiveSquad.CurrentLeader.AttackIndex >= ListAttackActiveSquadSupport.Count)
                {
                    ActiveSquad.CurrentLeader.AttackIndex = 0;
                }

                Map.sndSelection.Play();
            }
            else if (ActiveInputManager.InputMovePressed())
            {
                int YStep = 25;

                for (int A = 0; A < ListAttackActiveSquadSupport.Count; ++A)
                {
                    int YStart = 122 + A * YStep;
                    if (ActiveInputManager.IsInZone(0, YStart, Constants.Width, YStart + YStep))
                    {
                        ActiveSquad.CurrentLeader.AttackIndex = A;
                        break;
                    }
                }
            }
            //Exit the weapon panel.
            else if (ActiveInputManager.InputConfirmPressed())
            {
                if (ActiveSquad.CurrentLeader.CurrentAttack.CanAttack)
                {
                    if (ActiveSquad.CurrentLeader.CurrentAttack.Pri == WeaponPrimaryProperty.ALL)
                    {
                        Map.BattleMenuOffenseFormationChoice = FormationChoices.ALL;
                    }

                    Map.BattleMenuStage = BattleMenuStages.Default;
                    ActiveSquad.CurrentLeader.AttackAccuracy = Map.CalculateHitRate(ActiveSquad.CurrentLeader, ActiveSquad,
                                                                                    TargetSquad.CurrentLeader, TargetSquad, TargetSquad.CurrentLeader.BattleDefenseChoice).ToString() + "%";
                    if (!Map.ListPlayer[TargetPlayerIndex].IsPlayerControlled)
                    {
                        PrepareDefenseSquadForBattle(Map, ActivePlayerIndex, ActiveSquadIndex, TargetPlayerIndex, TargetSquadIndex);
                    }

                    Map.sndConfirm.Play();
                }
                else
                {
                    Map.sndDeny.Play();
                }
            }
            else if (ActiveInputManager.InputCancelPressed())
            {
                Map.BattleMenuStage = BattleMenuStages.Default;
                Map.sndCancel.Play();
            }
        }
Esempio n. 16
0
        private void UpdateBaseMenu(GameTime gameTime)
        {
            if (ActiveInputManager.InputLeftPressed())
            {
                Map.BattleMenuCursorIndex--;

                if (Map.BattleMenuCursorIndex == BattleMenuChoices.Support)
                {//Can't pick Support. (No Support Squads nearby)
                    if (ActiveSquadSupport.Count <= 0)
                    {
                        Map.BattleMenuCursorIndex = BattleMenuChoices.Formation;
                    }
                }
                if (Map.BattleMenuCursorIndex == BattleMenuChoices.Formation)
                {//Can't pick Formation. (No wingmans or ALL attack)
                    if (ActiveSquad.UnitsAliveInSquad == 1 || Map.BattleMenuDefenseFormationChoice == FormationChoices.ALL)
                    {
                        Map.BattleMenuCursorIndex = BattleMenuChoices.Action;
                    }
                }
                if (Map.BattleMenuCursorIndex < BattleMenuChoices.Start)
                {
                    Map.BattleMenuCursorIndex = BattleMenuChoices.Demo;
                }

                Map.sndSelection.Play();
            }
            else if (ActiveInputManager.InputRightPressed())
            {
                Map.BattleMenuCursorIndex++;

                if (Map.BattleMenuCursorIndex == BattleMenuChoices.Formation)
                {//Can't pick Formation. (No wingmans or ALL attack)
                    if (ActiveSquad.UnitsAliveInSquad == 1 || Map.BattleMenuDefenseFormationChoice == FormationChoices.ALL)
                    {
                        Map.BattleMenuCursorIndex = BattleMenuChoices.Support;
                    }
                }
                if (Map.BattleMenuCursorIndex == BattleMenuChoices.Support)
                {//Can't pick Support. (No Support Squads nearby)
                    if (ActiveSquadSupport.Count <= 0)
                    {
                        Map.BattleMenuCursorIndex = BattleMenuChoices.Demo;
                    }
                }
                if (Map.BattleMenuCursorIndex > BattleMenuChoices.Demo)
                {
                    Map.BattleMenuCursorIndex = BattleMenuChoices.Start;
                }

                Map.sndSelection.Play();
            }
            else if (ActiveInputManager.InputMovePressed())
            {
                if (ActiveInputManager.IsInZone(0, Constants.Height - 30, 125, Constants.Height))
                {
                    Map.BattleMenuCursorIndex = BattleMenuChoices.Start;
                }
                else if (ActiveInputManager.IsInZone(125, Constants.Height - 30, 255, Constants.Height))
                {
                    Map.BattleMenuCursorIndex = BattleMenuChoices.Action;
                }
                else if (ActiveInputManager.IsInZone(255, Constants.Height - 30, 385, Constants.Height) &&
                         (ActiveSquad.UnitsAliveInSquad > 1 && Map.BattleMenuDefenseFormationChoice != FormationChoices.ALL))
                {
                    Map.BattleMenuCursorIndex = BattleMenuChoices.Formation;
                }
                else if (ActiveInputManager.IsInZone(385, Constants.Height - 30, 510, Constants.Height) && ActiveSquadSupport.Count > 0)
                {
                    Map.BattleMenuCursorIndex = BattleMenuChoices.Support;
                }
                else if (ActiveInputManager.IsInZone(510, Constants.Height - 30, 635, Constants.Height))
                {
                    Map.BattleMenuCursorIndex = BattleMenuChoices.Demo;
                }
            }
            else if (ActiveInputManager.InputCommand1Pressed())
            {
                Map.SpiritMenu.InitSpiritScreen(ActiveSquad);

                Map.BattleMenuStage = BattleMenuStages.Default;
            }
            else if (ActiveInputManager.InputCommand2Pressed())
            {
                //Constants.ShowAnimation = !Constants.ShowAnimation;

                Map.sndSelection.Play();
            }
            if (ActiveInputManager.InputConfirmPressed())
            {
                switch (Map.BattleMenuCursorIndex)
                {
                //Begin attack.
                case BattleMenuChoices.Start:
                    StartBattle();
                    break;

                case BattleMenuChoices.Action:
                    if (ActiveSquad.UnitsAliveInSquad == 1)
                    {
                        ActiveSquad.CurrentLeader.UpdateNonMAPAttacks(ActiveSquad.Position, TargetSquad.Position, TargetSquad.ArrayMapSize, TargetSquad.CurrentMovement, ActiveSquad.CanMove);

                        ActiveSquad.CurrentLeader.AttackIndex = 0;    //Make sure you select the first weapon.
                        Map.BattleMenuStage = BattleMenuStages.ChooseAttack;
                    }
                    else
                    {
                        Map.BattleMenuStage             = BattleMenuStages.ChooseSquadMember; //Choose squad member.
                        Map.BattleMenuCursorIndexSecond = 1;                                  //Leader is attacking, can't put him on defend or evade.
                    }
                    break;

                case BattleMenuChoices.Formation:
                    Map.BattleMenuCursorIndexSecond = (int)Map.BattleMenuOffenseFormationChoice;
                    Map.BattleMenuStage             = BattleMenuStages.ChooseFormation;
                    break;

                case BattleMenuChoices.Support:
                    Map.BattleMenuCursorIndexSecond = 0;
                    ActiveSquadSupportIndexOld      = ActiveSquadSupport.ActiveSquadSupportIndex;
                    Map.BattleMenuStage             = BattleMenuStages.ChooseSupport;
                    break;

                case BattleMenuChoices.Demo:
                    Constants.ShowAnimation = !Constants.ShowAnimation;
                    break;
                }

                Map.sndConfirm.Play();
            }
            else if (ActiveInputManager.InputCancelPressed())
            {
                CancelPanel();
            }
        }
Esempio n. 17
0
        public override void DoUpdate(GameTime gameTime)
        {
            bool CursorMoved = Map.UpdateMapNavigation(ActiveInputManager);

            if (CursorMoved)
            {
                BattlePreview = null;
            }
            //Loop through the players to find a Unit to control.
            for (int P = 0; P < Map.ListPlayer.Count; P++)
            {
                //Find if a current player Unit is under the cursor.
                int CursorSelect = Map.CheckForSquadAtPosition(P, Map.CursorPosition, Vector3.Zero);

                if (CursorSelect >= 0)
                {
                    if (BattlePreview == null)
                    {
                        BattlePreview = new BattlePreviewer(Map, P, CursorSelect, null);
                    }
                    BattlePreview.UpdateUnitDisplay();
                }
            }

            if (ActiveInputManager.InputCancelPressed())
            {
                AddToPanelListAndSelect(Map.BattleMapMenu);

                Map.ActiveSquadIndex = -1;
                Map.sndConfirm.Play();
            }
            else if (ActiveInputManager.InputConfirmPressed())
            {
                Map.ActiveSquadIndex = -1;
                Map.TargetSquadIndex = -1;
                bool UnitFound = false;
                //Loop through the players to find a Unit to control.
                for (int P = 0; P < Map.ListPlayer.Count && (Map.ActiveSquadIndex < 0 && Map.TargetSquadIndex < 0); P++)
                {
                    //Find if a current player Unit is under the cursor.
                    int CursorSelect = Map.CheckForSquadAtPosition(P, Map.CursorPosition, Vector3.Zero);

                    #region Unit found

                    if (CursorSelect >= 0)
                    {
                        UnitFound = true;
                        ActionPanelMainMenu NewActionMenu = new ActionPanelMainMenu(Map, P, CursorSelect);

                        if (P == Map.ActivePlayerIndex && Map.ListPlayer[P].ListSquad[CursorSelect].IsPlayerControlled)//Player controlled Squad.
                        {
                            NewActionMenu.OnSelect();
                        }
                        else//Enemy.
                        {
                            NewActionMenu.AddChoiceToCurrentPanel(new ActionPanelStatus(Map, Map.ListPlayer[P].ListSquad[CursorSelect]));
                        }

                        AddToPanelList(NewActionMenu);
                    }

                    #endregion
                }

                //You select the tile under the cursor.
                if (!UnitFound)
                {
                    AddToPanelListAndSelect(new ActionPanelTileStatus(Map));
                }

                Map.sndConfirm.Play();
            }
        }