void OnTriggerEnter2D(Collider2D col) { GameObject go = GameObject.Find("Sword"); SwordSwinger sword = go.GetComponent <SwordSwinger>(); if (col.gameObject.tag == "Sword" && !sword.canSwing) { health -= 1; } }
void Start() { m_Animator = gameObject.GetComponent <Animator>(); m_guid = gameObject.GetComponent <Guid>(); m_swordSwinger = gameObject.transform.FindChild("SwordSwinger").GetComponent <SwordSwinger>(); }