void Update() { if (Application.isLoadingLevel == false && loading) { loading = false; LoadContent(); } if (start) { if (_state == GameState.InGame) { //After countdown.. _gameMode.Update(); } start = false; } if (_state == GameState.InGame) { //After countdown.. if (!_gameMode.GameEnd()) { int displayMinutes = (int)(GameManager._gameMode.GetTimer() / 60.0f); int displaySeconds = (int)(GameManager._gameMode.GetTimer() % 60.0f); _timerUI.GetComponentInChildren <Text>().text = string.Format("{0}:{1:00}", displayMinutes, displaySeconds); _gameMode.Update(); } else { GameObject _obj = (GameObject)Instantiate(FindObjectOfType <MenuManager>().WinBanner, Vector3.zero, Quaternion.identity); if (_gameMode.winnerActor != null) { _obj.GetComponentInChildren <Text>().text = _gameMode.winnerActor.actorName + " wins!"; } else { _obj.GetComponentInChildren <Text>().text = "Tie!"; } _state = GameState.Win; } } if (_state == GameState.Win) { if (GamepadInput.GamePad.GetButtonDown(GamepadInput.GamePad.Button.Start, GamepadInput.GamePad.Index.Any)) { OnMenuScene(); Application.LoadLevel(0); } } }
/** * Fonctionne comme la fonction Update de Unity, est appelée par l'Update * du GameManager quand le mode est actif. * Cette fonction appelle d'abord l'Update du mode parent, s'il existe (et donc, * récursivement, l'Update de tous les autres parents). **/ public void Update() { if (parentMode != null) { parentMode.Update(); } UpdateMode(); }
private void Update() { if (_gameModeInstance != null) { if (_gameModeInstance.isActive) { _gameModeInstance.Update(); } } }
// Update is called once per frame void Update() { switch (ConfigInfo.currentGameMode) { // Timed mode case Mode.Timed: { instance.Update(Time.deltaTime); break; } } }
private void Update() { GameMode.Update(); unitHolder.gameObject.SetActive(RaycastValidPosition); if (RaycastValidPosition) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, 100f, RaycastMask.value)) { Vector3 unitHolderPosition = hit.point; unitHolder.SetPosition(unitHolderPosition); unitHolder.SetIsValidPosition(true); } } }
public void Update(GameTime gameTime, bool cutScene, int newGameState) { Player.Update(gameTime, cutScene); CheckActive(); if (!cutScene) { if (isActive && gameMode.BetweenLevelsTimer.IsFinished) { UpdateSpawnHandlers(gameTime); } if (newGameState != EventOperator.CUT_SCENE_STATE) { gameMode.Update(gameTime); } ProgressGame(gameTime); } Drops.Update(gameTime); Enemies.Update(gameTime); Projectiles.Update(gameTime); HandleAllCollisions(); }
void FixedUpdate() { activeGameMode.Update(); }
/// <summary> /// Updates the director, along with current game mode. /// </summary> internal static bool Update() { if (modeChangePending) { //There was a mode change last frame. //See below for where this is set. Clock.ModeTimeReset(); if (ActiveTransition != null) { ActiveTransition.FadeIn(); } CurrentMode.OnFirstUpdate(); modeChangePending = false; } if (ActiveTransition != null) { ActiveTransition.Update(); if (AudioDimming && !ActiveTransition.FadeOutDone && AudioEngine.Music != null) { AudioEngine.Music.DimmableVolume = 0.2f + ActiveTransition.CurrentValue * 0.8f; } if (ActiveTransition.FadeOutDone) { if (PendingOsuMode != OsuMode.Unknown) { changeMode(PendingOsuMode); } else if (ActiveTransition.FadeInDone) { TriggerOnTransitionEnded(); ActiveTransition.Dispose(); ActiveTransition = null; } } } else if (GameBase.ActiveNotification != null) { SpriteManager.UniversalDim = GameBase.ActiveNotification.Alpha * 0.7f; } else if (GameBase.GloballyDisableInput) { SpriteManager.UniversalDim = Math.Min(0.8f, SpriteManager.UniversalDim + 0.06f); } else { SpriteManager.UniversalDim = 0; } //audio dimming if (AudioDimming && AudioEngine.Music != null) { if (SpriteManager.UniversalDim > 0) { AudioEngine.Music.DimmableVolume = Math.Min(1 - SpriteManager.UniversalDim * 0.8f, AudioEngine.Music.DimmableVolume); } if (AudioEngine.Music.DimmableVolume < 1) { AudioEngine.Music.DimmableVolume = Math.Min(1, AudioEngine.Music.DimmableVolume + 0.02f); } } if (modeChangePending) { return(true); } //Save the first mode updates after we purge this frame away. //Initialising a mode usually takes a fair amount of time and will throw off timings, //so we count this as a null frame. if (CurrentMode != null) { CurrentMode.Update(); } return(false); }