public static void StartPlayerPhase(DeathmatchMap Map, Player ActivePlayer) { Map.UpdateMapEvent(BattleMap.EventTypePhase, 0); Map.ListActionMenuChoice.RemoveAllActionPanels();//Will also remove this panel bool AIControlledSquadFound = false; for (int U = 0; U < ActivePlayer.ListSquad.Count; U++) { if (ActivePlayer.ListSquad[U].CurrentLeader != null && ActivePlayer.ListSquad[U].SquadAI != null && !ActivePlayer.ListSquad[U].IsPlayerControlled) { AIControlledSquadFound = true; } } if (AIControlledSquadFound) { Map.ListActionMenuChoice.AddToPanelListAndSelect(new ActionPanelPlayerPrePhaseAIStep(Map)); } else { if (!ActivePlayer.IsPlayerControlled) { Map.ListActionMenuChoice.AddToPanelListAndSelect(new ActionPanelPlayerAIStep(Map)); } else { Map.ListActionMenuChoice.AddToPanelListAndSelect(new ActionPanelPlayerHumanStep(Map)); } } }
public override void Update(GameTime gameTime) { if (ShowLevelUp) { if (NeedToScrollSkills) { ScrollTextOffsetSkill += (float)(gameTime.ElapsedGameTime.TotalSeconds) * ScrollingTextPixelPerSecondSpeed; if (ScrollTextOffsetSkill > ScrollTextOffsetMaxSkill + 20) { ScrollTextOffsetSkill = -10; } } if (NeedToScrollSpirits) { ScrollTextOffsetSpirits += (float)(gameTime.ElapsedGameTime.TotalSeconds) * ScrollingTextPixelPerSecondSpeed; if (ScrollTextOffsetSkill > ScrollTextOffsetMaxSkill + 20) { ScrollTextOffsetSkill = -10; } } } if (InputHelper.InputConfirmReleased()) { if (Pilot.Level != OriginalPilotLevel && !ShowLevelUp) { ShowLevelUp = true; } else { RemoveScreen(this); if (UpdateBattleEventsOnClose) { Map.GlobalBattleContext.SetContext(Attacker, Attacker.CurrentLeader, Attacker.CurrentLeader.Pilot, TargetSquad, TargetSquad.CurrentLeader, TargetSquad.CurrentLeader.Pilot, Map.ActiveParser); Map.UpdateMapEvent(BattleMap.EventTypeOnBattle, 1); Map.GlobalBattleContext.SetContext(null, null, null, null, null, null, Map.ActiveParser); } //Don't update the leader until after the events are processed. (If a battle map event try to read the leader of a dead unit it will crash on a null pointer as dead units have no leader) if (Attacker != null) { Attacker.UpdateSquad(); if (ActiveSquadSupport != null && ActiveSquadSupport.ActiveSquadSupport != null) { ActiveSquadSupport.ActiveSquadSupport.UpdateSquad(); } TargetSquad.UpdateSquad(); if (TargetSquadSupport != null && TargetSquadSupport.ActiveSquadSupport != null) { TargetSquadSupport.ActiveSquadSupport.UpdateSquad(); } Map.GameRule.OnSquadDefeated(TargetSquadPlayerIndex, TargetSquad); } } } }