/// <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; } }
/// <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; } }
// Start is called before the first frame update void Start() { lava = FindObjectOfType <LavaBehavior>(); }