Ejemplo n.º 1
0
    void OnTriggerStay2D(Collider2D collision)
    {
        // other.attachedRigidbody.AddForce(-0.1F * other.attachedRigidbody.velocity);

        if (collision.gameObject.tag == "bubble")
        {
            gravityBubble bubble = (gravityBubble)collision.gameObject.GetComponent(typeof(gravityBubble));
            // Debug.Log("in the bubble"+bubble.gravityDirection);
            wantedRotation = bubble.gravityDirection;
        }
    }
Ejemplo n.º 2
0
    void OnTriggerExit2D(Collider2D collision)
    {
        // other.attachedRigidbody.AddForce(-0.1F * other.attachedRigidbody.velocity);

        if (collision.gameObject.tag == "bubble")
        {
            gravityBubble bubble = (gravityBubble)collision.gameObject.GetComponent(typeof(gravityBubble));
            if (0 > rb.transform.position.y)
            {
                wantedRotation = "up";
            }
            else
            {
                wantedRotation = "down";
            }
        }
    }