public void Update(GameUpdateEventArgs e) { this.lightnessBar.Update(e); this.tensionBar.Update(e); this.healthBar.Update(e); this.lightnessBar.Value = this.game.Player.Tile.Info.Lightness * 2; var chasingCount = this.game.ChasingEnemies.Count; var nearCount = this.game.MonstersCloseToPlayer; var tension = 1 - (float)Math.Pow(1.2, -nearCount) * (float)Math.Pow(1.7, -chasingCount); if (this.game.State == GameState.GameOverState.Won) { tension = 1; } this.tensionBar.Value = tension; this.healthBar.Value = this.game.Player.HealthPercentage; if (Settings.Game.DynamicMusic) { this.Parameters = new MusicParameters( this.lightnessBar.Value, this.tensionBar.Value, this.game.Player.HealthPercentage, this.game.State); } }
private void UpdateGame(object sender, GameUpdateEventArgs args) { dispatcher.BeginInvoke(() => { UpdatePlayerHand(); UpdateCurrentQuestion(); UpdateConfirmedWhiteCard(); UpdateStatusText(); UpdatePlayerList(); UpdateRoundWinnerModal(); OnPropertyChanged("ReadyCommand"); OnPropertyChanged("ConfirmCommand"); }); }
private void OnUpdateGame(object sender, GameUpdateEventArgs args) { Console.WriteLine("Game Updated"); RunOnUiThread(() => { UpdateCurrentQuestion(); UpdateStatusText(); UpdateReadyButton(); UpdatePlayerList(); UpdateConfirmButton(); UpdatePlayerHand(); UpdateSelectedCardView(); UpdateRoundWinner(); }); }
private void DrawField(object sender, GameUpdateEventArgs gameUpdateEventArgs) { Logger.LogEntry("GAME", LogLevel.Debug, $"Step {gameUpdateEventArgs.Step}"); App.RunOnUiThread(() => { AliveLabel.Content = $"Alive: {gameUpdateEventArgs.AliveCount}"; StepLabel.Content = $"Step: {gameUpdateEventArgs.Step}"; for (var i = 0; i < _height; ++i) { for (var j = 0; j < _width; ++j) { _cellRectangles[i, j].Background = gameUpdateEventArgs.State[i, j] == CellState.Alive ? AliveBrush : DeadBrush; } } }); }
/// <summary> /// The <see cref="E:CoreGameUpdate"/> method fired when game engine updates /// </summary> /// <param name="args">The <see cref="GameUpdateEventArgs"/> instance</param> protected internal override void CoreGameUpdate(GameUpdateEventArgs args) { Slacking = args.OrbwalkingMode == Mode.None; base.CoreGameUpdate(args); try { Automated(args); } catch (Exception ex) { ex.Log(); } try { if (KillSteal()) { return; } } catch (Exception ex) { ex.Log(); } try { switch (args.OrbwalkingMode) { case Mode.Combo: Combo(); break; case Mode.LaneClear: LaneClear(); break; case Mode.Harass: Harass(); break; case Mode.LastHit: LastHit(); break; case Mode.Freeze: Freeze(); break; case Mode.Flee: // SDK has no flee rite? if (args.Orbwalker == Orbwalker.SDKOrbwalker) { Variables.Orbwalker.Move(Game.CursorPos); } Flee(); break; case Mode.None: break; default: throw new ArgumentOutOfRangeException(nameof(args.OrbwalkingMode), args.OrbwalkingMode, null); } } catch (Exception ex) { ex.Log(); } }
/// <summary> /// The function executing on <see cref="E:Core.GameUpdate"/> /// </summary> /// <param name="args">The event data</param> protected virtual void Automated(GameUpdateEventArgs args) { }
/// <summary> /// Executed when the game engine updates, contains useful event data /// </summary> /// <param name="args">The custom event data</param> protected virtual void GameUpdate(GameUpdateEventArgs args) { }
/// <summary> /// The <see cref="E:CoreGameUpdate"/> method fired when game engine updates /// </summary> /// <param name="args">The <see cref="GameUpdateEventArgs"/> instance</param> protected internal virtual void CoreGameUpdate(GameUpdateEventArgs args) => CurrentOrbwalker = args.Orbwalker;
public void Update(GameUpdateEventArgs e) { float oldValue = this.value; const float firstAutoStepDelay = 0.1f; const float autoStepDelay = 0.04f; const float stepSize = 0.05f; const float autoStepSize = 0.05f; #region decrease if (this.decrease.Hit) { this.nextAutoLeft = firstAutoStepDelay; } if (this.decrease.Active) { this.nextAutoLeft -= e.ElapsedTimeF; if (this.nextAutoLeft <= 0) { this.isMovingLeft = true; this.nextAutoLeft = autoStepDelay; this.value -= autoStepSize; } } if (this.decrease.Released) { if (!this.isMovingLeft) { this.value -= stepSize; } this.isMovingLeft = false; } #endregion #region increase if (this.increase.Hit) { this.nextAutoRight = firstAutoStepDelay; } if (this.increase.Active) { this.nextAutoRight -= e.ElapsedTimeF; if (this.nextAutoRight <= 0) { this.isMovingRight = true; this.nextAutoRight = autoStepDelay; this.value += autoStepSize; } } if (this.increase.Released) { if (!this.isMovingRight) { this.value += stepSize; } this.isMovingRight = false; } #endregion if (this.value != oldValue) { this.value = (float)Math.Round(GameMath.Clamp(this.value, 0, 1), 2); } if (this.value != oldValue) { this.updateValue(this.value); } this.drawValue += (this.value - this.drawValue) * 15f * e.ElapsedTimeF; }