コード例 #1
0
    // 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);
    }
コード例 #2
0
 public void Update(IPacket packet)
 {
     switch (packet.Type)
     {
     case PacketType.GameUpdate:
         OnGameUpdate?.Invoke((Game.UpdatePacket)packet);
         break;
     }
 }
コード例 #3
0
        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();
            }
        }
コード例 #4
0
        //-----------------------------------------------------------------------------------------------
        //
        //-----------------------------------------------------------------------------------------------
        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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
ファイル: ChampionSpell.cs プロジェクト: werdbrian/AIO
            /// <summary>
            ///     Initializes a new instance of the <see cref="Handler" /> class.
            /// </summary>
            /// <param name="SpellInstance">
            ///     The spell instance.
            /// </param>
            /// <param name="Process">
            ///     The process.
            /// </param>
            /// <param name="Condition">
            ///     The condition.
            /// </param>
            /// <param name="Type">
            ///     The type.
            /// </param>
            public Handler(
                Spell SpellInstance, 
                OnGameUpdate Process, 
                OnSpellCheck Condition = null, 
                HandleType Type = HandleType.OnUpdate)
            {
                this.SpellInstance = SpellInstance;
                this.Type = Type;
                this.Process = Process;
                this.Condition = Condition;

                switch (Type)
                {
                    case HandleType.OnUpdate:
                        Game.OnUpdate += (EventArgs args) =>
                            {
                                if (Condition != null && Condition(SpellInstance))
                                {
                                    Process(SpellInstance);
                                }
                            };
                        break;
                }
            }
コード例 #7
0
 private void OnGameTick()
 {
     OnGameUpdate?.Invoke();
 }
コード例 #8
0
ファイル: EventController.cs プロジェクト: cano159/Spire
 internal void GameUpdate(GameTime time)
 {
     OnGameUpdate?.Invoke(this, new GameUpdatedEventArgs(time));
 }