private void OnTriggerExit2D(Collider2D other) { m_RoBoot = other.gameObject.GetComponentInParent <RoBoot>(); //if (m_RoBoot != null) if (other.transform.name == "Head" && m_RoBoot.m_IsMag) { if (m_RoBoot.m_Magnet) { m_RoBoot.m_Magnet = false; m_RoBoot.m_Transform.Rotate(new Vector3(0, 0, 180)); } } }
private void OnTriggerStay2D(Collider2D other) { //Debug.Log("Trigger: " + other.name); m_RoBoot = other.gameObject.GetComponentInParent <RoBoot>(); //if (m_RoBoot != null) if (other.transform.name == "Head" && m_RoBoot.m_IsMag) { if (!m_RoBoot.m_Magnet) { m_RoBoot.m_Magnet = true; m_RoBoot.m_Transform.Rotate(new Vector3(0, 0, 180)); } } }
private void Awake() { m_RoBoot = GetComponent <RoBoot>(); }