IEnumerator WaitThenThaw(float time) { yield return(new WaitForSeconds(time)); freeze.PlayThaw(); StartCoroutine(WaitThenFreeze(RepeatWaitDuration)); }
public override IEnumerator EventImplementation() { var players = m_mainGameManager.PlayersInstances; m_playerMovementControllers = new PlayerMovement[players.Count]; for (int i = 0; i < players.Count; i++) { m_playerMovementControllers[i] = players[i].GetComponent <PlayerMovement>(); } foreach (PlayerMovement player in m_playerMovementControllers) { player.ModulateMaxMovementSpeed(m_movementModulator); player.ModulateMovementSpeed(1.0f / m_accelModulator); player.ModulateRotationSpeed(m_movementModulator); var collider = player.GetComponent <CapsuleCollider>(); collider.material = m_freezePhysicsPlayer; } var items = FindObjectsOfType <PickableObject>(); foreach (var item in items) { var colliders = item.GetComponentsInChildren <Collider>(); foreach (var c in colliders) { if (!c.isTrigger) { c.material = m_frozenItem; } } } var floor = m_floor.GetComponent <BoxCollider>(); floor.material = m_frozenFloor; m_freeze.PlayFreeze(); PlayerMovement.MovementDirectionLag = 0.965f; yield return(new WaitForSeconds(m_freezingRainDuration)); foreach (PlayerMovement player in m_playerMovementControllers) { player.ModulateMaxMovementSpeed(1.0f / m_movementModulator); player.ModulateMovementSpeed(m_accelModulator); player.ModulateRotationSpeed(1.0f / m_movementModulator); var collider = player.GetComponent <CapsuleCollider>(); collider.material = m_originalPhysicsPlayer; } foreach (var item in items) { if (item != null) { var colliders = item.GetComponentsInChildren <Collider>(); foreach (var c in colliders) { if (!c.isTrigger) { c.material = m_normalItem; } } } } floor.material = m_normalFloor; m_freeze.PlayThaw(); PlayerMovement.MovementDirectionLag = 0.0f; }