private void Drums_KeyPress(object sender, KeyPressEventArgs e) { switch (e.KeyChar.ToString()) { case "1": Bass.PerformClick(); break; case "2": Snare.PerformClick(); break; case "3": FloorTom.PerformClick(); break; case "4": Tom1.PerformClick(); break; case "5": Tom2.PerformClick(); break; case "6": Crash.PerformClick(); break; case "0": Hats.PerformClick(); break; } }
public static void init() { keyList = new List <Pair <Key, Drum> >(); keyMap = new Dictionary <Key, Drum>(); //The 3 instruments are instatiated using their image file and sound file. snare = new Snare( new Uri(@"../../Images/poop.png", UriKind.Relative), new Uri(@"../../sounds/snare.mp3", UriKind.Relative)); bass = new Bass( new Uri(@"../../Images/poop.png", UriKind.Relative), new Uri(@"../../sounds/kick.wav", UriKind.Relative)); highHat = new HighHat( new Uri(@"../../Images/poop.png", UriKind.Relative), new Uri(@"../../sounds/highhat_open.mp3", UriKind.Relative)); //Each instrument is then mapped to 2 keys //the pairs are put in a list to easily remove/replace when rebinding keyList.Add(new Pair <Key, Drum>(Key.A, snare)); keyList.Add(new Pair <Key, Drum>(Key.S, snare)); //the pairs are put in a map to easily play the correct sound keyMap.Add(Key.A, snare); keyMap.Add(Key.S, snare); keyList.Add(new Pair <Key, Drum>(Key.G, highHat)); keyList.Add(new Pair <Key, Drum>(Key.H, highHat)); keyMap.Add(Key.G, highHat); keyMap.Add(Key.H, highHat); keyList.Add(new Pair <Key, Drum>(Key.C, bass)); keyList.Add(new Pair <Key, Drum>(Key.Space, bass)); keyMap.Add(Key.C, bass); keyMap.Add(Key.Space, bass); }
/// <summary> /// Generates a string representation of a player's trap spell inventory. /// </summary> /// <returns>A list of trap spells possessed by the player.</returns> public override string ToString() { var sb = new StringBuilder(); sb.AppendLine("Set Traps:"); sb.AppendLine($" Dart => {Dart?.ToString() ?? "Empty"}"); sb.AppendLine($" Flash => {Flash?.ToString() ?? "Empty"}"); sb.AppendLine($" Repeating Dart => {RepeatingDart?.ToString() ?? "Empty"}"); sb.AppendLine($" Snare => {Snare?.ToString() ?? "Empty"}"); sb.AppendLine($" Spear => {Spear?.ToString() ?? "Empty"}"); sb.AppendLine($" Poison Dart => {PoisonDart?.ToString() ?? "Empty"}"); sb.AppendLine($" Death => {Death?.ToString() ?? "Empty"}"); sb.AppendLine($" Sleep => {Sleep?.ToString() ?? "Empty"}"); sb.AppendLine($" Bladestorm => {Bladestorm?.ToString() ?? "Empty"}"); return(sb.ToString()); }
public override void Initialize() { this._bass = new BassDrum(this.x, this.y); Level.Add((Thing)this._bass); this._snare = new Snare(this.x, this.y); Level.Add((Thing)this._snare); this._hat = new HiHat(this.x, this.y); Level.Add((Thing)this._hat); this._lowTom = new LowTom(this.x, this.y); Level.Add((Thing)this._lowTom); this._crash = new CrashCymbal(this.x, this.y); Level.Add((Thing)this._crash); this._medTom = new MediumTom(this.x, this.y); Level.Add((Thing)this._medTom); this._highTom = new HighTom(this.x, this.y); Level.Add((Thing)this._highTom); this._bass.position = this.position; this._bass.depth = this.depth + 1; this._snare.position = this.position + new Vec2(10f, -7f); this._snare.depth = this.depth; this._hat.depth = this.depth - 1; this._hat.position = this.position + new Vec2(13f, -11f); this._lowTom.depth = this.depth - 1; this._lowTom.position = this.position + new Vec2(-9f, -5f); this._crash.depth = this.depth; this._crash.position = this.position + new Vec2(-15f, -15f); this._medTom.depth = this.depth + 3; this._medTom.position = this.position + new Vec2(-8f, -12f); this._highTom.depth = this.depth + 3; this._highTom.position = this.position + new Vec2(7f, -12f); this._netBassDrum.function = new NetSoundEffect.Function(((Drum)this._bass).Hit); this._netSnare.function = new NetSoundEffect.Function(((Drum)this._snare).Hit); this._netHat.function = new NetSoundEffect.Function(((Drum)this._hat).Hit); this._netHatAlternate.function = new NetSoundEffect.Function(((Drum)this._hat).AlternateHit); this._netLowTom.function = new NetSoundEffect.Function(((Drum)this._lowTom).Hit); this._netMediumTom.function = new NetSoundEffect.Function(((Drum)this._medTom).Hit); this._netHighTom.function = new NetSoundEffect.Function(((Drum)this._highTom).Hit); this._netCrash.function = new NetSoundEffect.Function(((Drum)this._crash).Hit); this._netThrowStick.function = new NetSoundEffect.Function(this.ThrowStick); }