private void HandleMessages() { while (MessageInterface.HasMessageInQueue) { HandleMessage(MessageInterface.PopFromQueue()); } }
protected virtual void Update() { while (MessageInterface.HasMessageInQueue) { HandleMessage(MessageInterface.PopFromQueue()); } UpdateSubtitles(); }
void HandleMessages() { if (MessageInterface.Valid && MessageInterface.HasMessageInQueue) { while (MessageInterface.HasMessageInQueue) { QdmsMessage msg = MessageInterface.PopFromQueue(); if (msg.GetType() == typeof(RpgChangeWeaponMessage)) { DoEquipmentThing(); } } } }
void Update() { //message bus integration while (MessageInterface.HasMessageInQueue) { HandleMessage(MessageInterface.PopFromQueue()); } //run cleanup periodically TimeElapsed += Time.deltaTime; if (TimeElapsed >= CleanupInterval) { for (int i = PlayingSounds.Count - 1; i >= 0; i--) { var s = PlayingSounds[i]; if (s.Source == null || !s.Source.isPlaying) { Destroy(s.Source.gameObject); PlayingSounds.RemoveAt(i); } } TimeElapsed = 0; } //report time if applicable if (MusicEnabled && CurrentUserMusicComponent != null && CurrentMusicSlot == MusicSlot.User && MusicPlayers[MusicSlot.User].isPlaying && MusicPlayers[MusicSlot.User].clip != null) { CurrentUserMusicComponent.ReportTime(MusicPlayers[MusicSlot.User].time); } //handle track ended if (MusicEnabled && CurrentUserMusicComponent != null && CurrentMusicSlot == MusicSlot.User && !MusicPlayers[MusicSlot.User].isPlaying && MusicPlayers[MusicSlot.User].clip != null && MusicPlayers[MusicSlot.User].timeSamples == MusicPlayers[MusicSlot.User].clip.samples) { CurrentUserMusicComponent.SignalTrackEnded(); } }