public IEnumerator LoadAdditive(SceneAsset scene, bool setActiveOnLoad) { m_sceneLibrary.AddSceneToLibrary(scene); m_pausedForLoadingEvent.Raise(true); AsyncOperation asyncOp; asyncOp = SceneManager.LoadSceneAsync(scene.SceneName(), LoadSceneMode.Additive); asyncOp.allowSceneActivation = false; yield return(MonitorLoadingOfScene(asyncOp)); //change status @90% asyncOp.allowSceneActivation = setActiveOnLoad; yield return(CheckIfLoadIsDone(asyncOp)); //update the scene asset m_sceneLibrary.SetAsLoaded(scene); var sceneRef = SceneManager.GetSceneByName(scene.SceneName()); scene.SetSceneRef(sceneRef); if (setActiveOnLoad) { SceneManager.SetActiveScene(sceneRef); m_sceneLibrary.SetActiveScene(scene); } scene.OnLoad(); m_pausedForLoadingEvent.Raise(false); }
private void FailGame() { _isFail = true; Debug.Log("Fail"); LevelFinished.Raise(false); }
private void OnEnterIdleState() { m_pool.TryCreateNewPool(m_deathFX); if (m_asset.IsPlayer()) { m_togglePanWideOffsetEvent.Raise(true); } m_smokeFX.SetActive(false); }
public void OnPauseKeyPressed() { if (m_pauseKeyActive) { m_isPaused.Value = !m_isPaused.Value; m_notifyPauseKey.Raise(m_isPaused.Value); m_notifyPauseAction.Raise(m_isPaused.Value); //Debug.Log("pause key:" + m_isPaused.Value); } }
private void Fire1Input() { if (Input.GetButtonDown("Fire1")) { m_fire.Raise(true); m_fireBtnDownOnly.Raise(); } if (Input.GetButtonUp("Fire1")) { m_fire.Raise(false); } }
public void PassTurn() { if (gsi.passedLastTurn != StoneColor.none) { gsi.gameOver = true; //UpdateTerritoryCounts();//We shouldnt have to do this here since it was done after the last stone was played, and its passed? gsi.Tally(); if (GameEndedEvent != null) { GameEndedEvent.Raise(); } } gsi.passedLastTurn = gsi.currentTurn; //AGA rules have you give your opponent a prisoner when you pass. //we store it as a separate int so we can implemenet different scoring system rulesets and compare. if (gsi.currentTurn == StoneColor.black) { gsi.timesBlackPassed++; } else if (gsi.currentTurn == StoneColor.white) { gsi.timesWhitePassed++; } gsi.currentTurn = OtherColor(gsi.currentTurn); if (TurnResponseEvent != null) { TurnResponseEvent.Raise(true); } if (TurnResponseCodeEvent != null) { TurnResponseCodeEvent.Raise(1); } }
private IEnumerator IntroSequence() { m_ambientPadsCue.Play(); yield return(new WaitForSeconds(1f)); m_showIntroUI.Raise(true); yield return(new WaitForSeconds(5f)); m_showIntroUI.Raise(false); yield return(new WaitForSeconds(1f)); //m_triggerNextSceneEvent.Raise(m_nextScene); m_triggerIntroCompleted.Raise(); }
IEnumerator showOrder() { showSequenceEvent.Raise(false); yield return(new WaitForSeconds(1f)); foreach (int n in buttonOrder) { glowButton.Raise(n); yield return(new WaitForSeconds(1f)); } expectedButtonIndex = 0; showSequenceEvent.Raise(true); }
public override void OnStateInputReceived(bool touch) { base.OnStateInputReceived(touch); if (_canEat.Value && touch && currentScore.Value <= goalScore.Value) { currentScore.Value += variation * Time.deltaTime; gameScore.Value += variation * Time.deltaTime / 10; if (!audio.isPlaying) { audio.Play(); } } else { if (audio.isPlaying) { audio.Stop(); } } if (_canEat.Value && currentScore.Value > goalScore.Value) { _canEat.Value = false; gameEndEvent.Raise(true); } }
private void Update() { if (Input.GetKeyDown(KeyCode.I)) { startIntroCanvasAnim = !startIntroCanvasAnim; m_showIntroEvent.Raise(startIntroCanvasAnim); } }
private void HandleVariable(EventData <bool> data) { if (internalUpdate) { return; } internalUpdate = true; hostToggle.isOn = data.value; if (onValueChangedEvent != null) { onValueChangedEvent.Raise(isOnVariable, data.value); } internalUpdate = false; }
private IEnumerator Timer() { while (isTimerRunning.Value && currentTimer.Value < timer.Value) { currentTimer.Value += 0.1f; yield return(_timerWaiter); } if (currentTimer.Value > timer.Value) { gameEndEvent.Raise(false); } }
private IEnumerator LoadFirstLevel() { //pause and transition m_currentState = DCCurrentState.loadingLevel; m_blockInteractions = true; m_pausePlayEvent.Raise(true); m_requestPauseGameEvent.Raise(true); m_enterTransitionEvent.Raise(); yield return(new WaitForSeconds(m_transitionDuration.Value)); //load level m_levels.SetupFirstLevel(m_terrainGen); m_unitPlacer.SetLevelAsset(m_levels.CurrentLevel()); yield return(new WaitForSeconds(1f)); m_exitTransitionEvent.Raise(); yield return(new WaitForSeconds(m_transitionDuration.Value)); //show intro m_requestIntroUIEvent.Raise(m_levels.CurrentLevel()); m_currentState = DCCurrentState.levelIntro; m_blockInteractions = false; }
private void Update() { if (Input.GetButtonDown("Fire1")) { if (changeButton == buttonToChange.leftClick) { Debug.Log("badLeftClick"); onWrongChange.Raise(true); onWrongSwitch?.Invoke(flipFlops, changeButton); } inputVector.x = 1; } if (Input.GetButtonDown("Fire2")) { if (changeButton == buttonToChange.rightClick) { onWrongChange.Raise(false); Debug.Log("badRightClick"); onWrongSwitch?.Invoke(flipFlops, changeButton); } inputVector.y = 1; } }
private void CheckIfItsDark(float angle) { if (angle < 280f && angle > 70f) { m_isDark.Value = true; } else { m_isDark.Value = false; } if (m_isDark.Value != m_previousDark) { m_itGotDarkEvent.Raise(m_isDark.Value); m_previousDark = m_isDark.Value; } }
private void switchStates() { onStateChange.Raise(changeButton == buttonToChange.leftClick); foreach (FlipFlopMovement n in flipFlops) { switch (n.state) { case feetState.anchor: n.makeFeet(); break; case feetState.feet: onStateSwitch?.Invoke(flipFlops, n); n.makeAnchor(); break; } } }
private void Update() { Debug.Log("audio mgr status: " + AudioManager.isEnabled); if (Input.GetKeyDown(KeyCode.Alpha0)) { //audioCueEvent.Raise(cue); } if (Input.GetKeyDown(KeyCode.Alpha1)) { pitchEvent.Raise(pitch); pitch += 0.5f; } if (Input.GetKeyDown(KeyCode.Alpha2)) { toggleEvent.Raise(isOn); isOn = !isOn; } }
private void Start() { LoadGame.Raise(true); }
// Called in Lightning animation event. void StartFlash() { LightningEffect.Raise(true); }
private void Start() { _rechargeShieldDelayCount = 0; OnHealthShieldChanged.Raise(false); }
private IEnumerator ShowMenu() { yield return(new WaitForSeconds(m_transitionDuration.Value * 1.5f)); m_toggleMainMenu.Raise(true); }
// HERE JAMES private IEnumerator NarrativeSteps() { playInterComSound = true; displayStepText(); switch (currentIndex) { case 0: textDisplayDuration = 7; timeBetweenSteps = 0; noHideRaise = true; noDisplayRaise = true; break; //Hello Cadet! Welcome aboard the SS Junk! I’m Captain Von Droop!” case 1: textDisplayDuration = 13; timeBetweenSteps = 0; noHideRaise = true; noDisplayRaise = true; break; //We travel deep into space to process aliens like Blumps and Grunks. They’re valuale and pretty cute! The deeper we go, the more we’ll find! case 2: textDisplayDuration = 9; timeBetweenSteps = 0; noHideRaise = true; noDisplayRaise = true; break; //Your job is to receive Blumps and Grumps from the chute, process them and sort them into these bins. case 3: textDisplayDuration = 6; timeBetweenSteps = 0; noHideRaise = true; noDisplayRaise = true; break; //Air circulation is very important on this ship. You remember how to breathe right? case 4: textDisplayDuration = 9; timeBetweenSteps = 0; noHideRaise = true; noDisplayRaise = true; break; //Watch the breath gauge! Use LEFT CTRL and RIGHT CTRL to inhale and exhale while in the Yellow zones //Breathe NORMAL case 5: textDisplayDuration = 6; timeBetweenSteps = 0; noHideRaise = true; noDisplayRaise = true; startInhaleEvent.Raise(); break; //Remember if you fail to breathe properly you will pass out - be careful! case 6: textDisplayDuration = 10; timeBetweenSteps = 20; CameraShakeEvent.Raise(0); EmergencySirenEvent.Raise(true); playSFX(sfx.Siren); spawnAlien(alienType.Circle, 2); spawnAlien(alienType.CrushedSquare, 2); setAlienLimitEvent.Raise(10); setSpawnMultiplierEvent.Raise(1f); noHideRaise = false; noDisplayRaise = false; break; //Fresh Aliens incoming! Put the Purple Blumbles in the Purple Bin and the Orange Grunks in the orange bin. //Spawn 3 Blumbles & 3 Grunks //Variable spawn rate of BlumbleB's and GrunksB's case 7: textDisplayDuration = 6; timeBetweenSteps = 15; EmergencySirenEvent.Raise(false); CameraShakeEvent.Raise(3); stopSFX(sfx.Siren); addAlienTypeToSpawner(alienType.CirclePair); addAlienTypeToSpawner(alienType.CircleTrio); spawnAlien(alienType.CirclePair, 1); spawnAlien(alienType.CircleTrio, 1); noHideRaise = false; noDisplayRaise = false; break; //Whoa those Blumbles need to be cut! Use the laser! //Summon BlumbleA's case 8: playSFX(sfx.Oxygen); textDisplayDuration = 6; timeBetweenSteps = 15; EmergencySirenEvent.Raise(true); CameraShakeEvent.Raise(1); changeBreathDifficulty(difficulty.Deep); noHideRaise = false; noDisplayRaise = false; break; //Uhh sorry cadet! Our new intern broke our oxygen valve, breathe deeper while I fix this! //Breathe DEEP case 9: stopSFX(sfx.Oxygen); textDisplayDuration = 6; timeBetweenSteps = 0; EmergencySirenEvent.Raise(false); changeBreathDifficulty(difficulty.Normal); noHideRaise = true; noDisplayRaise = true; break; //FIXED! You can breathe normally now - Ugh Interns are the worst sometimes. //Breath NORMAL case 10: textDisplayDuration = 6; timeBetweenSteps = 10; EmergencySirenEvent.Raise(true); playSFX(sfx.Siren); CameraShakeEvent.Raise(4); playSFX(sfx.HyperSpace); setAlienLimitEvent.Raise(20); setSpawnMultiplierEvent.Raise(1.5f); stopSFX(sfx.Siren); noHideRaise = false; noDisplayRaise = false; break; //Alright let’s go DEEPER INTO SPACE! Watch out for more aliens! //Increase spawn rate after transition case 11: textDisplayDuration = 6; timeBetweenSteps = 15; EmergencySirenEvent.Raise(false); addAlienTypeToSpawner(alienType.LongSquare); spawnAlien(alienType.LongSquare, 3); noHideRaise = false; noDisplayRaise = false; break; //Ah! Those grunks are too big! Use the crusher! //Spawn GrunkA's case 12: textDisplayDuration = 10; timeBetweenSteps = 20; changeBreathDifficulty(difficulty.Quick); playSFX(sfx.Siren); playSFX(sfx.PirateBattle); CameraShakeEvent.Raise(1); FlickerOff.Raise(); EmergencySirenEvent.Raise(true); noHideRaise = false; noDisplayRaise = false; break; //Oh no Pirates are attacking - everyone panic and breathe quickly! Intern help me EEK! //Breath QUICKLY case 13: textDisplayDuration = 9; timeBetweenSteps = 10; changeBreathDifficulty(difficulty.Normal); stopSFX(sfx.Siren); FlickerOn.Raise(); EmergencySirenEvent.Raise(false); CameraShakeEvent.Raise(4); playSFX(sfx.HyperSpace); setAlienLimitEvent.Raise(30); setSpawnMultiplierEvent.Raise(2f); stopSFX(sfx.PirateBattle); noHideRaise = false; noDisplayRaise = false; break; //Let's get out of here! Onwards to Deepest Space! Breath normally but Expect a lot of aliens... //Breath NORMAL case 14: textDisplayDuration = 7; timeBetweenSteps = 20; changeBreathDifficulty(difficulty.Deep); noHideRaise = false; noDisplayRaise = false; break; //Is that…a lavender scented candle? Nice! Everyone - Breath that in deeply! //Breath DEEPLY case 15: textDisplayDuration = 7; timeBetweenSteps = 20; changeBreathDifficulty(difficulty.Deepest); CameraShakeEvent.Raise(3); noHideRaise = false; noDisplayRaise = false; break; //Whoa slow down - that’s not lavender - that’s eucalyptus - my favorite!! Breath as deep as you can! //Breath DEEPEST case 16: textDisplayDuration = 7; timeBetweenSteps = 15; changeBreathDifficulty(difficulty.Normal); noHideRaise = false; noDisplayRaise = false; break; //Ahh that was nice... Alright - Breath normally //Breath NORMAL case 17: textDisplayDuration = 7; timeBetweenSteps = 2; narrativeComplete = true; setSpawnMultiplierEvent.Raise(0f); noHideRaise = false; noDisplayRaise = false; break; //Great work cadet! We ventured to deepest space and cleansed the galaxy! Great job! } if (playInterComSound) { playSFX(sfx.Intercom); } yield return(null); }