class CP1AsteroidController : ZilchComponent { function Initialize(init : CogInitializer) { //Attach to enemy object. This object is destroyed on collision with bullet. Zero.Connect(this.Owner, Events.CollisionStarted, this.OnCollision); } function OnCollision(collisionEvent : CollisionEvent) { // If the object has a player controller it is treated as a player if(collisionEvent.OtherObject.CP1PlayerController != null) { // Tell the player to kill itself collisionEvent.OtherObject.CP1PlayerController.Kill(); } // If the object hit has bullet functionality if(collisionEvent.OtherObject.CP1BulletController != null) { // Destroy the bullet collisionEvent.OtherObject.Destroy(); // Destroy the asteroid this.Owner.Destroy(); } } }