private void OnTriggerStay2D(Collider2D col) { if (col.tag == "ScraulShit") { ScraulShitBehaviour scraulShit = col.GetComponent <ScraulShitBehaviour> (); if (Input.GetKeyDown(KeyCode.J)) { scraulShit.Hit(); } } }
private void EnableShits() { Transform shits = GameObject.Find("Shits").transform; float shitsCount = shits.childCount; ScraulShitBehaviour scraulShit = null;; for (int i = 0; i < shitsCount; i++) { scraulShit = shits.GetChild(i).GetComponent <ScraulShitBehaviour> (); scraulShit.OnDestroy += this.ScraulShitDestroyed; scraulShits.Add(scraulShit); } }
private void ScraulShitDestroyed(ScraulShitBehaviour scraulShit) { scraulShit.OnDestroy -= this.ScraulShitDestroyed; this.scraulShits.Remove(scraulShit); this.OnShitDestroyed(); }