public IGameObject ManageBehaviour(int health) { IGameObject bullet; if(health < 50 && !Alien.IsLaserLaunched) { if (Player.GetPlayerPosition.X > 400) { bullet = new BossLaser(new Vector2(0, this.Alien.Position.Y), new Vector2(+5, 0)); this.Alien.IsLaserLaunched = true; } else { bullet = new BossLaser(new Vector2(800, this.Alien.Position.Y), new Vector2(-5, 0)); this.Alien.IsLaserLaunched = true; } } else { bullet = new AlienRocket(new Vector2(this.Alien.Position.X, this.Alien.Position.Y)); } return bullet; }
public override void Shoot() { if (this.shootDelay > 0) { this.shootDelay--; } else { int bulletX = (int)Position.X + 22; //22 because half of the texture width - bullet width var behaviour = new PurpleAlienBehaviour(this); var bullet = behaviour.ManageBehaviour(this.Health); this.Owner.AddObject(bullet); if (bullet is BossLaser) { this.bossLaser = (BossLaser)bullet; } this.shootDelay = this.ShootDelayConst; } }