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)); } }
public override void DoUpdate(GameTime gameTime) { if (InputHelper.InputConfirmPressed()) { if (ConfirmMenuChoice == 0) { RemoveAllActionPanels(); ActionPanelPhaseChange PhaseEnd = new ActionPanelPhaseChange(Map); Map.ListActionMenuChoice.Add(PhaseEnd); PhaseEnd.OnSelect(); } else if (ConfirmMenuChoice == 1) { RemoveFromPanelList(this); } } else if (InputHelper.InputCancelPressed()) { RemoveFromPanelList(this); } else if (InputHelper.InputLeftPressed()) { if (ConfirmMenuChoice == 1) { ConfirmMenuChoice = 0; } } else if (InputHelper.InputRightPressed()) { if (ConfirmMenuChoice == 0) { ConfirmMenuChoice = 1; } } }
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) { ActionPanelPhaseChange.EndPlayerPhase(Map); } }
public override void OnSquadDefeated(int DefeatedSquadPlayerIndex, Squad DefeatedSquad) { bool HordePlayerAILost = true; for (int i = 0; HordePlayerAILost && i < Owner.ListSubMap.Count; i++) { DeathmatchMap ActiveMap = (DeathmatchMap)Owner.ListSubMap[i]; foreach (Squad ActiveSquad in ActiveMap.ListPlayer[10].ListSquad) { if (!ActiveSquad.IsDead) { HordePlayerAILost = false; break; } } } if (HordePlayerAILost) { ActionPanelPhaseChange.FinishAIPlayerTurn(Owner); } }
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); } } }