Esempio n. 1
0
        public static void FinishAIPlayerTurn(DeathmatchMap Map)
        {
            List <BattleMap> ListActiveSubMaps = ActionPanelMapSwitch.GetActiveSubMaps(Map);

            if (ListActiveSubMaps.Count <= 1)
            {
                Map.ListActionMenuChoice.RemoveAllActionPanels();
                Map.ListActionMenuChoice.AddToPanelListAndSelect(new ActionPanelPhaseChange(Map));
            }
            else//Look for sub maps to update before ending turn.
            {
                foreach (BattleMap ActiveMap in ListActiveSubMaps)
                {
                    if (ActiveMap != Map && ActiveMap.ActivePlayerIndex == Map.ActivePlayerIndex)
                    {
                        ActionPanelPhaseChange.EndPlayerPhase(Map);
                        Map.ListGameScreen.Remove(Map);
                        Map.ListGameScreen.Insert(0, ActiveMap);
                        return;
                    }
                }

                Map.ListActionMenuChoice.RemoveAllActionPanels();
                //No sub map to be updated, should never get up to this point.
                Map.ListActionMenuChoice.AddToPanelListAndSelect(new ActionPanelPhaseChange(Map));
            }
        }
Esempio n. 2
0
        public override void OnSelect()
        {
            ActionMenuCursor = 0;
            ListNextChoice.Clear();
            AddChoiceToCurrentPanel(new ActionPanelEndTurn(Map, sprCursorConfirmEndNo, sprCursorConfirmEndYes));
            AddChoiceToCurrentPanel(new ActionPanelObjectives(Map, fntFinlanderFont));
            AddChoiceToCurrentPanel(new ActionPanelUnitList(Map, sprBarLargeBackground, sprBarLargeEN, sprBarLargeHP, sprMapMenuBackground, sprLand, sprSea, sprSky,
                                                            sprSpace, fntFinlanderFont));
            AddChoiceToCurrentPanel(new ActionPanelQuickSave(Map));
            AddChoiceToCurrentPanel(new ActionPanelOptions(Map));

            if (GameScreen.UseDebugMode)
            {
                AddChoiceToCurrentPanel(new ActionPanelDebugScreen(Map));
            }

            if (ActionPanelMapSwitch.GetActiveSubMaps(Map).Count > 1)
            {
                AddChoiceToCurrentPanel(new ActionPanelMapChange(Map, fntFinlanderFont));
            }
        }
Esempio n. 3
0
        public override void DoUpdate(GameTime gameTime)
        {
            Map.CursorPosition = new Vector3(-1, -1, -1);

            Vector3 NextPosition = HubSquad.Position;

            if (InputHelper.InputUpHold() && CheckTerrain(HubSquad.Position.X, HubSquad.Position.Y - 0.1f))
            {
                NextPosition = new Vector3(HubSquad.Position.X, HubSquad.Position.Y - 0.1f, HubSquad.Z);
            }
            if (InputHelper.InputDownHold() && CheckTerrain(HubSquad.Position.X, HubSquad.Position.Y + 0.1f))
            {
                NextPosition = new Vector3(HubSquad.Position.X, HubSquad.Position.Y + 0.1f, HubSquad.Z);
            }
            if (InputHelper.InputLeftHold() && CheckTerrain(HubSquad.Position.X - 0.1f, HubSquad.Position.Y))
            {
                NextPosition = new Vector3(HubSquad.Position.X - 0.1f, HubSquad.Position.Y, HubSquad.Z);
            }
            if (InputHelper.InputRightHold() && CheckTerrain(HubSquad.Position.X + 0.1f, HubSquad.Position.Y))
            {
                NextPosition = new Vector3(HubSquad.Position.X + 0.1f, HubSquad.Position.Y, HubSquad.Z);
            }

            if (NextPosition != HubSquad.Position)
            {
                Squad CollidingSquad = CheckHubSquad(NextPosition);
                if (CollidingSquad == null)
                {
                    HubSquad.SetPosition(NextPosition);
                }
                else
                {
                    Map.CursorPosition        = CollidingSquad.Position;
                    Map.CursorPositionVisible = Map.CursorPosition;
                    List <ActionPanel> SquadSelect = CollidingSquad.OnMenuSelect(Map.ListActionMenuChoice);
                    foreach (ActionPanel ActivePanel in SquadSelect)
                    {
                        Map.ListActionMenuChoice.Add(ActivePanel);
                    }
                }
            }

            foreach (MapSwitchPoint ActiveSwitchPoint in Map.ListMapSwitchPoint)
            {
                if (CheckPositionOverlap(ActiveSwitchPoint.Position, NextPosition))
                {
                    ActionPanelMapSwitch.ChangeSquadBetweenMaps(Map, HubSquad, ActiveSwitchPoint);
                }
            }

            //Update the camera if needed.
            while (HubSquad.Position.X - Map.CameraPosition.X - 3 < 0 && Map.CameraPosition.X > 0)
            {
                Map.CameraPosition.X -= 0.1f;
            }
            while (HubSquad.Position.X - Map.CameraPosition.X >= Map.ScreenSize.X / 2 && Map.CameraPosition.X + Map.ScreenSize.X < Map.MapSize.X)
            {
                Map.CameraPosition.X += 0.1f;
            }

            if (HubSquad.Position.Y - Map.CameraPosition.Y - 3 < 0 && Map.CameraPosition.Y > 0)
            {
                Map.CameraPosition.Y -= 0.1f;
            }
            while (HubSquad.Position.Y - Map.CameraPosition.Y >= Map.ScreenSize.Y / 2 && Map.CameraPosition.Y + Map.ScreenSize.Y < Map.MapSize.Y)
            {
                Map.CameraPosition.Y += 0.1f;
            }
        }
