Ejemplo n.º 1
0
    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();
        }
    }
Ejemplo n.º 2
0
 public void RemoveBalloonAfterDelay(BalloonController balloon, float delay)
 {
     WaitUntil.Seconds(delay, delegate() {
         if (balloon != null)
         {
             balloon.Pop();
         }
     });
 }
Ejemplo n.º 3
0
    public void OnCollisionEnter2D(Collision2D collision)
    {
        BalloonController balloonController = collision.gameObject.GetComponent <BalloonController>();

        if (balloonController != null)
        {
            balloonController.Pop();

            OnDestroy();
        }
    }