private IEnumerator ProcCheckGround() { bool _isPlayedSound = false; yield return(new WaitForFixedUpdate()); MyUtility.CoroutineDelay delay = new MyUtility.CoroutineDelay(0.1f); float groundOffsetY = 0; if (m_refTmRoot != null) { groundOffsetY = m_refTmRoot.position.y; } while (true) { delay.Reset(); if (m_Rigidbody.velocity.sqrMagnitude < 0.001f) { EventPullDeskDrawerHandler.AddObjectInsideDrawer(this); if (Pivot.position.y - groundOffsetY < 0.2f + ExtentsSize * 1.1f) { if (GameBoundary.IsPointInBoundary(Pivot.position)) { //m_fTargetEmissionMultiply = m_fEmissionMultiplyOnGround; SetTextureMultiply(m_fEmissionMultiplyOnGround); } else { SetTextureMultiply(0); //m_fTargetEmissionMultiply = 0f; } GameSound.Instance.Play(eSoundID_Common.ItemDrop, Pivot.position); break; } else { if (!_isPlayedSound) { _isPlayedSound = true; GameSound.Instance.Play(eSoundID_Common.ItemDrop, Pivot.position); } } } if (!delay.IsEnd) { yield return(null); } } }
private IEnumerator EnableButtonProcess() { MyUtility.CoroutineDelay delay = new MyUtility.CoroutineDelay(2.0f); while (!delay.IsEnd) { yield return(null); } buttonEmissionFader.StartFadeAnimation(); ListenInternalMessage(eInternalInteractMessage.Enable); if (GameManagers.GameArea.Instance.IsMyArea(InteractiveArea)) { GameManagers.GameSound.Instance.PlayNPC(GameManagers.eNPCSoundID_Reaper_woman_Hint._121, 0, 30); } }
private IEnumerator Proc_ToTargetValue(float _targetPullValue, float _duration, System.Action _callBack) { MyUtility.CoroutineDelay delay = new MyUtility.CoroutineDelay(_duration); delay.SetDelay(_duration); float targetPulledValue = Mathf.Clamp(_targetPullValue, autoMinPullValue, autoMaxPullValue); while (!delay.IsEnd) { float pullValue = Mathf.Lerp(m_fPulledValue, targetPulledValue, delay.NormalizedTime); TranslatePullingTarget(pullValue); yield return(null); } m_fPulledValue = targetPulledValue; _callBack?.Invoke(); }
private IEnumerator MovingTransform(Transform _parent, Vector3 _localPos, Quaternion _localRot, Vector3 _originScale, float _duration, System.Action _callBack) { MyUtility.CoroutineDelay delay = new MyUtility.CoroutineDelay(_duration); Vector3 startPos = m_tm_ObjectPivot.localPosition; Vector3 endPos = _localPos; Quaternion startRot = m_tm_ObjectPivot.localRotation; Quaternion endRot = _localRot; Vector3 startScale = m_tm_ObjectPivot.localScale; Vector3 endScale = MyUtility.GetParentScales(_parent, _originScale); delay.Reset(); while (!delay.IsEnd) { m_tm_ObjectPivot.localPosition = Vector3.Lerp(startPos, endPos, delay.NormalizedTime); m_tm_ObjectPivot.localRotation = Quaternion.Slerp(startRot, endRot, delay.NormalizedTime); m_tm_ObjectPivot.localScale = Vector3.Lerp(startScale, endScale, delay.NormalizedTime); yield return(null); } //Vector3 dir = endPos - startPos; //Vector3 xEndPos = startPos + Vector3.right * dir.x; //delay.Reset(); //while (!delay.IsEnd) //{ // m_tm_ObjectPivot.localPosition = Vector3.Lerp(startPos, xEndPos, delay.NormalizedTime); // yield return null; //} //delay.Reset(); //Vector3 yEndPos = xEndPos + Vector3.up * dir.y; //while (!delay.IsEnd) //{ // m_tm_ObjectPivot.localPosition = Vector3.Lerp(xEndPos, yEndPos, delay.NormalizedTime); // yield return null; //} //delay.Reset(); //Vector3 zEndPos = yEndPos + Vector3.forward * dir.z; //while (!delay.IsEnd) //{ // m_tm_ObjectPivot.localPosition = Vector3.Lerp(yEndPos, zEndPos, delay.NormalizedTime); // yield return null; //} yield return(null); _callBack?.Invoke(); m_ProcessingCoroutine = null; }