// Update is called once per frame void Update() { if (IsFade) { var color = BlackScreen.color; color.a += Fade * Time.deltaTime; color.a = Mathf.Clamp(color.a, 0, 1); BlackScreen.color = color; } else { var color = BlackScreen.color; color.a -= Fade * Time.deltaTime; color.a = Mathf.Clamp(color.a, 0, 1); BlackScreen.color = color; } if (Input.GetKeyDown(KeyCode.Q)) { StartGame(); } if (Input.GetKeyDown(KeyCode.E)) { StopGame(); } if (GameStarted == true) { OnGameUpdate?.Invoke(); } SpawnController.instance.AddMaxRow(LevelIncreaseFactor * Time.deltaTime); }
public void Update(IPacket packet) { switch (packet.Type) { case PacketType.GameUpdate: OnGameUpdate?.Invoke((Game.UpdatePacket)packet); break; } }
private static void OnUpdate(ModEntry entry, float time) { if (!isInitialized && enabled && PlayerManager.PlayerTransform && !LoadingScreenManager.IsLoading && SingletonBehaviour <CanvasSpawner> .Instance) { Initialize(); } if (enabled && isInitialized) { #if DEBUG DebugUI.Update(); #endif OnGameUpdate?.Invoke(); } }
//----------------------------------------------------------------------------------------------- // //----------------------------------------------------------------------------------------------- protected override void Update(GameTime gameTime) { CurrentFrameNumber++; if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) { OnUserBackButtonPress?.Invoke(); } #if WINDOWS // In windows, we want to use keystrokes to mimic mobile buttons KeyboardState state = Keyboard.GetState(); foreach (var key in state.GetPressedKeys()) { _pressedKeys[key] = true; } bool shifted = state.IsKeyDown(Keys.LeftShift) || state.IsKeyDown(Keys.RightShift); var wasPressed = new List <Keys>(_pressedKeys.Keys); foreach (var key in wasPressed) { if (state.IsKeyUp(key)) { _pressedKeys.Remove(key); var c = CharFromKey(key, shifted); if (c != null) { HandleNativeInputCharacter(c.Value); } OnTypedCharacter?.Invoke(key, shifted, c ?? '\0'); } } #endif HandleUserInput(gameTime); OnGameUpdate?.Invoke(gameTime); base.Update(gameTime); UpdateAudio(gameTime); }
private void Update() { if (SR.GameContextLoaded && !gameContextLoaded) { SR.MessageDir.RegisterBundlesListener(dir => OnBundlesAvailable?.Handle(args: new object[] { dir }, unique: true)); SR.InputDir.onKeysChanged += () => OnKeysChanged?.Handle(unique: true); SR.ProgressDir.onProgressChanged += () => OnProgressChanged?.Handle(unique: true); gameContextLoaded = true; } if (SR.SceneContextLoaded && !sceneContextLoaded) { SR.EcoDir.didUpdateDelegate += () => OnPricesReset?.Handle(unique: true); SR.EcoDir.onRegisterSold += id => OnRegisterSold?.Handle(args: new object[] { id }, unique: true); SR.SlimeAppDir.onSlimeAppearanceChanged += (def, app) => OnSlimeAppearanceChanged?.Handle(args: new object[] { def, app }, unique: true); SR.ExchangeDir.onOfferChanged += () => OnOfferChanged?.Handle(unique: true); SR.TimeDir.onFastForwardChanged += state => OnFastForward?.Handle(args: new object[] { state }, unique: true); sceneContextLoaded = true; } OnGameUpdate?.Invoke(SR.Game, SR.Scene); }
private void OnGameTick() { OnGameUpdate?.Invoke(); }
internal void GameUpdate(GameTime time) { OnGameUpdate?.Invoke(this, new GameUpdatedEventArgs(time)); }