示例#1
0
    /// <summary>
    /// Sent when an incoming collider makes contact with this object's
    /// collider (2D physics only).
    /// </summary>
    /// <param name="other">The Collision2D data associated with this collision.</param>
    void OnCollisionEnter2D(Collision2D other)
    {
        LavaBehavior lava = other.gameObject.GetComponentInChildren <LavaBehavior>();

        if (lava != null)
        {
            touchingLava = true;
        }
    }
示例#2
0
    /// <summary>
    /// Sent when a collider on another object stops touching this
    /// object's collider (2D physics only).
    /// </summary>
    /// <param name="other">The Collision2D data associated with this collision.</param>
    void OnCollisionExit2D(Collision2D other)
    {
        LavaBehavior lava = other.gameObject.GetComponentInChildren <LavaBehavior>();

        if (lava != null)
        {
            touchingLava         = false;
            currentSinkDelayTime = sinkDelayTime;
        }
    }
示例#3
0
 // Start is called before the first frame update
 void Start()
 {
     lava = FindObjectOfType <LavaBehavior>();
 }