コード例 #1
0
ファイル: HealthCube.cs プロジェクト: BeenyL/Project01
 private void OnTriggerStay(Collider other)
 {
     if (other.gameObject.tag == "Player")
     {
         playerproperty = other.gameObject.GetComponent <PlayerProperty>();
         if (playerproperty != null && playerproperty._CurrentHealth < playerproperty.MaxHealth)
         {
             audio.Play();
             playerproperty.Heal(5);
             playerhud.updateHealthSlider();
             meshrender.enabled   = false;
             meshcollider.enabled = false;
             particle.Stop();
             light.enabled = false;
             Debug.Log(playerproperty._CurrentHealth);
         }
         else
         {
             return;
         }
     }
 }