/// <summary> /// Sets the events to be called when a player and consumable collide /// </summary> /// <param name="consumable">The consumable being collided with</param> /// <param name="speed">The speed that the player engulfs the /// consumable with</param> public void SetOnCollisionEvents(Consumable consumable, int speed = Consumable.ShrinkSpeed) { if (consumable.BlobType == BlobType.Food) { consumable.OnCollisionEvent = consumable.Shrink(speed); this.Player.OnCollisionEvent = this.ConsumeFoodEvent(consumable, speed); if (consumable.FoodValue > 0) // select different sound effect if food is positive or negative { // FindObjectOfType<AudioManager>().Play("PlayerEatPostive"); this.Audio.Play("PlayerEatPostive"); } else if (consumable.FoodValue < 0) { // FindObjectOfType<AudioManager>().Play("PlayerEatNegative"); this.Audio.Play("PlayerEatNegative"); } } else if (consumable.BlobType == BlobType.PowerUp) { consumable.OnCollisionEvent = consumable.Shrink(100 * speed); //this.Player.OnCollisionEvent = this.ConsumePowerUpEvent(consumable, 100 * speed); } }