private void Start() { //animator = GetComponent<Animator>(); properties = GetComponent <ZombieProperties>(); navMeshAgent = this.GetComponent <NavMeshAgent>(); if (navMeshAgent == null) { Debug.LogError("The nav mesh agent component is not attached to " + gameObject.name); } navMeshAgent.updateRotation = false; //Evita que el zombie rote. }
private void OnTriggerEnter(Collider hitInfo) { if (!hitInfo.gameObject.CompareTag("Bullet")) { ZombieProperties zombie = hitInfo.GetComponent <ZombieProperties>(); Score score = GameObject.Find("Puntuacion").GetComponent <Score>(); if (zombie != null) { zombie.TakeDamage(damage); score.HitScore(pointHit); } Destroy(gameObject); } }