private void OnParticleCollision(GameObject other) { ICollisionHandler i = CollisionHandler as ICollisionHandler; if (i != null) { #if UNITY_4 int numCollisionEvents = _particleSystem.GetCollisionEvents(other, collisionEvents); if (numCollisionEvents != 0) { i.HandleCollision(other, collisionEvents, numCollisionEvents); } #elif UNITY_5_3_OR_NEWER int numCollisionEvents = _particleSystem.GetCollisionEvents(other, collisionEvents); if (numCollisionEvents != 0) { i.HandleCollision(other, collisionEvents, numCollisionEvents); } #else int numCollisionEvents = _particleSystem.GetCollisionEvents(other, collisionEvents); if (numCollisionEvents != 0) { i.HandleCollision(other, new List <ParticleCollisionEvent>(collisionEvents), numCollisionEvents); } #endif } }
private static void HandleItemCollisions(ICollisionHandler collisionHandler, Collection <IGameObject> blockList, Collection <IGameObject> itemList, Collection <IGameObject> pipeList) { for (int i = 0; i < itemList.Count; i++) { foreach (IGameObject obj in blockList) { collisionHandler.HandleCollision(itemList[i], obj); } foreach (IGameObject obj in pipeList) { collisionHandler.HandleCollision(itemList[i], obj); } } }
public virtual void Collided(ICollidable i_Collidable) { if (this is ICollidable && m_CollisionHandler != null) { m_CollisionHandler.HandleCollision(this as ICollidable, i_Collidable); } }
public void OnCollisionEnter(Collision col) { CollisionHandler.HandleCollision(gameObject, col); //DestroyObject(this.transform.parent.gameObject); Object.Destroy(this.transform.parent.gameObject); Debug.Log("collision"); }
public void OnCollisionEnter(Collision col) { if (CollisionHandler != null) { CollisionHandler.HandleCollision(gameObject, col); } }
public void OnCollisionEnter(Collision col) { if (!col.gameObject.CompareTag("Shield")) { CollisionHandler.HandleCollision(gameObject, col); } }
void OnTriggerEnter2D(Collider2D collision) { if (collision.CompareTag(Tags.Ball) && canCollide) { collisionHandler.HandleCollision(collision.gameObject, this); } }
public void OnTriggerEnter2D(Collider2D col) { if (col.tag == "Wall" || col.tag == "Player") { CollisionHandler.HandleCollision(gameObject, col); } }
private static void HandleEnemyCollisions(ICollisionHandler collisionHandler, Collection <IGameObject> blockList, Collection <IGameObject> enemyList, Collection <IGameObject> pipeList) { for (int i = 0; i < enemyList.Count; i++) { foreach (IGameObject obj in blockList) { collisionHandler.HandleCollision(enemyList[i], obj); } for (int j = i + 1; j < enemyList.Count; j++) { collisionHandler.HandleCollision(enemyList[i], enemyList[j]); } foreach (IGameObject obj in pipeList) { collisionHandler.HandleCollision(enemyList[i], obj); } } }
private static void HandleMarioCollisions(ICollisionHandler collisionHandler, IMario mario, Collection <IGameObject> blockList, Collection <IGameObject> enemyList, Collection <IGameObject> itemList, Collection <IGameObject> pipeList) { foreach (IGameObject obj in blockList) { collisionHandler.DetectMarioBlockCollisions(mario, obj); } collisionHandler.HandleMarioBlockCollisions(); foreach (IGameObject obj in enemyList) { collisionHandler.HandleCollision(mario, obj); } foreach (IGameObject obj in itemList) { collisionHandler.HandleCollision(mario, obj); } foreach (IGameObject obj in pipeList) { collisionHandler.HandleCollision(mario, obj); } }
private void OnParticleCollision(GameObject other) { ICollisionHandler i = CollisionHandler as ICollisionHandler; if (i != null) { #if UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_4_9 int numCollisionEvents = _particleSystem.GetCollisionEvents(other, collisionEvents); if (numCollisionEvents != 0) { i.HandleCollision(other, collisionEvents, numCollisionEvents); } #else int numCollisionEvents = _particleSystem.GetCollisionEvents(other, collisionEvents); if (numCollisionEvents != 0) { i.HandleCollision(other, collisionEvents, numCollisionEvents); } #endif } }
private static void HandleFireBallCollisions(ICollisionHandler collisionHandler, Collection <IGameObject> blockList, Collection <IGameObject> enemyList, Collection <IGameObject> pipeList, IMario mario, Collection <IGameObject> fireBallList) { for (int i = 0; i < fireBallList.Count; i++) { foreach (IGameObject obj in blockList) { collisionHandler.HandleCollision(fireBallList[i], obj); } foreach (IGameObject obj in pipeList) { collisionHandler.HandleCollision(fireBallList[i], obj); } foreach (IGameObject obj in enemyList) { collisionHandler.HandleCollision(fireBallList[i], obj); } if (GameUtilities.Game.State.Type == GameStates.Competitive && GameUtilities.GameObjectManager.MarioPlayer2 != null) { collisionHandler.HandleCollision(fireBallList[i], mario); } } }
public void HandleCollision(Collision collision, Level1 level) { ICollisionHandler handler = handlers[collision.entity1.GetType()]; if (handler != null) { handler.HandleCollision(collision, level); } ICollisionHandler secondHandler = handlers[collision.entity2.GetType()]; if (secondHandler != null) { secondHandler.HandleCollision(collision, level); } }
public void OnCollisionEnter(Collision col) { // Damaging the player if (col.gameObject.CompareTag("Player") && gameObject.transform.parent.CompareTag("EnemyProjectile")) { Firebolt firebolt = gameObject.transform.parent.GetComponent <Firebolt>(); col.gameObject.GetComponent <Player>().ChangeHealthBy(-firebolt.damage); } // Damaging the enemy else if (col.gameObject.CompareTag("Enemy") && gameObject.transform.parent.CompareTag("PlayerProjectile")) { Firebolt firebolt = gameObject.transform.parent.GetComponent <Firebolt>(); col.gameObject.GetComponent <Player>().ChangeHealthBy(-firebolt.damage); } CollisionHandler.HandleCollision(gameObject, col); }
public void ProcessCollisions(IList <ICollidable> firstEntities, IList <ICollidable> secondEntities, ICollisionHandler collisionHandler) { collisionTypesDetected.Clear(); ICollision collision = null; foreach (ICollidable firstEntity in firstEntities) { collisionTypesDetected.Clear(); foreach (ICollidable secondEntity in secondEntities) { if (firstEntity.Hitbox.Intersects(secondEntity.Hitbox) && !firstEntity.Equals(secondEntity)) { collision = new CollisionObject(firstEntity, secondEntity); if (!collisionTypesDetected.Contains(collision.FirstEntityRelativePosition.ToString())) { collisionHandler.HandleCollision(collision); collisionTypesDetected.Add(collision.FirstEntityRelativePosition.ToString()); } } } } }
public void OnTriggerEnter(Collider otherCollider) { _handler.HandleCollision(CollisionType.ItemCollector, otherCollider); }
public void OnCollisionEnter(Collision col) { CollisionHandler?.HandleCollision(gameObject, col); }
public void OnCollisionEnter(Collision col) { Debug.Log("" + gameObject + col.collider.name + "\nSpeed: " + col.relativeVelocity); CollisionHandler.HandleCollision(gameObject, col); }
private static void HandleMarioMarioCollisions(ICollisionHandler collisionHandler, IMario mario1, IMario mario2) { collisionHandler.HandleCollision(mario1, mario2); }
public void OnCollisionEnter(Collision col) { //CollisionHandler.HandleCollision(gameObject, col); CollisionHandler.HandleCollision(this.gameObject, col); }