public override void OnEnter(EyeRok eyeRok) { //Calculate hand positions based on the player position //Left hand on top of the player leftHandDestination = eyeRok.Player.transform.position; //Right hand on a circle around the player rightHandDestination = GetLocationAroundPoint(eyeRok.Player.transform.position, 1.5f, 3.0f); //Spawn prefabs var leftHandWarning = Object.Instantiate(eyeRok.HandWarningPrefab, leftHandDestination, Quaternion.identity); var rightHandWarning = Object.Instantiate(eyeRok.HandWarningPrefab, rightHandDestination, Quaternion.identity); //Also get rid of the prefab at the end eyeRok.StartCoroutine(SmashFloor(eyeRok.LeftHand, leftHandDestination, eyeRok.LeftHandCollider, () => { leftHandFinished = true; Object.Destroy(leftHandWarning); })); eyeRok.StartCoroutine(SmashFloor(eyeRok.RightHand, rightHandDestination, eyeRok.RightHandCollider, () => { rightHandFinished = true; Object.Destroy(rightHandWarning); })); }
public override void OnEnter(EyeRok eyeRok) { /* * Hands should be near the EyeRok from the previous state. Just throw them up in the air. * How? Disable the colliders of both hands and increment the Y position LOOOOL */ eyeRok.StartCoroutine(WaitForSeconds(TimeDelayBeforeAttack)); //Disable the colliders eyeRok.LeftHandCollider.enabled = false; eyeRok.RightHandCollider.enabled = false; //And move the hands eyeRok.StartCoroutine(ThrowHands(eyeRok.LeftHand)); eyeRok.StartCoroutine(ThrowHands(eyeRok.RightHand)); }
public override EyeRokState Update(EyeRok eyeRok) { if (leftHandFinished && rightHandFinished) { eyeRok.StartCoroutine(WaitForSeconds(timeHandsInGround, () => handsCooldown = true)); if (handsCooldown) { return(new EyeRokPatrol()); } else { return(null); } } else { return(null); } }