private void RemoveSlime(Slime slime) { Slime.numAggroed--; objectHandler.RemoveObject(slime); }
public override void OnInteract(BaseObject caller) { if (caller is Slime) { Damage(((Slime)caller).damage); } else if (caller is Walls) { bounds.X += -(int)vector.X; bounds.Y += -(int)vector.Y; } else if (caller is Doors) { Slime goblinQuestionmark = parent.SearchFirst <Slime>(); if (((Doors)caller).enterable == true) { if (((Doors)caller).direction == 2) { RoomShower.playerRoomY -= 1; bounds = new Rectangle(7 * Walls.wallSize + 13, 7 * Walls.wallSize, bounds.Width, bounds.Height); } if (((Doors)caller).direction == 3) { RoomShower.playerRoomX += 1; bounds = new Rectangle(1 * Walls.wallSize + 5, 4 * Walls.wallSize, bounds.Width, bounds.Height); } if (((Doors)caller).direction == 4) { RoomShower.playerRoomY += 1; bounds = new Rectangle(7 * Walls.wallSize + 13, 1 * Walls.wallSize + 5, bounds.Width, bounds.Height); } if (((Doors)caller).direction == 5) { RoomShower.playerRoomX -= 1; bounds = new Rectangle(13 * Walls.wallSize + 20, 4 * Walls.wallSize, bounds.Width, bounds.Height); } parent.RemoveObject <Projectile>(); parent.RemoveObject <Particle>(); parent.RemoveObject <Balloon>(); RoomShower.SpawnRoom(); } else { bounds.Location -= vector.ToPoint(); } } else if (caller is Coin) { caller.destroy = true; Game1.coinCount++; totalXP += 200; Game1.coinPickupSfx.Play(0.5f, 0, 0); } else if (caller is TrapDoor) { ((TrapDoor)caller).EnterTrapDoor(); } else if (caller is Purchasable) { if (Game1.coinCount >= ((Purchasable)caller).price && Game1.Key.IsPressed(Keys.E) && ((Purchasable)caller).cooldown.Triggered) { Game1.coinCount -= ((Purchasable)caller).price; ((Purchasable)caller).cooldown.ResetTimer(); ((Purchasable)caller).pickup.Effect(((Purchasable)caller).pickup.effID); if (((Purchasable)caller).pickup.name != "Reroller") { caller.destroy = true; } } } }
public Slime(float enemyLife, float enemyMaxLife, int enemyDamage, Rectangle enemyBounds, Point enemySpawnPoint, int enemySplitOffs, bool slimeSpawnFrozen, Room slimeRoom, Slime enemySplitSlime) { bounds = enemyBounds; life = enemyLife; maxLife = enemyMaxLife; damage = enemyDamage; texture = Game1.slimeSprites; spawnPoint = enemySpawnPoint; numSplitoffs = enemySplitOffs; splitSlime = enemySplitSlime; spawnFrozen = slimeSpawnFrozen; room = slimeRoom; floor = room.floor; }