private void OnCollisionEnter2D(Collision2D collision) { EntityFunctions.Side_Collision side = EntityFunctions.DetectSideCollision(collision, gameObject); if (!is_used && side == EntityFunctions.Side_Collision.DOWN && collision.gameObject.GetComponent <PlayerController>() != null && !open_order) { open_order = true; if (contain == Contains.Mushroom_or_Flower) { if (collision.gameObject.GetComponent <PlayerController>().Mario_State == PlayerController.Mario_States.Small) { content = Instantiate(content_Prototype, gameObject.transform.position, new Quaternion()); contain = Contains.Mushroom; return; } else { content = Instantiate(content_Prototype_2, gameObject.transform.position, new Quaternion()); contain = Contains.Flower; return; } } content = Instantiate(content_Prototype, gameObject.transform.position, new Quaternion()); } }
private void OnCollisionExit2D(Collision2D collision) { EntityFunctions.Side_Collision side = EntityFunctions.DetectSideCollision(collision, gameObject); if (side == EntityFunctions.Side_Collision.DOWN) { is_Grounded = false; return; } }
private void OnCollisionEnter2D(Collision2D collision) { EntityFunctions.Side_Collision side = EntityFunctions.DetectSideCollision(collision, gameObject); if (side == EntityFunctions.Side_Collision.DOWN && collision.gameObject.GetComponent <PlayerController>() != null) { CollisionPlayer_Order = true; if (collision.gameObject.GetComponent <PlayerController>().Mario_State == PlayerController.Mario_States.Small) { destroyObject = false; } else { destroyObject = true; } } }
private void OnCollisionEnter2D(Collision2D collision) { EntityFunctions.Side_Collision side = EntityFunctions.DetectSideCollision(collision, gameObject); bool collision_withPlayer = collision.gameObject.GetComponent <PlayerController>() != null ? true : false; if (collision_withPlayer && time_live >= 1) { collision.gameObject.GetComponent <PlayerController>().PowerUp(PlayerController.PowerUpType.Mushroom); Destroy(gameObject); levelController.GetComponent <SceneController>().PauseTemp(1f); } else if ((side == EntityFunctions.Side_Collision.LEFT || side == EntityFunctions.Side_Collision.RIGHT) && !collision.gameObject.CompareTag("Floor") && !collision_withPlayer) { velocity *= -1; } }
private void OnCollisionEnter2D(Collision2D collision) { bool collision_withPlayer = collision.gameObject.GetComponent <PlayerController>() != null ? true : false; EntityFunctions.Side_Collision side = EntityFunctions.DetectSideCollision(collision, gameObject); if (side == EntityFunctions.Side_Collision.UP && collision_withPlayer || (collision_withPlayer && collision.gameObject.GetComponent <PlayerController>().Have_Star())) { //Dead collision.gameObject.GetComponent <Rigidbody2D>().AddForce(new Vector2(0f, 2f)); deadOrder = true; } else if ((side == EntityFunctions.Side_Collision.LEFT || side == EntityFunctions.Side_Collision.RIGHT) && !collision.gameObject.CompareTag("Floor") && !collision_withPlayer) { velocity *= -1; } }
private void OnCollisionEnter2D(Collision2D collision) { EntityFunctions.Side_Collision side = EntityFunctions.DetectSideCollision(collision, gameObject); if (collision.gameObject.CompareTag("Floor")) { is_Grounded = true; return; } else if (side == EntityFunctions.Side_Collision.DOWN) { is_Grounded = true; } bool is_enemy = collision.gameObject.CompareTag("Enemy") ? true : false; if (is_enemy) { // Kill enemies if (side == EntityFunctions.Side_Collision.DOWN) { } // Oops else { Damage(); } } //--- }