private void OnCollisionEnter(Collision collision) { BallController ballController = collision.collider.GetComponent <BallController>(); bool isPlayer = ballController != null; if (isPlayer) { ballController.Die(); } }
public void Interact(GameObject other) { BallController ball = other.GetComponent <BallController>(); if (!ball) { return; } ball.Die(); }
private void OnTriggerEnter2D(Collider2D other) { if (editor) { return; } switch (type) { case Type.Death: ball.Die(); break; case Type.Checkpoint: ball.HitCheckpoint(); ball.checkpointPosition = transform.position; break; case Type.Goal: ball.HitGoal(); ball.checkpointPosition = transform.position; break; } }