object reference not set to an instance of an object Player.Damge (Single count) (at Assets/Player.js:31)
Player.js #pragma strict
static var levl : float = 100 ; static var image : UnityEngine.UI.Image;
function Start () {
}
function Update () {
}
static function Helth (count : float ) {
levl += Time.deltaTime; Debug.Log(levl); image.fillAmount = levl/100; if(levl >= 100 ) { levl = 100; } }
static function Damge (count : float) { levl -= Time.deltaTime; Debug.Log(levl); image.fillAmount = levl/100; if(0 >= levl) { levl = 0; } }
Box.js #pragma strict var bool : boolean; function OnTriggerStay(other : Collider) {
if (bool == true) { Player.Helth(25); }
else { Player.Damge(0); }
}
Comment