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); } }
public MusicSettingsHud(GameState game) { this.game = game; this.lightnessBar = new Scrollbar(new Vector3(-16, 2, 0), 0.6f, f => { }, KeyboardKeyAction.FromKey(Key.Number1), KeyboardKeyAction.FromKey(Key.Number2)); this.tensionBar = new Scrollbar(new Vector3(-16, 4.5f, 0), 0.8f, f => { }, KeyboardKeyAction.FromKey(Key.Number3), KeyboardKeyAction.FromKey(Key.Number4)); this.healthBar = new Scrollbar(new Vector3(-16, 7f, 0), 0.8f, f => { }, KeyboardKeyAction.FromKey(Key.Number5), KeyboardKeyAction.FromKey(Key.Number6)); this.Parameters = MusicParameters.Default; }
public MusicManager() { AudioManager.Initialize(); this.ambient = new OggStream("data/music/ambient1.ogg"); //this.Piano = new SimpleInstrument("data/music/Piano.pp.C4_2.ogg", 261.6); this.Piano = new Piano(); //this.Violin = new SRInstrument("data/music/ViolinGis3-loop.ogg", "data/music/ViolinGis3-decay.ogg", 207.7); //this.Strings = new SimpleInstrument("data/music/StringsC5.ogg", 523.3); //this.Strings = new SRInstrument("data/music/StringsC5-sustain.ogg", "data/music/StringsC5-decay.ogg", 523.3); string filename = "data/music/DarkAndLight.bmc"; //Console.WriteLine("Parsing " + filename); this.composition = new BranchingMusicalComposition(filename); this.ambient.IsLooped = true; this.ambient.Prepare(); this.Parameters = MusicParameters.Default; }
public RenderParameters(MusicParameters musicParameters, Instrument instrument) { this.MusicParameters = musicParameters; this.Instrument = instrument; }
/// <summary> /// Copy values from another instance of this class /// </summary> /// <param name="parameters"></param> public void CopyFrom(MusicParameters parameters) { volume = parameters.volume; }
public MusicParameters(MusicParameters parameters) { volume = parameters.volume; }