override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { ai = animator.GetComponent <Trex>(); perception = animator.GetComponent <Perception>(); shootTimer = ai.attackCooldown; aiProjectile = ai.projectile; rigidbody = ai.GetComponent <Rigidbody2D>(); spriteRenderer = ai.GetComponent <SpriteRenderer>(); aimOrigin = ai.aimOrigin; }