protected override void OnDestroy() { base.OnDestroy(); InteractObjectCollection <InteractiveItem> .Instance.RemoveItem(this); m_refHintBasic.Release(); GameState.onChangeGameState -= GameState_onChangeGameState; EventPullDeskDrawerHandler.RemoveObjectInsideDrawer(this); }
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); } } }
protected override void OnGrab() { EventPullDeskDrawerHandler.RemoveObjectInsideDrawer(this); StopCheckGround(); PlayGrabVoice(); if (MyNetworkManager.IsMyID(m_GrabData.GrabberID)) { SetTextureMultiply(m_fEmissionMultiplyWhenGrab); } else { SetTextureMultiply(0); } Pivot.parent = m_refTmRoot; SetRigidbodyValue(false, false); }