public override void CheckRange(Player player, GameTime gameTime) { if (Game1.CurrentTime - LastSwarm > SwarmCooldown) { float distToPlayer = player.DrawBox.Center.Distance(DrawBox.Center); if (distToPlayer < ATTACK_RANGE) { AttachToPlayer(player); if (State == LeechStates.Normal) Game1.EventMan.Notify(Events.PlayerSwarmedByLeeches, this); State = LeechStates.Attack; } } }
public Leech(Vector2 position) { HostileType = (int)HostilesTypes.Leech; Position = position; State = LeechStates.Normal; DrawBox = new Rectangle(0, 0, 70, 25); HitboxSrc = new Rectangle(5, 5, 60, 16); Textures = new Texture2D[] { Sprites.GetTexture("Temp/leech"), Sprites.GetTexture("Temp/leech") }; Game1.EventMan.Register(Events.ShakeReleased, ShakeReleased); UpdateDrawbox(); }
public void ShakeReleased(object playerObj) { LastSwarm = Game1.CurrentTime; State = LeechStates.Normal; }