public override void Update(GameTime gameTime) { //Change the alpha of the cursor. if (CursorAppearing) { if (++CursorAlpha >= 200) { CursorAppearing = false; } } else { if (--CursorAlpha <= 20) { CursorAppearing = true; } } if (KeyboardHelper.InputUpPressed()) { CursorIndex -= (CursorIndex > 0) ? 1 : 0; } else if (KeyboardHelper.InputDownPressed()) { if (Sort == SortType.Type) { CursorIndex += (CursorIndex < 5) ? 1 : 0; } else { CursorIndex += (CursorIndex < ListItems.Count() - 1) ? 1 : 0; } } else if (KeyboardHelper.InputLeftPressed()) { if (CursorIndex == 0) { Sort -= ((int)Sort > 0) ? 1 : 0; } } else if (KeyboardHelper.InputRightPressed()) { if (CursorIndex == 0) { Sort += ((int)Sort < 1) ? 1 : 0; } } if (KeyboardHelper.InputCancelPressed()) { GameScreen.RemoveScreen(this); } else if (KeyboardHelper.KeyPressed(Microsoft.Xna.Framework.Input.Keys.Escape)) { GameScreen.RemoveScreen(this); } }
public override void Update(GameTime gameTime) { if (CursorAlphaAppearing) {//Increment SelectedAlpha before comparing it to 200 CursorAlpha += 5; if (CursorAlpha >= 200) { CursorAlphaAppearing = false; } } else {//Decrement SelectedAlpha before comparing it to 55 CursorAlpha -= 5; if (CursorAlpha <= 55) { CursorAlphaAppearing = true; } } #region Stage == -1 if (Stage == -1) { if (KeyboardHelper.InputUpPressed()) { if ((int)SelectedChoice < 2) { SelectedChoice -= (int)SelectedChoice > 0 ? 1 : 0; } else if ((int)SelectedChoice < 4) { SelectedChoice -= (int)SelectedChoice > 2 ? 1 : 0; } } else if (KeyboardHelper.InputDownPressed()) { if ((int)SelectedChoice < 2) { SelectedChoice += (int)SelectedChoice < 1 ? 1 : 0; } else if ((int)SelectedChoice < 4) { SelectedChoice += (int)SelectedChoice < 3 ? 1 : 0; } } if (KeyboardHelper.InputLeftPressed() && (int)SelectedChoice >= 2) { SelectedChoice = SelectChoice.PlayerList; } else if (KeyboardHelper.InputRightPressed() && (int)SelectedChoice < 2) { SelectedChoice = SelectChoice.ChangeMap; } else if (KeyboardHelper.InputConfirmPressed()) { switch (SelectedChoice) { case SelectChoice.PlayerList: PlayerIndex = 0; break; case SelectChoice.ChangeMap: CursorMap = CurrentMap; break; case SelectChoice.StartGame: GameScreen.PushScreen(new DeathmatchMap(ArrayMapFile[CurrentMap].FullName, ListPlayer, 1)); GameScreen.RemoveScreen(this); break; } Stage = 0; } } #endregion else { switch (SelectedChoice) { #region Messenger case SelectChoice.Messenger: Microsoft.Xna.Framework.Input.Keys[] Input = KeyboardHelper.KeyPressed(); for (int i = 0; i < Input.Count(); i++) { if (KeyboardHelper.KeyPressed(Input[i])) { if (Input[i] == Microsoft.Xna.Framework.Input.Keys.Space) { Message = Message.Insert(MessageCursorIndex, " "); MessageDraw = MessageDraw.Insert(MessageCursorIndex, " "); MessageCursorIndex++; UpdateMessengerCursor(); } else if (Input[i] == Microsoft.Xna.Framework.Input.Keys.Enter) { Messenger.Add(Message); Message = ""; MessageDraw = ""; MessageCursorIndex = 0; } else if (Input[i] == Microsoft.Xna.Framework.Input.Keys.Back) { if (Message.Length > 0) { MessageCursorIndex--; Message = Message.Remove(MessageCursorIndex, 1); MessageDraw = MessageDraw.Remove(MessageCursorIndex, 1); UpdateMessengerCursor(); } } else if ((int)Input[i] >= 65 && (int)Input[i] <= 90) { Message = Message.Insert(MessageCursorIndex, Input[i].ToString()); MessageDraw = MessageDraw.Insert(MessageCursorIndex, Input[i].ToString()); MessageCursorIndex++; UpdateMessengerCursor(); } else if (Input[i] == Microsoft.Xna.Framework.Input.Keys.Left) { MessageCursorIndex -= MessageCursorIndex > 0 ? 1 : 0; UpdateMessengerCursor(); } else if (Input[i] == Microsoft.Xna.Framework.Input.Keys.Right) { MessageCursorIndex += MessageCursorIndex < Message.Count() ? 1 : 0; UpdateMessengerCursor(); } } } if (KeyboardHelper.InputCancelPressed()) { Stage = -1; } break; #endregion #region PlayerList case SelectChoice.PlayerList: switch (Stage) { case 0: //Player selection if (KeyboardHelper.InputUpPressed()) { PlayerIndex -= PlayerIndex > 0 ? 1 : 0; } else if (KeyboardHelper.InputDownPressed()) { PlayerIndex += PlayerIndex < Math.Min(ListPlayer.Count, ListMap[CursorMap].NumberOfPlayers - 1) ? 1 : 0; } if (KeyboardHelper.InputLeftPressed() || KeyboardHelper.InputRightPressed() || KeyboardHelper.InputConfirmPressed()) { SubMenu = 0; Stage++; } else if (KeyboardHelper.InputCancelPressed()) { Stage = -1; } break; case 1: //SubMenu selection if (KeyboardHelper.InputUpPressed()) { PlayerIndex -= PlayerIndex > 0 ? 1 : 0; } else if (KeyboardHelper.InputDownPressed()) { PlayerIndex += PlayerIndex < Math.Min(ListPlayer.Count, ListMap[CursorMap].NumberOfPlayers - 1) ? 1 : 0; if (PlayerIndex == ListMap[CursorMap].NumberOfPlayers - 1 && ListPlayer.Count < ListMap[CursorMap].NumberOfPlayers) { SubMenu = 0; } } if (KeyboardHelper.InputLeftPressed() && (PlayerIndex != ListMap[CursorMap].NumberOfPlayers - 1 || ListPlayer.Count >= ListMap[CursorMap].NumberOfPlayers)) { SubMenu -= SubMenu > 0 ? 1 : 0; } else if (KeyboardHelper.InputRightPressed() && (PlayerIndex != ListMap[CursorMap].NumberOfPlayers - 1 || ListPlayer.Count >= ListMap[CursorMap].NumberOfPlayers)) { SubMenu += SubMenu < 2 ? 1 : 0; } else if (KeyboardHelper.InputCancelPressed()) { Stage--; } else if (KeyboardHelper.InputConfirmPressed()) { Stage++; PlayerOptionIndex = 0; if (SubMenu == 0) { //If the index is on the last player or on an empty space if (PlayerIndex == ListPlayer.Count - 1 || PlayerIndex >= ListPlayer.Count) { Types = new PlayerTypes[] { PlayerTypes.Closed, PlayerTypes.Human, PlayerTypes.CPUEasy } } ; else { Types = new PlayerTypes[] { PlayerTypes.Human, PlayerTypes.CPUEasy } }; } } break; case 2: //PlayerOption selection switch (SubMenu) { case 0: //Player type if (KeyboardHelper.InputUpPressed()) { PlayerOptionIndex -= PlayerOptionIndex > 0 ? 1 : 0; } else if (KeyboardHelper.InputDownPressed()) { PlayerOptionIndex += PlayerOptionIndex < Types.Count() - 1 ? 1 : 0; } else if (KeyboardHelper.InputConfirmPressed()) { if (PlayerIndex < ListPlayer.Count) { if (Types[PlayerOptionIndex] == PlayerTypes.Closed) { ListPlayer.RemoveAt(PlayerIndex); } else { ListPlayer[PlayerIndex].PType = Types[PlayerOptionIndex]; } } else { if (Types[PlayerOptionIndex] == PlayerTypes.Closed) { ListPlayer.RemoveAt(PlayerIndex); } else { List <Unit> ListUnit; ListUnit = new List <Unit>(); /*ListUnit.Add(new UnitArmoredCore(UnitArmoredCore.ListUnitArmoredCore[0])); * ListUnit[0].Init(); * ListUnit.Add(new UnitArmoredCore(UnitArmoredCore.ListUnitArmoredCore[0])); * ListUnit[1].Init(); * ListUnit.Add(new UnitArmoredCore(UnitArmoredCore.ListUnitArmoredCore[0])); * ListUnit[2].Init();*/ ListPlayer.Add(new Player("New player", Types[PlayerOptionIndex], ListUnit, 0)); } } Stage--; } else if (KeyboardHelper.InputCancelPressed()) { Stage--; } break; case 1: //Team if (KeyboardHelper.InputUpPressed()) { PlayerOptionIndex -= PlayerOptionIndex > 0 ? 1 : 0; } else if (KeyboardHelper.InputDownPressed()) { PlayerOptionIndex += PlayerOptionIndex < ListMap[CursorMap].NumberOfTeam - 1 ? 1 : 0; } else if (KeyboardHelper.InputConfirmPressed()) { ListPlayer[PlayerIndex].Team = PlayerOptionIndex; Stage--; } else if (KeyboardHelper.InputCancelPressed()) { Stage--; } break; } break; } break; #endregion case SelectChoice.ChangeMap: if (KeyboardHelper.InputUpPressed()) { CursorMap--; if (CursorMap < 0) { CursorMap = ListMap.Count - 1; } } else if (KeyboardHelper.InputDownPressed()) { CursorMap++; if (CursorMap > ListMap.Count - 1) { CursorMap = 0; } } else if (KeyboardHelper.InputConfirmPressed()) { CurrentMap = CursorMap; Stage--; } else if (KeyboardHelper.InputCancelPressed()) { Stage--; } break; } } if (KeyboardHelper.KeyPressed(Microsoft.Xna.Framework.Input.Keys.Escape)) { GameScreen.RemoveScreen(this); } }
public bool InputRightPressed() { return(KeyboardHelper.InputRightPressed()); }
public override void Update(GameTime gameTime) { //Change the alpha of the cursor. if (CursorAppearing) { if (++CursorAlpha >= 200) { CursorAppearing = false; } } else { if (--CursorAlpha <= 70) { CursorAppearing = true; } } if (KeyboardHelper.InputUpPressed()) { CursorIndex--; if (CursorIndex < 0) { CursorIndex = CursorIndexMax; if (CursorIndex > 32) { CursorIndexStart = CursorIndexMax - 31; } } if (CursorIndex < CursorIndexStart) { CursorIndexStart--; } //Reset the CursorFilter. int CursorPos = CursorIndex; ResetCursorFilter(MainFilter); GetCursorFilter(MainFilter, ref CursorPos); } else if (KeyboardHelper.InputDownPressed()) { CursorIndex++; if (CursorIndex > CursorIndexMax) { CursorIndex = 0; CursorIndexStart = 0; } if (CursorIndex >= 32 + CursorIndexStart) { CursorIndexStart++; } //Reset the CursorFilter. int CursorPos = CursorIndex; ResetCursorFilter(MainFilter); GetCursorFilter(MainFilter, ref CursorPos); } if (KeyboardHelper.InputRightPressed()) { //If the cursor points on an Item and the item can be bought and is not on Check Out. if (CursorFilter.CursorIndex < CursorFilter.ListItem.Count && CursorFilter.ListItem[CursorFilter.CursorIndex].QuantityToBuy + 1 <= CursorFilter.ListItem[CursorFilter.CursorIndex].Quantity && CursorIndex != CursorIndexMax) { CursorFilter.ListItem[CursorFilter.CursorIndex].QuantityToBuy++; CheckOutAmount += CursorFilter.ListItem[CursorFilter.CursorIndex].Price; } } else if (KeyboardHelper.InputLeftPressed()) { //If the cursor points on an Item and the Item have at least 1 Quantity to buy and is not on Check Out. if (CursorFilter.CursorIndex < CursorFilter.ListItem.Count && CursorFilter.ListItem[CursorFilter.CursorIndex].QuantityToBuy - 1 >= 0 && CursorIndex != CursorIndexMax) { CursorFilter.ListItem[CursorFilter.CursorIndex].QuantityToBuy--; CheckOutAmount -= CursorFilter.ListItem[CursorFilter.CursorIndex].Price; } } else if (KeyboardHelper.InputConfirmPressed()) {//If the cursor is not on Check Out if (CursorIndex != CursorIndexMax) { //If the cursor points on a FilterItem. if (CursorFilter.CursorIndex >= CursorFilter.ListItem.Count) {//Open/Close the selected FilterItem. CursorFilter.ListFilter[CursorFilter.CursorIndex - CursorFilter.ListItem.Count].IsOpen = !CursorFilter.ListFilter[CursorFilter.CursorIndex - CursorFilter.ListItem.Count].IsOpen; //Reset the CursorIndexMax. CursorIndexMax = 0; SetCursorIndexMax(MainFilter); } } else { if (Game.Money - CheckOutAmount >= 0) { BuyItem(MainFilter); Game.Money -= CheckOutAmount; CheckOutAmount = 0; } } } else if (KeyboardHelper.KeyPressed(Microsoft.Xna.Framework.Input.Keys.Escape)) { GameScreen.RemoveScreen(this); } }
public override void Update(GameTime gameTime) { if (Stage == -1) { if (KeyboardHelper.InputUpPressed()) { if (CursorIndex > 0) { CursorIndex--; } } else if (KeyboardHelper.InputDownPressed()) { if (CursorIndex < ItemPerPage && CursorIndex + 1 + (PageCurrent - 1) * ItemPerPage < Game.ListUnit.Count) { CursorIndex++; } } else if (KeyboardHelper.InputLeftPressed()) { if (PageCurrent > 1) { PageCurrent--; } } else if (KeyboardHelper.InputRightPressed()) { if (PageCurrent * 8 < Game.ListUnit.Count) { PageCurrent++; } } else if (KeyboardHelper.InputConfirmPressed()) { Stage++; } } else if (Stage == 0) { if (KeyboardHelper.InputUpPressed()) { if (CursorIndexSub > 0) { CursorIndexSub--; } } else if (KeyboardHelper.InputDownPressed()) { if (CursorIndexSub < 6) { CursorIndexSub++; } } else if (KeyboardHelper.InputConfirmPressed()) { switch (CursorIndexSub) { case 0: //Leader stats. break; case 1: //Wing 1 stats. break; case 2: //Wing 2 stats. break; case 3: //Rename squad. break; case 4: //Leader stats. break; case 5: //Wing 1 set. break; case 6: //Wing B set. break; case 7: //Disband squad. break; } } } }
public void Update(List <ObjCollisionable> Obstacles, SoundEffect JumpEffect, SoundEffect ShootEffect) { Position += Speed; RecPerso.X = Convert.ToInt32(Position.X) - 90 / 2; RecPerso.Y = Convert.ToInt32(Position.Y) - 90 - (90 / 2); SurObject = false; SousObject = false; DroiteObject = false; GaucheObject = false; #region Obstacle if (Obstacles != null) { foreach (ObjCollisionable Objects in Obstacles) { if (RecPerso.isOnTopOf(Objects.m_DimObj)) { Speed.Y = 0; HasJump = false; Gravity = false; SurObject = true; break; } else { Gravity = true; } if (RecPerso.isOnBottomOf(Objects.m_DimObj)) { SousObject = true; Speed.Y = 0; } else if (RecPerso.isOnRightOf(Objects.m_DimObj)) { DroiteObject = true; Speed.X = 0; } if (RecPerso.isOnLeftOf(Objects.m_DimObj)) { GaucheObject = true; Speed.X = 0; } } } #endregion if (!Transformation) //bloquer les bouton lors de la transformation { #region touche W,A,S,D if (KeyboardHelper.KeyHold(Keys.W) || KeyboardHelper.KeyHold(Keys.Up) && !HasJump) { flip = SpriteEffects.None; if (KeyboardHelper.KeyPressed(Keys.C)) { ShootUp = true; } if (!OutofWindow(RecPerso, "W") && !SousObject) { if (!GravityActive) { Speed.Y = -2; Speed.X = 0; flip = SpriteEffects.None; } } else { Speed.Y = 0; } } else if (KeyboardHelper.KeyHold(Keys.A) || KeyboardHelper.KeyHold(Keys.Left)) { if (!OutofWindow(RecPerso, "A") && !DroiteObject) { Speed.X = -2; if (!HasJump && !Gravity) { Speed.Y = 0; } if (KeyboardHelper.KeyHold(Keys.LeftShift)) { Speed.X -= 2; WalkigNormal.m_FrameTime = CourseFrameTimer; } else { WalkigNormal.m_FrameTime = WalkingFrameTimer; } flip = SpriteEffects.FlipHorizontally; } else { Speed.X = 0; } } else if (KeyboardHelper.KeyHold(Keys.S) || KeyboardHelper.KeyHold(Keys.Down) && !HasJump) { if (!OutofWindow(RecPerso, "S") && !SurObject) { Speed.Y = 2; Speed.X = 0; // flip = SpriteEffects.None; } else { Speed.Y = 0; } } else if (KeyboardHelper.KeyHold(Keys.D) || KeyboardHelper.KeyHold(Keys.Right)) { if (!OutofWindow(RecPerso, "D") && !GaucheObject) { Speed.X = 2; KeyboardHelper.InputRightPressed(); if (!HasJump && !Gravity) { Speed.Y = 0; } if (KeyboardHelper.KeyHold(Keys.LeftShift)) { Speed.X += 2; WalkigNormal.m_FrameTime = CourseFrameTimer; } else { WalkigNormal.m_FrameTime = WalkingFrameTimer; } flip = SpriteEffects.None; } else { Speed.X = 0; } } else { Speed.X = 0; if (!GravityActive) { Speed.Y = 0; } Hula = false; } #endregion #region Space if (GravityActive) { if (KeyboardHelper.KeyPressed(Keys.Space) && !HasJump && !bCrouch) { Position.Y -= 10; Speed.Y = -5; if (JumpEffect != null) { JumpEffect.Play(); } HasJump = true; Gravity = true; } if (Gravity) { float i = 1; Speed.Y += 0.15f * i; } ///Pour aterrir au sol if (GravityLimit) { if (Position.Y >= 500) { HasJump = false; Gravity = false; } else { Gravity = true; } if (!Gravity) { Speed.Y = 0f; } } } #endregion #region Transformation if (KeyboardHelper.KeyPressed(Keys.T)) { Transformation = true; } #endregion #region Hula if (KeyboardHelper.KeyHold(Keys.LeftAlt)) { Hula = true; } #endregion UpdateBullets(); #region Shoot if (KeyboardHelper.KeyHold(Keys.C) && pastKey.IsKeyUp(Keys.C) && GravityActive) { ShootAnim = true; if (ShootEffect != null) { ShootEffect.Play(); } Shoot(); } pastKey = Keyboard.GetState(); #endregion } else { Speed.X = 0; Speed.Y = 0; } #region Animation Par rapport au touche bCrouch = false; #region Si Position X change if (Speed.X != 0) { if (LoxiTransformation) { if (HasJump) { AnimationPlayer.PlayAnimation(JumpForwardTransfo); } else if (Hula) { AnimationPlayer.PlayAnimation(Attack); } else { AnimationPlayer.PlayAnimation(WalkingTransfo); } } else { if (HasJump) { AnimationPlayer.PlayAnimation(JumpForwardNormal); } else if (ShootAnim) { if (ShootUp) { AnimationPlayer.PlayAnimation(ShootUpwardNormal); if (AnimationPlayer.m_FrameIndex == 8) { ShootAnim = false; ShootUp = false; } } else { AnimationPlayer.PlayAnimation(ShootNormal); if (AnimationPlayer.m_FrameIndex == 10) { ShootAnim = false; } } } else { AnimationPlayer.PlayAnimation(WalkigNormal); } } } #endregion #region Si Position X reste pareil else if (Speed.X == 0) { if (Transformation) { AnimationPlayer.PlayAnimation(TransfoNormal); if (AnimationPlayer.m_FrameIndex == 18) { Transformation = false; } LoxiTransformation = true; } else if (LoxiTransformation) { if (HasJump) { AnimationPlayer.PlayAnimation(JumpTransfo); } else if (Hula) { AnimationPlayer.PlayAnimation(Attack); } else { AnimationPlayer.PlayAnimation(NothingTransfo); } } else { if (HasJump) { AnimationPlayer.PlayAnimation(JumpNormal); } else if (ShootAnim) { if (ShootUp) { AnimationPlayer.PlayAnimation(ShootUpwardNormal); if (AnimationPlayer.m_FrameIndex == 8) { ShootAnim = false; ShootUp = false; } } else { AnimationPlayer.PlayAnimation(ShootNormal); if (AnimationPlayer.m_FrameIndex == 10) { ShootAnim = false; } } } else if (KeyboardHelper.KeyHold(Keys.Down) || KeyboardHelper.KeyHold(Keys.S)) { bCrouch = true; AnimationPlayer.PlayAnimation(Crouch); } else { AnimationPlayer.PlayAnimation(NothingNormal); } } } #endregion #endregion }
public override void Update(GameTime gameTime) { if (Stage == -1) { if (KeyboardHelper.InputUpPressed()) { if (CursorIndex > 0) { CursorIndex--; } } else if (KeyboardHelper.InputDownPressed()) { if (CursorIndex < 8 && CursorIndex + 1 + (PageCurrent - 1) * 8 < ListUnitSelection.Count) { CursorIndex++; } } else if (KeyboardHelper.InputLeftPressed()) { if (PageCurrent > 1) { PageCurrent--; } } else if (KeyboardHelper.InputRightPressed()) { if (PageCurrent * 8 < ListUnitSelection.Count) { PageCurrent++; } } else if (KeyboardHelper.InputConfirmPressed()) { //If the Unit has a pilot. if (ListUnitSelection[CursorIndex + (PageCurrent - 1) * 8].ArrayCharacterActive[0] != null) { if (ListUnitSelected.Contains(CursorIndex + (PageCurrent - 1) * 8)) { ListUnitSelected.Remove(CursorIndex + (PageCurrent - 1) * 8); } else { ListUnitSelected.Add(CursorIndex + (PageCurrent - 1) * 8); } if (ListUnitSelected.Count >= NbUnitsToSelect) { List <Player> ListPlayers = new List <Player>(); List <Unit> ListPlayerUnit = new List <Unit>(); for (int U = 0; U < ListUnitSelected.Count; U++) { ListPlayerUnit.Add(ListUnitSelection[ListUnitSelected[U]]); } ListPlayers.Add(new Player("noname", PlayerTypes.Human, ListPlayerUnit, 0)); GameScreen.PushScreen(new DeathmatchMap(ListPlayers)); GameScreen.RemoveScreen(this); } } else//Open the pop up menu. { Stage++; } } else if (KeyboardHelper.InputCancelPressed()) { GameScreen.RemoveAllScreens(); GameScreen.PushScreen(new IntermissionScreen()); } } else { if (KeyboardHelper.InputCancelPressed() || KeyboardHelper.InputConfirmPressed()) { Stage--; } } }
public override void Update(GameTime gameTime) { if (KeyboardHelper.InputUpPressed()) { if (Stage == -1) { if (CursorIndexUnitSelection > 0) { CursorIndexUnitSelection--; } } else if (Stage == 0) { if (CursorIndexSubMenu > 0) { CursorIndexSubMenu--; } } else if (Stage == 1) { if (CursorIndexPilotPosition > 0) { CursorIndexPilotPosition--; } } } else if (KeyboardHelper.InputDownPressed()) { if (Stage == -1) { if (CursorIndexUnitSelection < ItemPerPage - 1 && CursorIndexUnitSelection + 1 + (PageCurrentUnitSelection - 1) * ItemPerPage < Game.ListUnit.Count) { CursorIndexUnitSelection++; } } else if (Stage == 0) { if (CursorIndexSubMenu < SelectedUnit.MaxCharacter) { CursorIndexSubMenu++; } } else if (Stage == 1) { if (CursorIndexPilotPosition < SelectedUnit.MaxCharacter) { CursorIndexPilotPosition++; } } } else if (KeyboardHelper.InputLeftPressed()) { if (Stage == -1) { if (PageCurrentUnitSelection > 1) { PageCurrentUnitSelection--; } } else if (Stage == 1) { if (PageCurrentPilotPosition > 1) { PageCurrentPilotPosition--; } } } else if (KeyboardHelper.InputRightPressed()) { if (Stage == -1) { if (PageCurrentUnitSelection * ItemPerPage < Game.ListUnit.Count) { PageCurrentUnitSelection++; } } else if (Stage == 1) { if ((PageCurrentPilotPosition + 1) * ItemPerPage < ListCharacterInfo.Count) { PageCurrentPilotPosition++; } } } else if (KeyboardHelper.InputConfirmPressed()) { if (Stage == -1) { SelectedUnit = Game.ListUnit[CursorIndexUnitSelection + (PageCurrentUnitSelection - 1) * ItemPerPage]; CursorIndexSubMenu = 0; Stage++; } else if (Stage == 0) { CursorIndexPilotPosition = 0; PageCurrentPilotPosition = 1; Stage++; } else if (Stage == 1) { int CharacterIndex = CursorIndexPilotPosition + (PageCurrentPilotPosition - 1) * PilotPerPage; if (ListCharacterInfo[CharacterIndex].UnitIndex != -1) { Game.ListUnit[ListCharacterInfo[CharacterIndex].UnitIndex].ArrayCharacterActive[ListCharacterInfo[CharacterIndex].CharacterUnitIndex] = null; } //If the selection is not empty, add the pilot. if (CharacterIndex != 0) { SelectedUnit.ArrayCharacterActive[CursorIndexSubMenu] = Game.ListCharacter[CharacterIndex - 1]; ListCharacterInfo[CharacterIndex].UnitName = SelectedUnit.Name; ListCharacterInfo[CharacterIndex].UnitIndex = CursorIndexUnitSelection + (PageCurrentUnitSelection - 1) * ItemPerPage; ListCharacterInfo[CharacterIndex].CharacterUnitIndex = CursorIndexSubMenu; } else { SelectedUnit.ArrayCharacterActive[CursorIndexSubMenu] = null; ListCharacterInfo[CharacterIndex].UnitName = "------"; ListCharacterInfo[CharacterIndex].UnitIndex = -1; ListCharacterInfo[CharacterIndex].CharacterUnitIndex = -1; } Stage = -1; } } else if (KeyboardHelper.InputCancelPressed()) { if (Stage > -1) { Stage--; } else { GameScreen.RemoveScreen(this); } } }