public void UseObject() { hm.ApplyHeal(HealAmout); if (!hm.isMaximum) { if (HealSound) { AudioSource.PlayClipAtPoint(HealSound, transform.position, 1.0f); } Destroy(gameObject); } }
private void OnTriggerEnter(Collider other) { HealthManager healthManager = other.gameObject.GetComponent <HealthManager>(); if (other.gameObject.tag == "Player") { switch (chooseState) { case AddState.AddHealth: healthManager.ApplyHeal(healthValue); Destroy(gameObject); break; case AddState.AddLife: healthManager.AddBounsLife(lifeAmount); Destroy(gameObject); break; } } }