private void OnTriggerEnter(Collider other) { CameraBound bound = other.GetComponent <CameraBound>(); if (bound != null) { CameraController.Instance.EnteredCameraBound(bound); } else if (other.gameObject.CompareTag("Balloon")) { Vector3 dir = other.transform.position - _transform.position; dir.Normalize(); float dot = Vector3.Dot(dir, visual.forward); var speed = _rigidbody.velocity.magnitude; BalloonController balloon = other.GetComponent <BalloonController>(); if (balloon && dot > balloon.PopCoefficient && speed > balloon.RequiredSpeed) { balloon.Pop(); } else { _rigidbody.AddForce(dir * -PopForceBurst, ForceMode.Impulse); } } Collectible collectible = other.GetComponent <Collectible>(); if (collectible != null) { collectible.Pop(); } }
public void RemoveBalloonAfterDelay(BalloonController balloon, float delay) { WaitUntil.Seconds(delay, delegate() { if (balloon != null) { balloon.Pop(); } }); }
public void OnCollisionEnter2D(Collision2D collision) { BalloonController balloonController = collision.gameObject.GetComponent <BalloonController>(); if (balloonController != null) { balloonController.Pop(); OnDestroy(); } }