private void Start() { crossingTime = bmEvent.eventMBT.GetMilliseconds(); offTime = new MBT(bmEvent.eventMBT.Measure + 1, bmEvent.eventMBT.Beat, bmEvent.eventMBT.Tick).GetMilliseconds(); spr = GetComponent <SpriteRenderer>(); spr.sprite = offSprite; typeCue = CueState.Early; }
public void UpdateWindow() { //check our cue state against the Clock Script //for this case (more-or-less typical japanese rhythm game style), our detection windows are // early - ok - good - perfect - good - ok - late switch (gemCueState) { case CueState.Early: //check to see if we've gotten to "ok" if (wwiseSync.GetMusicTimeInMS() > OkWindowStart) { gemCueState = CueState.OK; } break; case CueState.OK: //check to see if we've gotten to "good"... if (wwiseSync.GetMusicTimeInMS() > GoodWindowStart && wwiseSync.GetMusicTimeInMS() < PerfectWindowStart) { gemCueState = CueState.Good; } //... or maybe we're at the end of the last "ok" window else if (wwiseSync.GetMusicTimeInMS() > OkWindowEnd) { gemCueState = CueState.Late; } break; case CueState.Good: //check to see if we've gotten to "perfect" if (wwiseSync.GetMusicTimeInMS() > PerfectWindowStart && wwiseSync.GetMusicTimeInMS() < PerfectWindowEnd) { gemCueState = CueState.Perfect; Debug.Log("currentPosition: " + transform.position); } // else if (wwiseSync.GetMusicTimeInMS() > GoodWindowEnd) { gemCueState = CueState.OK; } break; case CueState.Perfect: if (wwiseSync.GetMusicTimeInMS() > PerfectWindowEnd) { gemCueState = CueState.Good; } break; default: //if we're "late" there are no more potential state changes break; } }
public void UpdateWindow() { //check our cue state against the Clock Script //for this case (more-or-less typical japanese rhythm game style), our detection windows are // early - ok - good - perfect - good - ok - late switch (gemCueState) { case CueState.Early: //check to see if we've gotten to "ok" if (Clock.Instance.TimeMS > OkWindowStart) { gemCueState = CueState.OK; } break; case CueState.OK: //check to see if we've gotten to "good"... if (Clock.Instance.TimeMS > GoodWindowStart && Clock.Instance.TimeMS < PerfectWindowStart) { gemCueState = CueState.Good; } //... or maybe we're at the end of the last "ok" window else if (Clock.Instance.TimeMS > OkWindowEnd) { gemCueState = CueState.Late; } break; case CueState.Good: //check to see if we've gotten to "perfect" if (Clock.Instance.TimeMS > PerfectWindowStart && Clock.Instance.TimeMS < PerfectWindowEnd) { gemCueState = CueState.Perfect; } // else if (Clock.Instance.TimeMS > GoodWindowEnd) { gemCueState = CueState.OK; } break; case CueState.Perfect: if (Clock.Instance.TimeMS > PerfectWindowEnd) { gemCueState = CueState.Good; } break; default: //if we're "late" there are no more potential state changes break; } }
public void RunCueGroup(CueState cueState) { var cueGroup = cuegroupHandler.GetCueGroup(cueState.CueId); foreach (var cue in cueGroup.Cues) { var owningCueBook = cue.CueBook; Clients.Group(GetCrewGroupName(owningCueBook.Show.Id, owningCueBook.Id)).runCue(new CueState(cue.Id, cue.Number, cueState.Status)); } ShowHub.UpdateCueGroupState(cueState, this); }
public void Stop(float fade) { if (fade == 0.0f) { StopInternal(); } else { m_currentState = CueState.PlayingFadeOut; m_fadeSpeed = 1.0f / fade; } }
// Start is called before the first frame update void Start() { startPosition = transform.position; destination = GameObject.FindGameObjectWithTag("NowCrossing").transform.position; //we want to stay in the lane, so the destination will have the same x and y coordinates as the start. destination.x = transform.position.x; destination.y = transform.position.y; destination.z -= crossPositionOffset; //velocity = distance/time -- we want to make sure that the cue crosses our destination on beat velocity = (destination - transform.position) / (float)(0.001f * (crossingTime - wwiseSync.GetMusicTimeInMS())); gemCueState = CueState.Early; _gemCrossed = false; }
public void Play(float fade) { m_currentPosition = 0; if (m_currentAudioSource != null) { m_currentAudioSource.m_audioSource.timeSamples = 0; } if (fade == 0.0f) { m_currentState = CueState.Playing; } else { m_currentState = CueState.PlayingFadeIn; m_fadeSpeed = 1.0f / fade; } }
// Start is called before the first frame update void Start() { startPosition = transform.position; crossingTime = bmEvent.eventMBT.GetMilliseconds(); destination = GameObject.FindGameObjectWithTag("NowCrossing").transform.position; //we want to stay in the lane, so the destination will have the same x and y coordinates as the start. destination.x = transform.position.x; destination.z = transform.position.z; //velocity = distance/time -- we want to make sure that the cue crosses our destination on beat velocity = (destination - transform.position) / (float)(0.001f * (crossingTime - Clock.Instance.TimeMS)); gemCueState = CueState.Early; _gemCrossed = false; }
public void Play(float fade, double dspStartTime) { m_currentPosition = 0; m_hasDSPStartTime = true; m_dspStartTime = dspStartTime; if (m_currentAudioSource != null) { m_currentAudioSource.m_audioSource.timeSamples = 0; } if (fade == 0.0f) { m_currentState = CueState.Playing; } else { m_currentState = CueState.PlayingFadeIn; m_fadeSpeed = 1.0f / fade; } }
private static void UpdateCueGroupState(CueState state, ShowHub hub) { var show = hub.cuegroupHandler.GetCueGroup(state.CueId).StageManagerCueBook.Show; if (!cueDictionary.ContainsKey(show.Id)) { cueDictionary.Add(show.Id, new List <CueState>()); } var internalCueState = cueDictionary[show.Id].FirstOrDefault(cs => cs.CueId == state.CueId); if (internalCueState == null) { cueDictionary[show.Id].Add(state); } else { internalCueState.Status = state.Status; } }
bool CheckState(CueState state) { Debug.Assert(IsValid, "Before checking state, test IsValid!"); return IsValid && ((int)(m_cue.State & state) == (int)state); }
private static bool HasState(this Cue cue, CueState state) { return (cue.State & state) != 0; }
void Update() { bool queueEnableAndPlay = false; if (m_currentAudioSource == null) { // don't bother stealing if we're going to be silent anyway... if (GetTheoreticalVolume() > 0) { m_currentAudioSource = WingroveRoot.Instance.TryClaimPoolSource(this); } if (m_currentAudioSource != null) { m_currentAudioSource.m_audioSource.clip = m_audioClipSource.GetAudioClip(); if (!m_isPaused) { m_currentAudioSource.m_audioSource.loop = m_audioClipSource.GetLooping(); queueEnableAndPlay = true; } } else { if (!m_isPaused) { if (m_hasStartedEver) { m_currentPosition += (int)(WingroveRoot.GetDeltaTime() * m_audioClipSource.GetAudioClip().frequency * GetMixPitch()); } if (m_currentPosition > m_audioClipSource.GetAudioClip().samples) { if (m_audioClipSource.GetLooping()) { m_currentPosition -= m_audioClipSource.GetAudioClip().samples; } else { StopInternal(); } } } } } else { if (!m_isPaused) { m_currentPosition = m_currentAudioSource.m_audioSource.timeSamples; } } if (!m_isPaused) { switch (m_currentState) { case CueState.Initial: break; case CueState.Playing: m_fadeT = 1; break; case CueState.PlayingFadeIn: m_fadeT += m_fadeSpeed * WingroveRoot.GetDeltaTime(); if (m_fadeT >= 1) { m_fadeT = 1.0f; m_currentState = CueState.Playing; } break; case CueState.PlayingFadeOut: m_fadeT -= m_fadeSpeed * WingroveRoot.GetDeltaTime(); if (m_fadeT <= 0) { m_fadeT = 0.0f; StopInternal(); // early return!!!! return; } break; } if (!m_audioClipSource.GetLooping()) { if (m_currentPosition > m_audioClipSource.GetAudioClip().samples - 1000) { StopInternal(); return; } } } SetMix(); if (queueEnableAndPlay) { if (m_currentAudioSource != null) { m_currentAudioSource.m_audioSource.enabled = true; m_currentAudioSource.m_audioSource.timeSamples = m_currentPosition; Audio3DSetting settings = m_audioClipSource.Get3DSettings(); if (settings == null) { WingroveRoot.Instance.SetDefault3DSettings(m_currentAudioSource.m_audioSource); } else { AudioRolloffMode rolloffMode = settings.GetRolloffMode(); if ( rolloffMode != AudioRolloffMode.Custom ) { m_currentAudioSource.m_audioSource.rolloffMode = rolloffMode; m_currentAudioSource.m_audioSource.minDistance = settings.GetMinDistance(); m_currentAudioSource.m_audioSource.maxDistance = settings.GetMaxDistance(); } else { m_currentAudioSource.m_audioSource.rolloffMode = AudioRolloffMode.Linear; m_currentAudioSource.m_audioSource.minDistance = float.MaxValue; m_currentAudioSource.m_audioSource.maxDistance = float.MaxValue; } } if ((m_hasDSPStartTime) && (m_dspStartTime > AudioSettings.dspTime)) { m_currentAudioSource.m_audioSource.timeSamples = m_currentPosition = 0; m_currentAudioSource.m_audioSource.PlayScheduled(m_dspStartTime); } else { m_currentAudioSource.m_audioSource.Play(); } } } m_hasStartedEver = true; }
void Update() { bool queueEnableAndPlay = false; if (m_currentAudioSource == null) { // don't bother stealing if we're going to be silent anyway... if (GetTheoreticalVolume() > 0) { m_currentAudioSource = WingroveRoot.Instance.TryClaimPoolSource(this); } if (m_currentAudioSource != null) { m_currentAudioSource.m_audioSource.clip = m_audioClipSource.GetAudioClip(); if (!m_isPaused) { m_currentAudioSource.m_audioSource.loop = m_audioClipSource.GetLooping(); queueEnableAndPlay = true; } } else { if (!m_isPaused) { if (m_hasStartedEver) { m_currentPosition += (int)(WingroveRoot.GetDeltaTime() * m_audioClipSource.GetAudioClip().frequency *GetMixPitch()); } if (m_currentPosition > m_audioClipSource.GetAudioClip().samples) { if (m_audioClipSource.GetLooping()) { m_currentPosition -= m_audioClipSource.GetAudioClip().samples; } else { StopInternal(); } } } } } else { if (!m_isPaused) { m_currentPosition = m_currentAudioSource.m_audioSource.timeSamples; } } if (!m_isPaused) { switch (m_currentState) { case CueState.Initial: break; case CueState.Playing: m_fadeT = 1; break; case CueState.PlayingFadeIn: m_fadeT += m_fadeSpeed * WingroveRoot.GetDeltaTime(); if (m_fadeT >= 1) { m_fadeT = 1.0f; m_currentState = CueState.Playing; } break; case CueState.PlayingFadeOut: m_fadeT -= m_fadeSpeed * WingroveRoot.GetDeltaTime(); if (m_fadeT <= 0) { m_fadeT = 0.0f; StopInternal(); // early return!!!! return; } break; } if (!m_audioClipSource.GetLooping()) { if (m_currentPosition > m_audioClipSource.GetAudioClip().samples - 1000) { StopInternal(); return; } } } SetMix(); if (queueEnableAndPlay) { if (m_currentAudioSource != null) { m_currentAudioSource.m_audioSource.enabled = true; m_currentAudioSource.m_audioSource.timeSamples = m_currentPosition; Audio3DSetting settings = m_audioClipSource.Get3DSettings(); if (settings == null) { WingroveRoot.Instance.SetDefault3DSettings(m_currentAudioSource.m_audioSource); } else { AudioRolloffMode rolloffMode = settings.GetRolloffMode(); if (rolloffMode != AudioRolloffMode.Custom) { m_currentAudioSource.m_audioSource.rolloffMode = rolloffMode; m_currentAudioSource.m_audioSource.minDistance = settings.GetMinDistance(); m_currentAudioSource.m_audioSource.maxDistance = settings.GetMaxDistance(); } else { m_currentAudioSource.m_audioSource.rolloffMode = AudioRolloffMode.Linear; m_currentAudioSource.m_audioSource.minDistance = float.MaxValue; m_currentAudioSource.m_audioSource.maxDistance = float.MaxValue; } } if ((m_hasDSPStartTime) && (m_dspStartTime > AudioSettings.dspTime)) { m_currentAudioSource.m_audioSource.timeSamples = m_currentPosition = 0; m_currentAudioSource.m_audioSource.PlayScheduled(m_dspStartTime); } else { m_currentAudioSource.m_audioSource.Play(); } } } m_hasStartedEver = true; }
private static bool HasState(this Cue cue, CueState state) { return((cue.State & state) != 0); }
bool CheckState(CueState state) { Debug.Assert(IsValid, "Before checking state, test IsValid!"); return(IsValid && ((int)(m_cue.State & state) == (int)state)); }
private void Start() { crossingTime = bmEvent.eventMBT.GetMilliseconds(); typeCue = CueState.Early; crossed = false; }
bool CheckState(CueState state) { Debug.Assert(IsValid, "Before checking state, test IsValid!"); return IsValid && m_cue.State == state; }