private void OnTriggerExit2D(Collider2D collision) { parentRef.vActivated = false; activated = false; if (collision.gameObject.GetComponent <wireEnds>())//gameObject ref { Debug.Log("Left!"); wireRef = null; found = false; } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.GetComponentInParent <ToggleSwitch>()) { QuarterSecondSignal(); Debug.Log("Valve Signal On"); } if (collision.gameObject.GetComponent <wireEnds>()) { //Note: calling function from other scripts applies to that gameobject wireEnds tempObj = collision.gameObject.GetComponent <wireEnds>(); } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.GetComponentInParent <ToggleSwitch>())//gameObject ref { parentRef.vActivated = true; activated = true; } if (collision.gameObject.GetComponent <wireEnds>())//gameObject ref { Debug.Log("Found!"); found = true; wireRef = collision.GetComponent <wireEnds>(); } }