public IEnumerator PauseCamera(Competitor competitor) { yield return(new WaitForSeconds(1.8f)); if (competitor.GetComponent <RigidBodyControl>()) { Destroy(competitor.transform.GetChild(4).gameObject); } yield return(new WaitForSeconds(0.2f)); if (competitor.GetComponent <RigidBodyControl>()) { Instantiate(competitor.transform.GetComponent <LoadCamera>().camera, competitor.transform); competitor.transform.GetComponentInChildren <Cinemachine.CinemachineFreeLook>().Follow = competitor.transform; competitor.transform.GetComponentInChildren <Cinemachine.CinemachineFreeLook>().LookAt = competitor.transform; } }
private IEnumerator TurnMovementControlBackOn(Competitor competitor, float duration) { if (am != null) { am.Play("Chillout"); } yield return(new WaitForSeconds(duration)); if (competitor.GetComponent <RigidBodyControl>()) { competitor.GetComponent <Rigidbody>().freezeRotation = false; competitor.GetComponent <RigidBodyControl>().enabled = true; competitor.chillOut = false; } else { competitor.GetComponent <Rigidbody>().freezeRotation = false; competitor.GetComponent <AIStateMachine>().enabled = true; competitor.chillOut = false; } }
private IEnumerator ReverseMovementSpeed(Competitor competitor, float duration, float speedMultiplier) { calmDown = true; particles = InstantiateParticleEffect("PE_CalmDown"); if (am != null) { am.Play("CalmDown"); } yield return(new WaitForSeconds(duration)); RemoveParticleEffect(particles); if (competitor.GetComponent <RigidBodyControl>()) { competitor.GetComponent <RigidBodyControl>().speed /= speedMultiplier; } else { competitor.GetComponent <AIStateMachine>().Velocity /= speedMultiplier; } calmDown = false; }
public IEnumerator PauseRigidBodyControl(Competitor competitor, float duration) { if (competitor.GetComponent <RigidBodyControl>()) { competitor.GetComponent <RigidBodyControl>().enabled = false; } else { competitor.GetComponent <AIStateMachine>().enabled = false; } yield return(new WaitForSeconds(duration)); if (competitor.GetComponent <RigidBodyControl>()) { competitor.GetComponent <RigidBodyControl>().enabled = true; } else { competitor.GetComponent <AIStateMachine>().enabled = true; } }