private void OnTriggerEnter(Collider collider) { if (collider.tag == "Player" && isConsumable) { PlayerControl controller = collider.GetComponent <PlayerControl>(); changeParticle.Play(); controller.consumeStar(this.state); Destroy(this.gameObject); ++GameData.Instance.consume; } if (collider.tag == "Projectile") { ProjectileControl controller = collider.GetComponent <ProjectileControl>(); if (hp > 0) { hp -= controller.getDamage(state); } } }