public override void OnStartServer() { base.OnStartServer(); _rigidbody = GetComponent <Rigidbody>(); _minionInfo = GetComponent <minionInfo>(); //destination = GameObject.FindGameObjectWithTag("destination"); //team decider if (transform.position.x <= 0) { SetTeam(0); destinationPos = GetDestination(); } else { SetTeam(1); destinationPos = GetDestination(); } //Debug.Log(destinationPos); _navMesh = GetComponent <NavMeshAgent>(); isSetDest = false; if (_navMesh == null) { Debug.Log("Error, NavMeshAgent component doesn't exist on " + gameObject.name); } }
// Update is called once per frame void Update() { transform.rotation = Quaternion.LookRotation(-cam.transform.position); health = minion.GetComponent <minionInfo>(); healthPercentage = (float)health.currentHealth / (float)health.maxHealth; // health bar update transform.localScale = new Vector3(healthPercentage, transform.localScale.y, transform.localScale.z); if (healthPercentage <= 0.66) { gameObject.GetComponent <Renderer>().material.color = Color.yellow; } if (healthPercentage <= 0.33) { gameObject.GetComponent <Renderer>().material.color = Color.red; } }