public override Enemy Create(BulletManager bulletManager, EnemyConfig enemy, GameData gameData, Vector2 origin) { this.bulletManager = bulletManager; MidBoss newEnemy = new MidBoss(bulletManager, gameData); //Load - sets position of enemy as well Load(newEnemy, enemy, origin); return(newEnemy); }
static void BossProjectilesCollisions() { foreach (Projectile projectile in ProjectilesManager.midbossProjectiles) { if (RoomsManager.CurrentRoom == RoomsManager.Rooms.midBoss) { if (MidBoss.PlayerHitByRect(projectile.Rectangle)) { projectile.active = false; } } } }
static void PlayerProjectilesCollisions() { foreach (Projectile projectile in ProjectilesManager.playerProjectiles) { if (RoomsManager.CurrentRoom == RoomsManager.Rooms.finalBoss) { if (FinalBoss.BossHitByRectangle(projectile.Rectangle)) { projectile.active = false; } } else if (RoomsManager.CurrentRoom == RoomsManager.Rooms.midBoss) { if (!MidBoss.Dead && MidBoss.BossHitByRect(projectile.Rectangle)) { projectile.active = false; } } else if (RoomsManager.CurrentRoom == RoomsManager.Rooms.churchAltarRoom) { foreach (Torch t in TorchManager.torches) { if (t.TorchHitByRect(projectile.Rectangle)) { projectile.active = false; } } } foreach (Enemy1 enemy in EnemyManager.enemyRoomManagers[(int)RoomsManager.CurrentRoom].enemiesType1) { if (!enemy.Dead && enemy.Enemy1HitByRect(projectile.Rectangle)) { projectile.active = false; } } foreach (Enemy2 enemy in EnemyManager.enemyRoomManagers[(int)RoomsManager.CurrentRoom].enemiesType2) { if (!enemy.Dead && enemy.Enemy2HitByRect(projectile.Rectangle)) { projectile.active = false; } } } }
private void Button_Back_Clicked(object sender, EventArgs args) { MidBoss.Reset(); FinalBoss.Reset(); _game.ChangeState(new MenuState(_game, _content)); }
public static Entity CreateEntity(Dictionary <string, object> entityProperties) { Entity entity = null; string textureName = (string)entityProperties["textureName"]; Texture2D texture = TextureFactory.GetTexture(textureName); string colorName = (string)entityProperties["color"]; Color color = System.Drawing.Color.FromName(colorName).ToXNA(); Dictionary <string, object> movementPatternProperties = null; MovementPattern movement = null; if (entityProperties.ContainsKey("movementPattern")) { movementPatternProperties = (Dictionary <string, object>)entityProperties["movementPattern"]; movement = MovementPatternFactory.CreateMovementPattern(movementPatternProperties); } string enemyType = (string)entityProperties["entityType"]; string entityClassification = (string)entityProperties["entityType"] != "player" ? "enemy" : "player"; int hp = Convert.ToInt32((float)entityProperties["hp"]); List <Attack> attacks = null; if (entityProperties["attacks"] is List <object> ) { attacks = AttackFactory.CreateAttacks((List <object>)entityProperties["attacks"]); } else if (entityProperties["attacks"] is Dictionary <string, object> ) { attacks = AttackFactory.CreateAttacks((Dictionary <string, object>)entityProperties["attacks"]); } switch (entityClassification) { case "player": entity = new Player(texture, color, movement, hp, attacks); entity.SpawnPosition = new Vector2((float)movementPatternProperties["spawnXPosition"], (float)movementPatternProperties["spawnYPosition"]); break; case "enemy": PowerUp powerUp = PowerUpFactory.CreatePowerUp((Dictionary <string, object>)entityProperties["powerUp"]); switch (enemyType) { case "simpleGrunt": entity = new SimpleGrunt(texture, color, movement, powerUp, hp, attacks); break; case "complexGrunt": entity = new ComplexGrunt(texture, color, movement, powerUp, hp, attacks); break; case "midBoss": entity = new MidBoss(texture, color, movement, powerUp, hp, attacks); break; case "finalBoss": List <Attack> phase2Attacks = null; if (entityProperties["phase2Attacks"] is List <Dictionary <string, object> > ) { phase2Attacks = AttackFactory.CreateAttacks((List <object>)entityProperties["phase2Attacks"]); } else if (entityProperties["phase2Attacks"] is Dictionary <string, object> ) { phase2Attacks = AttackFactory.CreateAttacks((Dictionary <string, object>)entityProperties["phase2Attacks"]); } entity = new FinalBoss(texture, color, movement, powerUp, hp, attacks, phase2Attacks); break; } break; default: throw new Exception("Invalid Entity"); } if (entity.Movement != null) { entity.Movement.Parent = entity; } return(entity); }