// Update is called once per frame void Update() { //Grounded check raycast //Debug.Log(navMeshAgent.isOnOffMeshLink); AttackCooldowns(); grounded = !navMeshAgent.isOnOffMeshLink; nearGround = isGrounded(); currentState.UpdateState(); if (navMeshAgent.enabled && target != null) { npcNav.SetDestination(target); } if (GetComponent <Rigidbody>() && currentState != stunned && grounded && !lunging && nearGround) { Destroy(GetComponent <Rigidbody>()); } if (rocketPackBufferFrames == 0) { transform.GetChild(0).GetComponent <MeshRenderer>().material.SetFloat("_Is_targeted", 0); } if (rocketPackBufferFrames >= 0) { rocketPackBufferFrames--; } Sounds(); }