private void OnCollisionEnter(Collision collision) { if (collision.gameObject == myAgent.transform.gameObject) { HideAgent agent = myAgent.GetComponent <HideAgent>(); agent.done = true; agent.reward -= 10f; agent.losses += 1; } }
private void OnTriggerEnter(Collider other) { if (other.tag == "Player") { HideAgent hideAgent = other.gameObject.GetComponent <HideAgent>(); hideAgent.done = true; hideAgent.reward += 10.0f; hideAgent.wins += 1; hideAgent.AgentReset(); } }
void Start() { this.navAgent = this.GetComponent <NavMeshAgent>(); this.chaserRigidbody = this.GetComponent <Rigidbody>(); this.hideAgent = myAgent.GetComponent <HideAgent>(); currentTarget = seekLocations[Random.Range(0, seekLocations.Length)]; navAgent.SetDestination(currentTarget.transform.position); this.targetLocationIndicator.transform.parent = null; lastKnownAgentLocation = Vector3.zero; }