void OnTriggerStay2D(Collider2D other) { GG_moving ggController = other.GetComponent <GG_moving>(); if (ggController != null) { ggController.ChangeHealth(-1); } }
void OnTriggerEnter2D(Collider2D other) { GG_moving ggController = other.GetComponent <GG_moving>(); if (ggController != null && ggController.currentHealth < ggController.maxHealth) { ggController.ChangeHealth(1); Destroy(gameObject); } }