public void ObjectState(Boolean p_stateValue, Boolean p_skipAnimation) { enabled = true; String text = (!p_stateValue) ? m_DeactiveClip : m_ActiveClip; if (p_skipAnimation) { if (m_Animation[text] != null) { m_Animation.Play(text, PlayMode.StopAll); m_Animation[text].normalizedTime = 1f; m_Animation.Sample(); } m_animEndTime = Time.time; m_interactionTime = Time.time; if (m_interaction != null) { enabled = false; m_interaction.ReleaseInteractLock(); m_interaction.TriggerStateChange(); } } else { AudioManager.Instance.RequestPlayAudioID((!p_stateValue) ? m_switchRelease : m_switchLock, 1, -1f, gameObject.transform, 1f, 0f, 0f, null); m_animEndTime = Time.time; m_interactionTime = Time.time; if (m_Animation[text] != null) { m_Animation.Play(text, PlayMode.StopAll); m_animEndTime += m_Animation[text].clip.length; m_interactionTime += m_Animation[text].clip.length * m_triggerAfterPlayTimePercentage; } } }
private void InvokeTriggerStateChange() { if (m_interaction != null) { m_interaction.TriggerStateChange(); m_interaction.ReleaseInteractLock(); } }
public void ObjectState(Boolean p_stateValue, Boolean p_skipAnimation) { enabled = true; AudioController.Stop(m_doorCloseSoundID); AudioController.Stop(m_doorOpenSoundID); String text = (!p_stateValue) ? m_DeactiveClip : m_ActiveClip; if (collider != null) { collider.enabled = !p_stateValue; } if (p_skipAnimation) { if (m_Animation[text] != null) { m_Animation.Play(text, PlayMode.StopAll); m_Animation[text].normalizedTime = 1f; m_Animation.Sample(); } m_animEndTime = Time.time; m_interactionTime = Time.time; if (m_interaction != null) { enabled = false; m_interaction.ReleaseInteractLock(); m_interaction.TriggerStateChange(); } } else { AudioManager.Instance.RequestPlayAudioID((!p_stateValue) ? m_doorCloseSoundID : m_doorOpenSoundID, 1, -1f, gameObject.transform, m_soundVolume, 0f, 0f, null); m_animEndTime = Time.time; m_interactionTime = Time.time; if (m_Animation[text] != null) { m_Animation.Play(text, PlayMode.StopAll); m_animEndTime += m_Animation[text].clip.length; if (p_stateValue) { m_interactionTime += m_Animation[text].clip.length * m_triggerAfterPlayTimePercentage; } } } }