public override void Update(GameTime gameTime) { if (selected != -1 && Armies.army[selected].IsDead) { selected = -1; } if (!IsTurn) { buttons[0].enabled = false; } else { buttons[0].enabled = true; } // UPDATE ANIMTION if (moveArrows != null) { for (int i = 0; i < moveArrows.Count; i++) { moveArrows[i].Update(gameTime); } } if (attackIcons != null) { for (int i = 0; i < attackIcons.Count; i++) { attackIcons[i].Update(gameTime); } } if (selected >= 0 && canAttackThis != null && canAttack[selected]) { for (int i = 0; i < canAttackThis.Count; i++) { Character c = Armies.opponentArmy[canAttackThis[i]]; c.UpdateSpriteSheetAnimation(gameTime); if (c.sprite.CurrentFrame == 1) { c.sprite.CurrentFrame = 2; } } } // END UPDATE ANIMATION // UNFINISHED WIN/LOSE DEFINITION/EFFECT if (Armies.army[0].IsDead || Armies.opponentArmy[0].IsDead) { StateManager.ChangeState(Settings.STATES.Result); } // END UNFINISHED WIN/LOSE DEFINITION/EFFECT // CONNECTION LOST if (Globals.multiplayerConnection.ConnectionLost) { StateManager.ChangeState(Settings.STATES.Result); } // END CONNECTION LOST if (IsTurn && !Globals.multiplayerConnection.IsWaitingForResponse) { CheckIfCanAttack(); if (selected != -1) { if (Globals.mouseState.LeftButtonPressed && Main.WindowRectangle.Contains(Globals.mouseState.Position)) { bool contains = false; contains = TestForMove(gameTime); if (!contains) { contains = TestForAttack(gameTime); } if (!contains) { canMoveTo = null; } moveArrows = null; attackIcons = null; } } if (Globals.mouseState.LeftButtonPressed && Main.WindowRectangle.Contains(Globals.mouseState.Position)) { SelectUnit(gameTime); } } if (StateManager.GetState(1) is GameState) { ((GameState)StateManager.GetState(1)).Update(gameTime); } Globals.multiplayerConnection.Update(gameTime); statsUI.UpdateAnimation(gameTime); if (selected > -1 && !canAttack[selected]) { canAttackThis = null; } }
public void ReceivedFight(int charIndexAttacker, int charIndexDefender) { statsUI.RemoveCharacter(); ((GameState)StateManager.GetState(1)).AttackUnit(Armies.opponentArmy[charIndexAttacker], Armies.opponentArmy[charIndexAttacker].special != Character.Special.Healer ? Armies.army[charIndexDefender] : Armies.opponentArmy[charIndexDefender]); }
private void ReceivedMove(int charIndex, Point gridLocation) { ((GameState)StateManager.GetState(1)).MoveUnit(Armies.opponentArmy[charIndex], gridLocation); }
public List <Character> GetEnemyArmy() { return(((GameState)StateManager.GetState(1)).GetEnemyArmy()); }
private List <Character> GetArmy() { return(((GameState)StateManager.GetState(1)).GetArmy()); }
private void StartGame() { StateManager.ChangeState(Settings.STATES.Game); }