public void ExitTrigger() { numberOfPlayers--; if (numberOfPlayers <= 0) { foreach (GameObject damaging in damagingInstantiators) { DamagingInstantiator dInstantiator = damaging.GetComponent <DamagingInstantiator>(); dInstantiator.needed = false; } } }
public void EnterTrigger() { numberOfPlayers++; if (numberOfPlayers == 1) { foreach (GameObject damaging in damagingInstantiators) { DamagingInstantiator dInstantiator = damaging.GetComponent <DamagingInstantiator>(); dInstantiator.needed = true; StartCoroutine(dInstantiator.InstantiateDamaging()); } } }
private void OnTriggerEnter2D(Collider2D otherCollider) { if (otherCollider.GetComponent <DamagingArrow>()) { touched++; if (touched == hitsBeforDeactivating) { for (int i = 0; i < deactivableDamagings.Length; i++) { DamagingInstantiator dArrow = deactivableDamagings[i].GetComponent <DamagingInstantiator>(); dArrow.needed = false; } } } }