Esempio n. 4
0
 public override void OnSelect()
 {
     ListMapChangeChoice = ActionPanelMapSwitch.GetActiveSubMaps(Map);
 }
Esempio n. 5
0
        public override void OnSelect()
        {
            HasBeenSelected = true;
            List <BattleMap> ListActiveSubMaps = ActionPanelMapSwitch.GetActiveSubMaps(Map);

            if (ListActiveSubMaps.Count <= 1)
            {
                EndPlayerPhase(Map);
                if (Map.IsServer)
                {
                    StartPlayerPhase(Map, Map.ListPlayer[Map.ActivePlayerIndex]);
                }
            }
            else
            {
                int InitialPlayerIndex = Map.ActivePlayerIndex;

                //Immediately update the sub maps, the player or AI will cycle through them if needed.
                foreach (BattleMap ActiveMap in ListActiveSubMaps)
                {
                    if (ActiveMap != Map && ActiveMap.ActivePlayerIndex == Map.ActivePlayerIndex)
                    {
                        DeathmatchMap ActiveDeathmatchMap = (DeathmatchMap)ActiveMap;
                        EndPlayerPhase(ActiveDeathmatchMap);
                        StartPlayerPhase(ActiveDeathmatchMap, ActiveDeathmatchMap.ListPlayer[ActiveDeathmatchMap.ActivePlayerIndex]);
                    }
                }

                EndPlayerPhase(Map);

                //If the current Map has no other Players it will skip the other Players in other sub maps. If that happen switch to a Map with the proper player.
                if (InitialPlayerIndex == Map.ActivePlayerIndex)
                {
                    bool HasFoundPlayer  = false;
                    int  NextPlayerIndex = InitialPlayerIndex + 1;

                    while (NextPlayerIndex != InitialPlayerIndex)
                    {
                        foreach (BattleMap ActiveMap in ListActiveSubMaps)
                        {
                            if (ActiveMap != Map && ActiveMap.ActivePlayerIndex == NextPlayerIndex)
                            {
                                DeathmatchMap ActiveDeathmatchMap = (DeathmatchMap)ActiveMap;

                                if (ActiveDeathmatchMap.ListPlayer.Count >= NextPlayerIndex)
                                {
                                    Map.ListGameScreen.Remove(Map);
                                    Map.ListGameScreen.Insert(0, ActiveMap);
                                    StartPlayerPhase(Map, Map.ListPlayer[Map.ActivePlayerIndex]);
                                    HasFoundPlayer = true;
                                    return;
                                }
                            }
                        }

                        if (HasFoundPlayer)
                        {
                            ++NextPlayerIndex;
                        }
                        else
                        {
                            NextPlayerIndex = 0;
                        }
                    }
                }
            }
        }
Esempio n. 6
0
        public override void DoUpdate(GameTime gameTime)
        {
            int UnitsNotUpdatedCount = Map.ListPlayer[Map.ActivePlayerIndex].ListSquad.Count;

            for (int U = 0; U < Map.ListPlayer[Map.ActivePlayerIndex].ListSquad.Count; U++)
            {
                Map.ActiveSquadIndex = U;
                Squad ActiveSquad = Map.ListPlayer[Map.ActivePlayerIndex].ListSquad[U];

                if (!Map.ActiveSquad.CanMove || Map.ActiveSquad.CurrentLeader == null)
                {
                    --UnitsNotUpdatedCount;
                    continue;
                }

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

                if (ActiveSquad.X < Map.CameraPosition.X || ActiveSquad.Y < Map.CameraPosition.Y ||
                    ActiveSquad.X >= Map.CameraPosition.X + Map.ScreenSize.X || ActiveSquad.Y >= Map.CameraPosition.Y + Map.ScreenSize.Y)
                {
                    Map.PushScreen(new CenterOnSquadCutscene(Map.CenterCamera, Map, ActiveSquad.Position));
                }

                Map.TargetSquadIndex = -1;

                ActiveSquad.SquadAI.UpdateStep(gameTime);

                Map.TargetSquadIndex = -1;
                break;
            }

            if (UnitsNotUpdatedCount == 0)
            {
                List <BattleMap> ListActiveSubMaps = ActionPanelMapSwitch.GetActiveSubMaps(Map);
                if (ListActiveSubMaps.Count <= 1)
                {
                    ActionPanelPhaseChange PhaseEnd = new ActionPanelPhaseChange(Map);
                    AddToPanelListAndSelect(PhaseEnd);
                }
                else//Look for sub maps to update before ending turn.
                {
                    foreach (BattleMap ActiveMap in ListActiveSubMaps)
                    {
                        if (ActiveMap != Map && ActiveMap.ActivePlayerIndex == Map.ActivePlayerIndex)
                        {
                            ActionPanelPhaseChange.EndPlayerPhase(Map);
                            Map.ListGameScreen.Remove(Map);
                            Map.ListGameScreen.Insert(0, ActiveMap);
                            return;
                        }
                    }

                    //No sub map to be updated, should never get up to this point.
                    ActionPanelPhaseChange PhaseEnd = new ActionPanelPhaseChange(Map);
                    AddToPanelListAndSelect(PhaseEnd);
                }
            }
        }