public void RegisterCollisionChild(CollisionChild s) { this.collisionChildren.Add(s); s.OnAnyCollision += new CollisionChild.OnCollisionHandler(this.OnCollision); s.OnWallCollision += new CollisionChild.OnCollisionHandler(this.OnCollisionWalls); s.OnGroundCollision += new CollisionChild.OnCollisionHandler(this.OnCollisionGround); s.OnCeilingCollision += new CollisionChild.OnCollisionHandler(this.OnCollisionCeiling); s.OnPlayerCollision += new CollisionChild.OnCollisionHandler(this.OnCollisionPlayer); s.OnPlayerProjectileCollision += new CollisionChild.OnCollisionHandler(this.OnCollisionPlayerProjectile); s.OnEnemyCollision += new CollisionChild.OnCollisionHandler(this.OnCollisionEnemy); s.OnEnemyProjectileCollision += new CollisionChild.OnCollisionHandler(this.OnCollisionEnemyProjectile); s.OnOtherCollision += new CollisionChild.OnCollisionHandler(this.OnCollisionOther); }
protected void RegisterCollisionChild(GameObject go) { CollisionChild component = go.GetComponent <CollisionChild>(); if (component == null) { Debug.LogWarning("GameObject " + go.name + " does not contain a CollisionSwitch component"); } else { this.RegisterCollisionChild(component); } }
protected void UnregisterCollisionChild(CollisionChild s) { if (!this.collisionChildren.Contains(s)) { return; } s.OnAnyCollision -= new CollisionChild.OnCollisionHandler(this.OnCollision); s.OnWallCollision -= new CollisionChild.OnCollisionHandler(this.OnCollisionWalls); s.OnGroundCollision -= new CollisionChild.OnCollisionHandler(this.OnCollisionGround); s.OnCeilingCollision -= new CollisionChild.OnCollisionHandler(this.OnCollisionCeiling); s.OnPlayerCollision -= new CollisionChild.OnCollisionHandler(this.OnCollisionPlayer); s.OnPlayerProjectileCollision -= new CollisionChild.OnCollisionHandler(this.OnCollisionPlayerProjectile); s.OnEnemyCollision -= new CollisionChild.OnCollisionHandler(this.OnCollisionEnemy); s.OnEnemyProjectileCollision -= new CollisionChild.OnCollisionHandler(this.OnCollisionEnemyProjectile); s.OnOtherCollision -= new CollisionChild.OnCollisionHandler(this.OnCollisionOther); this.collisionChildren.Remove(s); }