void Start() { rcontrol = GetComponent <RocketControl>(); rhealth = GetComponent <RocketHealth>(); rb = GetComponent <Rigidbody2D>(); if (!GetComponent <PhotonView>().isMine) { gameObject.tag = "Ship"; MinimapMark.color = Color.red; } else { MinimapMark.color = Color.green; } }
// Update is called once per frame void Update () { if(rh == null) { GameObject ship = GameObject.FindGameObjectWithTag("myShip"); if(ship != null) rh = ship.GetComponent<RocketHealth>(); } else { healthBar.fillAmount = (float)rh.currentHealth/rh.MaxHealth; shieldBar.fillAmount = (float)rh.curShield/rh.MaxShield; } }
void Start() { rcontrol = GetComponent<RocketControl>(); rhealth = GetComponent<RocketHealth>(); rb = GetComponent<Rigidbody2D>(); if(!GetComponent<PhotonView>().isMine) { gameObject.tag = "Ship"; MinimapMark.color = Color.red; } else { MinimapMark.color = Color.green; } }
// Update is called once per frame void Update() { if (rh == null) { GameObject ship = GameObject.FindGameObjectWithTag("myShip"); if (ship != null) { rh = ship.GetComponent <RocketHealth>(); } } else { healthBar.fillAmount = (float)rh.currentHealth / rh.MaxHealth; shieldBar.fillAmount = (float)rh.curShield / rh.MaxShield; } }