private void OnContact(string sensorName, Entity obj, Contact contact) { if (obj.IsAnimal() && obj.HasComponent <IAIComponent>()) { // remove AI obj.RemoveAllComponents <IAIComponent>(); obj.Body.Mass = 0; obj.AddComponent(new StayInBarnComponent(Entity.Body.Position)); if (obj is ChickenEntity) { this.Entity.GetComponent <AudioSourceComponent>().PlaySound("Audio/countDownLong"); this.Entity.Game.CurrentGameMode.AddChickenToPlayer(owner); } else { this.Entity.GetComponent <AudioSourceComponent>().PlaySound("Audio/PigHappy"); this.Entity.Game.CurrentGameMode.AddBoarToPlayer(owner); } Entity.GetComponent <TextDisplayComponent>().Text = "" + owner.TotalScore; AnimalAdded?.Invoke(owner, obj); } }