public override void Interact() { if (!CanInteract) { return; } if (!IsOn) { IsOn = true; Reciever.SetActive(false); MyAudio.Stop(); //Stop ringing MyAudio.PlayOneShot(Pickup); Invoke("PlayTone", 0.5f); } else { Reciever.SetActive(true); IsOn = false; MyAudio.Stop(); MyAudio.PlayOneShot(Putdown); } }
private void OnDetectorLeave(MyEntityDetector sender, MyEntity entity) { if (m_isStartingGame) { MyScriptWrapper.RemoveEntityMark(m_detector); m_restartRace = true; MyScriptWrapper.AddNotification(MyScriptWrapper.CreateNotification(MyTextsWrapperEnum.GoBackToStartingPosition, MyHudConstants.ENEMY_FONT, 5000)); Name = m_goBackName; for (int i = 0; i < notifyCount; i++) { if (notifications[i] != null) { notifications[i].Disappear(); } } if (OnStartNumberChanged != null) { OnStartNumberChanged(-1); } if (m_startSoundFinished) { MyAudio.Stop(); } } }
public override void LoadContent() { MyMwcLog.WriteLine("MyGuiScreenLoading.LoadContent - START"); MyMwcLog.IncreaseIndent(); AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("MyGuiScreenLoading::LoadContent"); // We must stop XACT sounds here, not in the background thread, because on Windows XP is safer if only // main thread uses XACT. If we do it from background thread, we won't probably hear no sound. if (MyAudio.GetMusicState() != MyMusicState.Stopped) { MyAudio.Stop(); } m_backgroundScreenTexture = m_backgroundTextureFromConstructor ?? MyTextureManager.GetTexture <MyTexture2D>(GetRandomBackgroundTexture(), flags: TextureFlags.IgnoreQuality); m_minerWarsLogoTexture = MyTextureManager.GetTexture <MyTexture2D>("Textures\\GUI\\MinerWarsLogoLarge", null, LoadingMode.Immediate, flags: TextureFlags.IgnoreQuality); //m_minerWarsActorsTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\MinerWarsActors", flags: TextureFlags.IgnoreQuality); if (m_screenToUnload != null) { // If there is existing screen we are trying to replace (e.g. gameplay screen), we will mark this one as unloaded, so // then remove screen method won't try to unload it and we can do it in our thread. This is also the reason why we do it // here, becasue changing IsLoaded in paralel thread can't tell us when it happens - and this must be serial. m_screenToUnload.IsLoaded = false; m_screenToUnload.CloseScreenNow(); } m_currentQuoteOfTheDay = MyQuoteOfTheDay.GetRandomQuote(); // Base load content must be called after child's load content base.LoadContent(); if (m_screenToLoad != null && !m_loadInDrawFinished && m_loadFinished) { m_screenToLoad.SetState(MyGuiScreenState.OPENING); m_screenToLoad.LoadContent(); } else { m_loadFinished = false; } AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock(); MyMwcLog.DecreaseIndent(); MyMwcLog.WriteLine("MyGuiScreenLoading.LoadContent - END"); }
public override void Interact() { IsOn = !IsOn; if (IsOn) { MyAudio.Play(); } else { MyAudio.Stop(); } MyAudio.PlayOneShot(Switch); Knob.transform.rotation = Quaternion.Euler(IsOn ? -87 : 0, Knob.transform.eulerAngles.y, Knob.transform.eulerAngles.z); }