private IEnumerator updateTimerCoroutine() { GPlayerMgr playerManager = GPlayerMgr.Instance; if (m_resetTime > 0) { long lTime = (long)(m_resetTime - playerManager.CurrentServerTime); float fTime = (float)lTime; while (fTime > 0.0f) { yield return(YieldFactory.GetWaitForSeconds(1.0f)); fTime -= 1000.0f; if (TimerDisplayLabel != null) { TimerDisplayLabel.transform.parent.gameObject.SetActive(true); TimerDisplayLabel.text = HudHelper.ConvertUnixTimeToGUIString((int)fTime); } } //remove this from the list Destroy(gameObject); } yield return(null); }
private IEnumerator checkPlayerDistance() { float vDistance = 0.0f; while (m_bIsChecking) { if (m_Player == null) { m_Player = GameObject.FindObjectOfType <FirstPersonMovement>().gameObject; yield return(YieldFactory.GetWaitForSeconds(CHECK_DISTANCE_DELAY)); continue; } //Debug.Log(vDistance); vDistance = Vector3.Distance(vWorldPosition, m_Player.transform.position); if (vDistance < CLOSE_TO_DOOR_DISTANCE && GetCanOpen()) { SetOpen(true); } else { SetOpen(false); } yield return(YieldFactory.GetWaitForSeconds(CHECK_DISTANCE_DELAY)); } }
private IEnumerator delayedSelect(InputField in_field) { in_field.interactable = false; yield return(YieldFactory.GetWaitForSeconds(0.15f)); in_field.interactable = true; in_field.Select(); }
IEnumerator ChangeRotation() { while (true) { m_TargetRotation = Random.rotation; m_Reset = true; yield return(YieldFactory.GetWaitForSeconds(TIME_UNTIL_ROTATION_CHANGE)); } }
IEnumerator Shake() { while (true) { yield return(YieldFactory.GetWaitForSeconds(Random.Range(TIME_UNTIL_SHAKE.x, TIME_UNTIL_SHAKE.y))); if (RattleSound != null && RattleSound.clip != null) { CameraObject.ShakeCamera(CAMERA_SHAKE_INTENSITY, RattleSound.clip.length); } else { CameraObject.ShakeCamera(CAMERA_SHAKE_INTENSITY, 0.25f); } } }
private IEnumerator runAbility() { Rigidbody playersRigidbody = GPlayerManager.Instance.PlayerObject.Rigidbody(); while (m_bIsUnlocked) { yield return(new WaitUntil(() => Input.GetKeyDown(KeyCode.LeftShift) && playersRigidbody.IsGrounded() == false && !IsPaused)); if (m_bIsUnlocked) { playersRigidbody.AddForce(playersRigidbody.transform.forward * THRUST_JUMP_POWER + Vector3.up, ForceMode.Impulse); } yield return(YieldFactory.GetWaitForSeconds(GPlayerManager.Instance.PlayerData.UpgradedThrustJump ? UPGRADED_COOLDOWN : COOLDOWN)); } StartCoroutine(waitUntilUnlock()); }
private IEnumerator Somniplex_Enter() { yield return(YieldFactory.GetWaitForFixedUpdate()); Color colour = SomniplexLogo.color; while (colour.a <= 1.0f) { colour.a += Time.fixedDeltaTime * 0.5f; SomniplexLogo.color = colour; yield return(YieldFactory.GetWaitForFixedUpdate()); } yield return(YieldFactory.GetWaitForSeconds(1.0f)); m_StateMachine.ChangeState(eSplashStates.Complete); }
IEnumerator ReleasePositions() { bool loop = true; m_bezierTime = 0.5f; while (loop) { if (m_photonReleasedPositions.Count != 0) { for (int i = 0; i < m_photonPositions.Length - 1; i++) { m_photonPositions[i] = m_photonPositions[i + 1]; m_photonRotations[i] = m_photonRotations[i + 1]; } Vector3 velocity = (m_photonReleasedPositions[0].m_position - m_photonPositions[m_photonPositions.Length - 1]); velocity *= (((float)(1000 / PhotonNetwork.sendRate)) / m_photonReleasedPositions[0].m_time); Vector3 calculatedPosition = m_photonPositions[m_photonPositions.Length - 1] + velocity; if (!float.IsNaN(calculatedPosition.x) && !float.IsNaN(calculatedPosition.y) && !float.IsNaN(calculatedPosition.z)) { if ((m_photonPosition - calculatedPosition).magnitude > 10.0f) { m_photonPositions[m_photonPositions.Length - 1] = m_photonPosition; m_photonRotations[m_photonRotations.Length - 1] = m_photonRotation; } else { m_photonPositions[m_photonPositions.Length - 1] = calculatedPosition; m_photonRotations[m_photonRotations.Length - 1] = m_photonReleasedPositions[0].m_rotation; } } bool found = false; float properBezierTime = 0.0f; Vector3 lastBezierPoint = m_lastBezierPoint; Vector3 calculatedPosition2 = CalculateBezierPoint(properBezierTime, lastBezierPoint, m_photonPositions[1], m_photonPositions[2], m_photonPositions[3]); Vector3 currentPosition = transform.position; float lastMagnitude = 100; while (!found) { calculatedPosition2 = CalculateBezierPoint(properBezierTime, lastBezierPoint, m_photonPositions[1], m_photonPositions[2], m_photonPositions[3]); if ((currentPosition - calculatedPosition2).magnitude < lastMagnitude) { lastMagnitude = (currentPosition - calculatedPosition2).magnitude; } else if ((currentPosition - calculatedPosition2).magnitude > lastMagnitude) { found = true; break; } properBezierTime += 0.01f; if (properBezierTime > 1) { properBezierTime = 0.75f; found = true; } } m_bezierTime = properBezierTime; m_photonReleasedPositions.RemoveAt(0); } else { for (int i = 0; i < m_photonPositions.Length - 1; i++) { m_photonPositions[i] = m_photonPositions[i + 1]; m_photonRotations[i] = m_photonRotations[i + 1]; } m_photonPositions[m_photonPositions.Length - 1] = m_photonPosition; m_photonRotations[m_photonRotations.Length - 1] = m_photonRotation; bool found = false; float properBezierTime = 0.0f; Vector3 lastBezierPoint = m_lastBezierPoint; Vector3 calculatedPosition2 = CalculateBezierPoint(properBezierTime, lastBezierPoint, m_photonPositions[1], m_photonPositions[2], m_photonPositions[3]); Vector3 currentPosition = transform.position; float lastMagnitude = 100; while (!found) { calculatedPosition2 = CalculateBezierPoint(properBezierTime, lastBezierPoint, m_photonPositions[1], m_photonPositions[2], m_photonPositions[3]); if ((currentPosition - calculatedPosition2).magnitude < lastMagnitude) { lastMagnitude = (currentPosition - calculatedPosition2).magnitude; } else if ((currentPosition - calculatedPosition2).magnitude > lastMagnitude) { found = true; break; } properBezierTime += 0.01f; if (properBezierTime > 1) { properBezierTime = 0.75f; found = true; } } m_bezierTime = properBezierTime; } yield return(YieldFactory.GetWaitForSeconds(((float)(1000 / PhotonNetwork.sendRate)) / 1000)); } }