public Ariel(Vector2 scroll, String[] flags) : base(scroll) { //Source sprite this.sRect = new Rectangle(0, 0, 512, 600); this.Scale = new Vector2(0.75f, 0.75f); this.scrollValue -= new Vector2(50, 0); this.location = new Vector2(this.dRect.X - this.dRect.Width, TGPAContext.Instance.ScreenHeight); this.ttl = InfiniteTimeToLive; //Stats this.wpn = null; this.hp = 5001; this.maxLifebarValue = hp; this.speed = Vector2.Zero; this.points = 169000; this.attackState = ArialAttacks.None; this.attackCooldown = 2500f; this.state = ArielState.Normal; this.flagsOnDeath = flags; this.Flip = SpriteEffects.FlipHorizontally; this.InfiniteMovePattern = true; this.hitbox = new EmptyHitbox(this); this.DrawLifebar = true; this.DrawWarning = true; }
public override void Update(GameTime gameTime) { bool attack = true; //Decrease cooldowns if (this.faceCooldown > 0f) { this.faceCooldown -= gameTime.ElapsedGameTime.TotalMilliseconds; } if (this.attackCooldown > 0f) { this.attackCooldown -= gameTime.ElapsedGameTime.TotalMilliseconds; attack = false; } //Change state is necessary if ((this.faceCooldown < 0f) && (this.state != ArielState.Normal)) { this.state = ArielState.Normal; } //Boss is hit : change face if (IsHit) { this.state = ArielState.Hit; this.faceCooldown = 500f; } //Find attack if (attack) { if (this.attackState == ArialAttacks.None) { this.hitbox = new SquareHitbox(this, new Vector2(0.5f, 0)); } this.state = ArielState.Attack; this.faceCooldown = 2000f; this.speed = new Vector2(-150f, 50f); this.wpn = null; int rand = RandomMachine.GetRandomInt(0, 6); if ((this.movePattern == null) || (this.movePattern.Points.Count != 5)) { this.movePattern = new MovePattern(); this.movePattern.AddPoint(new Point(TGPAContext.Instance.TitleSafeArea.Left + 50, TGPAContext.Instance.ScreenHeight / 2)); this.movePattern.AddPoint(new Point(TGPAContext.Instance.TitleSafeArea.Left + 50 + (dRect.Width / 2), TGPAContext.Instance.ScreenHeight / 4)); this.movePattern.AddPoint(new Point(TGPAContext.Instance.TitleSafeArea.Left + 50 + dRect.Width, TGPAContext.Instance.ScreenHeight / 2)); this.movePattern.AddPoint(new Point(TGPAContext.Instance.TitleSafeArea.Left + 50 + (dRect.Width / 2), (3 * TGPAContext.Instance.ScreenHeight) / 4)); this.movePattern.AddPoint(new Point(TGPAContext.Instance.TitleSafeArea.Left + 50, TGPAContext.Instance.ScreenHeight / 2)); } if ((rand == 0) && (this.attackState != ArialAttacks.Charge)) { this.attackState = ArialAttacks.Charge; this.movePattern = new MovePattern(); int randY = RandomMachine.GetRandomInt(1, 4); this.movePattern.AddPoint(new Point((7 * TGPAContext.Instance.ScreenWidth / 8), (randY * TGPAContext.Instance.ScreenHeight / 8))); this.movePattern.AddPoint(new Point((1 * TGPAContext.Instance.ScreenWidth / 8), (randY * TGPAContext.Instance.ScreenHeight / 8))); this.attackCooldown = 3500f; this.speed = new Vector2(-500f, 275f); } else if ((rand == 2) && (this.attackState != ArialAttacks.StarfishLine)) { this.attackState = ArialAttacks.StarfishLine; this.attackCooldown = 10000f; this.wpn = new ArielStarFishLineLauncher(); this.movePattern = new MovePattern(); this.movePattern.AddPoint(new Point(TGPAContext.Instance.ScreenWidth /2 - (dRect.Width/8), TGPAContext.Instance.ScreenHeight / 2)); this.movePattern.AddPoint(new Point(TGPAContext.Instance.ScreenWidth / 2 - (dRect.Width / 2), TGPAContext.Instance.ScreenHeight / 2)); } else if ((rand == 3) && (this.attackState != ArialAttacks.StarfishRandom)) { this.attackState = ArialAttacks.StarfishRandom; this.attackCooldown = 5000f; this.wpn = new ArielStarFishRandomLauncher(); } else { this.attackState = ArialAttacks.Fishes; this.attackCooldown = 2000f; this.wpn = new ArielFishGun(); } #if DEBUG #if WINDOWS Trace.WriteLine("TGPA DEBUG : Ariel Attack : " + this.attackState.ToString()); #endif #endif } //Facial animation switch (this.state) { case ArielState.Normal: sRect.X = 0; break; case ArielState.Attack: sRect.X = 512; break; case ArielState.Hit: sRect.X = 1024; break; } base.Update(gameTime); }
public override void Update(GameTime gameTime) { bool attack = true; //Decrease cooldowns if (this.faceCooldown > 0f) { this.faceCooldown -= gameTime.ElapsedGameTime.TotalMilliseconds; } if (this.attackCooldown > 0f) { this.attackCooldown -= gameTime.ElapsedGameTime.TotalMilliseconds; attack = false; } //Change state is necessary if ((this.faceCooldown < 0f) && (this.state != ArielState.Normal)) { this.state = ArielState.Normal; } //Boss is hit : change face if (IsHit) { this.state = ArielState.Hit; this.faceCooldown = 500f; } //Find attack if (attack) { if (this.attackState == ArialAttacks.None) { this.hitbox = new SquareHitbox(this, new Vector2(0.5f, 0)); } this.state = ArielState.Attack; this.faceCooldown = 2000f; this.speed = new Vector2(-150f, 50f); this.wpn = null; int rand = RandomMachine.GetRandomInt(0, 6); if ((this.movePattern == null) || (this.movePattern.Points.Count != 5)) { this.movePattern = new MovePattern(); this.movePattern.AddPoint(new Point(TGPAContext.Instance.TitleSafeArea.Left + 50, TGPAContext.Instance.ScreenHeight / 2)); this.movePattern.AddPoint(new Point(TGPAContext.Instance.TitleSafeArea.Left + 50 + (dRect.Width / 2), TGPAContext.Instance.ScreenHeight / 4)); this.movePattern.AddPoint(new Point(TGPAContext.Instance.TitleSafeArea.Left + 50 + dRect.Width, TGPAContext.Instance.ScreenHeight / 2)); this.movePattern.AddPoint(new Point(TGPAContext.Instance.TitleSafeArea.Left + 50 + (dRect.Width / 2), (3 * TGPAContext.Instance.ScreenHeight) / 4)); this.movePattern.AddPoint(new Point(TGPAContext.Instance.TitleSafeArea.Left + 50, TGPAContext.Instance.ScreenHeight / 2)); } if ((rand == 0) && (this.attackState != ArialAttacks.Charge)) { this.attackState = ArialAttacks.Charge; this.movePattern = new MovePattern(); int randY = RandomMachine.GetRandomInt(1, 4); this.movePattern.AddPoint(new Point((7 * TGPAContext.Instance.ScreenWidth / 8), (randY * TGPAContext.Instance.ScreenHeight / 8))); this.movePattern.AddPoint(new Point((1 * TGPAContext.Instance.ScreenWidth / 8), (randY * TGPAContext.Instance.ScreenHeight / 8))); this.attackCooldown = 3500f; this.speed = new Vector2(-500f, 275f); } else if ((rand == 2) && (this.attackState != ArialAttacks.StarfishLine)) { this.attackState = ArialAttacks.StarfishLine; this.attackCooldown = 10000f; this.wpn = new ArielStarFishLineLauncher(); this.movePattern = new MovePattern(); this.movePattern.AddPoint(new Point(TGPAContext.Instance.ScreenWidth / 2 - (dRect.Width / 8), TGPAContext.Instance.ScreenHeight / 2)); this.movePattern.AddPoint(new Point(TGPAContext.Instance.ScreenWidth / 2 - (dRect.Width / 2), TGPAContext.Instance.ScreenHeight / 2)); } else if ((rand == 3) && (this.attackState != ArialAttacks.StarfishRandom)) { this.attackState = ArialAttacks.StarfishRandom; this.attackCooldown = 5000f; this.wpn = new ArielStarFishRandomLauncher(); } else { this.attackState = ArialAttacks.Fishes; this.attackCooldown = 2000f; this.wpn = new ArielFishGun(); } #if DEBUG #if WINDOWS Trace.WriteLine("TGPA DEBUG : Ariel Attack : " + this.attackState.ToString()); #endif #endif } //Facial animation switch (this.state) { case ArielState.Normal: sRect.X = 0; break; case ArielState.Attack: sRect.X = 512; break; case ArielState.Hit: sRect.X = 1024; break; } base.Update(gameTime); }