void Update() { if (agentComponent.IsDead()) { if (bannerCarrier) { banner.SetActiveRecursively(false); } return; } UpdateAction(); if (agentComponent.IsFighting() == false) { frameCnt++; UpdateAttractor(); // if (affectComponent.emotion[(int)EType.Anger] > 0.6f) // Instantiate(UnityEngine.Resources.Load("Explosion"), transform.position, new Quaternion()); foreach (GameObject c in agentComponent.collidingAgents) { if (agentComponent.IsGoodToFight(c)) { agentComponent.StartFight(c); c.GetComponent <AgentComponent>().StartFight(this.gameObject); frameCnt = 0; break; } } } }
void LateUpdate() { if (agentComponent.IsFighting() == false) { UpdateAttractor(); } else { if (currentObj != null) { currentObj.gameObject.SetActiveRecursively(false); } } //Fight with disapproved agents //Disapproved agents are the ones who achieve my desired object before me foreach (GameObject c in agentComponent.collidingAgents) { if (c.GetComponent <AgentComponent>().role == (int)RoleName.Shopper && agentComponent.IsGoodToFight(c)) { agentComponent.StartFight(c); c.GetComponent <AgentComponent>().StartFight(this.gameObject); } } UpdateAction(); }
// Update is called once per frame void Update() { if (agentComponent.IsDead()) { shield.SetActiveRecursively(false); return; } UpdateAction(); if (agentComponent.IsFighting() == false) { // if (intruder == null && (post - transform.position).magnitude > 1f) //if no one to watch && stop jittering if ((post - transform.position).magnitude > 2f) //if no one to watch && stop jittering { agentComponent.SteerTo(post); } // else // agentComponent.GetComponent<NavMeshAgent>().Stop(); Vigil(); } }