private void OnTriggerExit2D(Collider2D other) { if (other.transform.CompareTag("Player")) { mech = other.gameObject.GetComponent <MechBase>(); mech.ChangeSafety(false); } }
private void OnTriggerEnter2D(Collider2D other) { if (isActive) { if (other.transform.CompareTag("Player")) { mech = other.gameObject.GetComponent <MechBase>(); mech.ChangeSafety(true); } else if (other.transform.CompareTag("Projectile")) { Destroy(other.gameObject); } } }
public void Update() { if (isActive) { aliveTimer -= 1.0f * Time.deltaTime; if (aliveTimer <= 0) { isActive = false; } } else { transform.GetComponent <SpriteRenderer>().enabled = false; if (mech != null) { mech.ChangeSafety(false); } } }