public void Update(ContentManager Content, GameTime gameTime) { if (StaticBooleans.IsShopOpen) { shopScreen.Update(); } else if (FightAuth.HasStartedFight()) { fightScreen.Update(gameTime, Content); } else { foreach (CharacterBlock cb in characters) { if (StaticBooleans.NeedInitializing) { cb.Initialize(); cb.LoadContent(Content); } } StaticBooleans.SetNeedInitializingBool(false); foreach (CharacterBlock cb in characters) { cb.Update(); } foreach (Button button in buttons) { button.Update(); } } }
private void StartFight(Character character, Models.Game game) { var currentFight = CreateCurrentFight(character, game); FightAuth.SetCurrentFight(currentFight); StaticBooleans.SetHasFightBeenInitializedBool(false); }
public void Update() { prevKeyState = keyState; keyState = Keyboard.GetState(); if (keyState.IsKeyDown(Keys.Escape) && prevKeyState.IsKeyUp(Keys.Escape)) { StaticBooleans.SetHasNewGame(true); StaticBooleans.SetNeedInitializingBool(true); FightAuth.EndFight(); } }
public void Draw(SpriteBatch spriteBatch, ContentManager Content) { if (StaticBooleans.IsShopOpen) { shopScreen.Draw(spriteBatch); } else if (FightAuth.HasStartedFight()) { if (!StaticBooleans.HasFightBeenInitialized) { fightScreen.Initialize(); fightScreen.LoadContent(Content); StaticBooleans.SetHasFightBeenInitializedBool(true); } fightScreen.Draw(spriteBatch); } else { LoadGameMenu(spriteBatch); } }
public void Initialize() { fight = FightAuth.GetCurrentFight(); character = new Character(); character = GetCharacterFromFight(fight); map.Initialize(); fighter = new Fighter(character); fighter.Initialize(); enemy = new Enemy(); enemy.Initialize(); drawNames = new DrawNames(fighter.Character, enemy.Character); drawNames.Initialize(); itemsInBag = new List <Item>(); itemsInBag = GetGameItems(GameAuth.GetCurrentGame()); gameItems = new List <GameItem>(); int offset = 0; foreach (Item i in itemsInBag) { gameItems.Add(new GameItem(i, new Vector2(210 + offset, screenHeight - 80))); offset += 110; } foreach (GameItem gi in gameItems) { gi.Initialize(); } control = new Control(fight, fighter, enemy, gameItems); control.Initialize(); InitializeBars(); attacks = new List <Components.Attack>(); basicAttack = new Components.Attack("Basic", new Vector2(340, 90), fighter.Character, fighter.BasicAttack, control); specialAttack = new Components.Attack("Special", new Vector2(410, 90), fighter.Character, fighter.SpecialAttack, control); attacks.Add(basicAttack); attacks.Add(specialAttack); //test playerHealth = control.PlayerHealth.ToString(); playerHealthPos = new Vector2(20, 25); playerMana = control.PlayerMana.ToString(); playerManaPos = new Vector2(20, 55); playerAtk = control.PlayerAtk.ToString(); playerAtkPos = new Vector2(20, 140); playerSpAtk = control.PlayerSpAtk.ToString(); playerSpAtkPos = new Vector2(20, 160); enemyHealth = control.EnemyHealth.ToString(); enemyHealthPos = new Vector2(420, 25); enemyMana = control.EnemyMana.ToString(); enemyManaPos = new Vector2(420, 55); enemyAtk = control.EnemyAtk.ToString(); enemyAtkPos = new Vector2(700, 140); enemySpAtk = control.EnemySpAtk.ToString(); enemySpAtkPos = new Vector2(700, 160); //test numberOne = "1"; numberTwo = "2"; numberThree = "3"; numberFour = "4"; positionOne = new Vector2(230, screenHeight - 30); positionTwo = new Vector2(340, screenHeight - 30); positionThree = new Vector2(450, screenHeight - 30); positionFour = new Vector2(560, screenHeight - 30); }