// Start is called before the first frame update
 void Start()
 {
     sight    = GetComponentInParent <Enemy_Sight>();
     agent    = GetComponentInParent <NavMeshAgent>();
     pHealth  = GameObject.FindGameObjectWithTag("Player").GetComponent <Health>();
     animator = GetComponentInParent <Animator>();
     timer    = AttackCD;
 }
 public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     NPC    = animator.gameObject;
     player = NPC.GetComponent <EnemyAI>().GetPlayer();
     agent  = NPC.GetComponent <NavMeshAgent>();
     points = NPC.GetComponent <Patrol_Points>();
     health = NPC.GetComponent <Health>();
     rb     = NPC.GetComponent <Rigidbody>();
     sight  = NPC.GetComponentInChildren <Enemy_Sight>();
     animator.SetTrigger("Start");
     destPoint = 0;
 }
Example #3
0
 // Use this for initialization
 void Start()
 {
     rb        = gameObject.GetComponent <Rigidbody>();
     timer     = regenTimer;
     curHealth = maxHealth;
     holdHP    = curHealth;
     animator  = GetComponent <Animator>();
     if (gameObject.tag == "Enemy")
     {
         sight = GetComponentInChildren <Enemy_Sight>();
     }
 }
Example #4
0
 // Start is called before the first frame update
 void Start()
 {
     animator = GetComponent <Animator>();
     sight    = GetComponentInChildren <Enemy_Sight>();
 }