void Start() { redLifeBar = GameObject.Find ("redLifeBar"); target = transform.localScale; scriptRef = GameObject.FindGameObjectWithTag ("Player").GetComponent<CheckCollisionWithAsteroids> (); maxHp = scriptRef.hitPoints; }
void Update() { if(!playerRef) try{ if(GameObject.FindGameObjectWithTag ("Player").GetComponent<CheckCollisionWithAsteroids> ()) playerRef = GameObject.FindGameObjectWithTag ("Player").GetComponent<CheckCollisionWithAsteroids> (); }catch{} }
void Start() { exist = true; player = GameObject.FindGameObjectWithTag ("Player").GetComponent<CheckCollisionWithAsteroids>(); Invoke ("DestroyByTime", lifeTime); }