void OnEnable() { currentAnimation = animIdle; forward = new Vector3(cameraTransform.forward.x, 0f, cameraTransform.forward.z).normalized; right = new Vector3(cameraTransform.right.x, 0f, cameraTransform.right.z).normalized; rb = GetComponent <Rigidbody>(); xform = GetComponent <Transform>(); source = GetComponent <AudioSource>(); joeHockey = GameObject.FindGameObjectsWithTag("ShowTheJoe"); avocados = FindObjectsOfType <AvocadoController>(); }
IEnumerator SwingAnimation() { for (int i = 0; i < animSwing.Length; i++) { yield return(new WaitForSeconds(0.05f)); currentAnimation = animSwing[i]; } yield return(new WaitForSeconds(0.05f)); currentAnimation = animIdle; isSwinging = false; yield return(null); }