public override void HitNote(SongData.NoteSet i) { foreach (ISound s in tracks) { s.Volume = 1.0f; } }
/// <summary> /// This is the function to be evoked on a NoteWasMissed event. /// </summary> /// <param name="ns">The note set that was missed.</param> void player_NoteWasMissed(SongData.NoteSet ns) { if (ns.NumMissed == 1 && (ns.NumHit + ns.NumMissed) > 1) // You made it almost there, strum that shiz, { ns.Strum(); // unless of course you suck harder than expected and missed a single note... } }
public override void HitNote(SongData.NoteSet i) { foreach (SoundEffectInstance e in soundEffectInstances) { e.Volume = 1.0F; } }
public override void HitNote(SongData.NoteSet note) { //TODO: Add possible skill to increase the amount of xp earned from hitting a note correctly. //if (NoteWasHit != null)....for some reason this causes the build to fail, even though the same statement exists in Player.cs..... this.XpManager.addExperience(100L); base.HitNote(note); }
public override void MissedNote(SongData.NoteSet i) { // 4.0change - TODO - only mute the guitar track (usually 5 + 8*i, but not always) foreach (ISound s in tracks) { s.Volume = 0.0f; } //for(int j = 5; j < tracks.Count; j+=8) // ((ISound)tracks[j]).Volume = 0; // MAGIC NUMBER! (It's the guitar track) }
/// <summary> /// Consitutes a missed note. /// </summary> public virtual void DealDamage(SongData.NoteSet note) { // Hack for the rpg stuff bool someExist = false; for (int i = 0; i < note.visible.Length; i++) { someExist |= !(note.visible[i] == SongData.NoteSet.VIS_STATE.INVISIBLE); } if (!someExist) { return; } noteStreak = 0; missedStreak++; antiMultiplier = Math.Min(missedStreak / 10 + 1, 4); multiplier = 1; notesMissed += note.NumMissed; lastMissType = (note.type ^ goodHits); if (notesMissed == 0) { notesMissed = 1; } health -= Math.Max(1, note.NumMissed) * antiMultiplier * 1.0F; // Realistically the sounds should be in the InputSkin class // or a new InputAudio class, allowing different instruments // to sound differently. Due to time constraints we're going // to hack it here for now. if (Input.Strummed) { //health -= 0.5f; //MissedNoteSound(); } // If dead, trigger fail event if (NoteWasMissed != null) { NoteWasMissed(note); } if (health <= 0) { ChangeState(RhythmGame.GameStateType.SongFail); } }
/// <summary> /// Consitutes a hit note. /// </summary> public virtual void HitNote(SongData.NoteSet note) { // Hack for the rpg stuff bool someExist = false; for (int i = 0; i < note.visible.Length; i++) { someExist |= !(note.visible[i] == SongData.NoteSet.VIS_STATE.INVISIBLE); } if (!someExist) { return; } note.Kill(); noteStreak += note.NumHit; missedStreak = 0; notesHit += note.NumHit; // Modify a multiplier depending on streak. multiplier = (uint)Math.Min(noteStreak / 10 + 1, 4); antiMultiplier = 1; // Modify score according to modifier. score += (uint)(noteWorth * multiplier * note.NumHit); // Gain some health back health += 0.5F * multiplier; if (health > health_max) { health = health_max; } if (NoteWasHit != null) { NoteWasHit(note); } }
void player_NoteWasHit(SongData.NoteSet obj) { notesHit++; player.NoteWorth = (uint)(baseNoteWorth + 3 * notesHit * calculateModifier()); }
void player_NoteWasMissed(SongData.NoteSet obj) { notesHit = 0; }
public bool IsInNotePadding(SongData.NoteSet note) { // was 100 return(Math.Abs(_songTime.TotalMilliseconds - note.time) < Pillow); // 4.0change - Pillow was 190 }
public bool BurningRange(SongData.NoteSet note) { return(note.end > _songTime.TotalMilliseconds + POST_SONG_BUFFER); }
public override void Update(GameTime gameTime) { base.Update(gameTime); if (((RhythmGame)Game).State == RhythmGame.GameStateType.Paused) { if (Input.OtherKeyPressed(OtherKeyType.Select)) { ChangeState(RhythmGame.GameStateType.Running); return; } } if (((RhythmGame)Game).State != RhythmGame.GameStateType.Running) { return; } bool onLastNote = false; if (Notes.SongDone) { if (waitTimer > TimeSpan.Zero) { waitTimer -= gameTime.ElapsedGameTime; onLastNote = true; } else { ChangeState(RhythmGame.GameStateType.SongSuccess); return; } } if (Input.OtherKeyPressed(OtherKeyType.Pause)) { ChangeState(RhythmGame.GameStateType.Paused); return; } SongData.NoteSet[] noteSet = Notes.NoteSet; int beginIndex = Notes.CurrentBeginIndex; int endIndex = Notes.CurrentEndIndex; ulong pressed = Input.FullPressed; ulong held = Input.FullHeld; if (onLastNote) { beginIndex--; endIndex--; } int noteRange = (endIndex - beginIndex); bool splitNotes = noteRange > 1; bool shouldIncrement = false; bool nextIsValid = Notes.ValidRange(Notes.NextIndex); if (Input.Strummed && nextIsValid) { bool wasBurning = false; for (int noteIdx = beginIndex; noteIdx <= endIndex; noteIdx++) { SongData.NoteSet note = noteSet[noteIdx]; if (note.burning != 0L) { wasBurning = true; } note.burning = 0L; } if (wasBurning) { Notes.IncrementPastEnd(); } } for (int noteIdx = beginIndex; noteIdx <= endIndex; noteIdx++) { SongData.NoteSet note = noteSet[noteIdx]; if (Input.Strummed && (note.burning != 0L) && !Notes.IsInNotePadding(note)) { note.burning = 0L; shouldIncrement = true; continue; } if (Notes.ValidRange() || (Notes.BurningRange() && (note.burning != 0L))) { if (!Notes.BurningRange() && note.burning != 0L) { shouldIncrement = true; continue; } if (Input.Strummed) { note.Strum(); } note.AddPressedGuitar(_instrument, held); goodHits = note.IsGood(_instrument, note.IsHOPO(_instrument)); //Notes.NoteIndex > 0 && noteSet[Notes.NoteIndex - 1].visible[0] == SongData.NoteSet.VIS_STATE.INVISIBLE); bool burningBetter = (note.burning != 0L) && (goodHits > note.burning); bool trueHit = goodHits > 0 && note.burning == 0L; if (trueHit || burningBetter) { HitNote(note); // Another hack... don't deal damage for burning hopos. bool burningHOPO = (note.length <= 0) && note.IsHOPO(_instrument); if (!burningHOPO && note.NumMissed > 0) { DealDamage(note); } if (note.length > 0) { note.burning = goodHits; } else { shouldIncrement = true; } note.exploding = goodHits; } else if (note.burning != 0L) { if (Notes.BurningRange() && (goodHits & note.type) != 0L) { note.burning &= goodHits; BurnNote(note, gameTime); //note.exploding = true; } else { note.burning = 0L; shouldIncrement = true; } } else if (Notes.LateRange()) { DealDamage(note); //missedNote = note; // 4.0change for (int i = 0; i < note.visible.Length; i++) { if (note.visible[i] == SongData.NoteSet.VIS_STATE.VISIBLE) { note.visible[i] = SongData.NoteSet.VIS_STATE.GREYED_OUT; } } shouldIncrement = true; } held = (held ^ goodHits); } else { if (Input.Strummed && !note.IsHOPO(_instrument)) { if (noteIdx == 0 || !noteSet[noteIdx - 1].IsHOPO(_instrument)) { // 4.0change - Additionally, don't penalize when strumming immediately after a HOPO note if (noteIdx == 0 || !(noteSet[noteIdx - 1].IsHOPO(_instrument) && Notes.LateRange(noteIdx - 1))) { DealDamage(note); } } //missedNote = note; // 4.0change } } } if (shouldIncrement) { Notes.IncrementPastEnd(); } }
void player_NoteWasMissed(SongData.NoteSet obj) { Console.WriteLine("NoteWasMissed"); sounds["fiba6"].Play(.25f, 0, 0); // 4.0change }
public abstract void HitNote(SongData.NoteSet i);
public abstract void MissedNote(SongData.NoteSet i);
public override void Update(GameTime gameTime) { IPlayerService playerService = (IPlayerService)Game.Services.GetService(typeof(IPlayerService)); NoteManager notes = playerService.Notes; if (notes.SongTime.TotalMilliseconds < 0) { fret_y_1 = -(6 + (float)(notes.SongTime.TotalMilliseconds / 500) % 12.0f); if (fret_y_1 > 0) { fret_y_2 = fret_y_1 - 6.0f; } else { fret_y_2 = fret_y_1 + 6.0f; } } else { fret_y_1 = -(float)(notes.SongTime.TotalMilliseconds / 500) % 12.0f; fret_y_1 += 6.0f; if (fret_y_1 > 0) { fret_y_2 = fret_y_1 - 6.0f; } else { fret_y_2 = fret_y_1 + 6.0f; } } SongDataIO.SongData.NoteSet[] noteSet = notes.NoteSet; if (noteSet != null) { for (int i = first_note; i < noteSet.Length; i++) { SongData.NoteSet n = noteSet[i]; float y = (float)(n.time - notes.SongTime.TotalMilliseconds - 100) / 500f - 2.3f; if (y > 3) { break; } for (ulong k = 1, trueId = 0; k <= noteSet[i].type; k *= 2, trueId++) { if (n.length > 0) { ulong id = noteSet[i].type & k; if (id == 0 || trueId > 4) { continue; } id = trueId; if ((n.burning & k) != 0) { float note_length = n.length / 500f; long_pressed_vis[id] = true; float x = (float)(-0.6 + id * 0.3); if (y + note_length < -2.3f) { n.exploding = 0L; continue; } float d_y = y + note_length; float s_y = -2.20f; long_pressed[id].Destination = new Vector3(4f * x, 4f * d_y, 0); long_pressed[id].Source = new Vector3(4f * x, 4f * s_y, 0); long_pressed[id].Update(gameTime); } } } } } base.Update(gameTime); }
private void DrawNotes(NoteManager notes) { SongDataIO.SongData.NoteSet[] noteSet = notes.NoteSet; if (noteSet != null) { for (int i = first_note; i < noteSet.Length; i++) { bool exit_loop = false; bool ceaseExploding = false; SongData.NoteSet n = noteSet[i]; // TODO: Total hack for end of project... should be using isHOPO instead. bool isHopoNote = (noteSet[i].type & (((ulong)1) << 5)) != 0; for (ulong k = 1, trueId = 0; k <= noteSet[i].type; k *= 2, trueId++) { ulong id = noteSet[i].type & k; if (id == 0 || trueId > 4) { continue; } id = trueId; float y = (float)(n.time - notes.SongTime.TotalMilliseconds) / 500f - 2.3f; float x = (float)(-0.6 + id * 0.3); if (y > 3) { exit_loop = true; break; } if (y < -4 && ((n.length / 500f) + y) < -4) { if (notes.SongTime.TotalMilliseconds > 0.0) { first_note = i; } break; } if (n.length > 0) { //GraphicsDevice.VertexDeclaration = textureDeclaration; // 4.0change longEffect.World = Matrix.Identity * Matrix.CreateScale(0.1f, 1.0f, 1.0f) * Matrix.CreateTranslation(x, y, 0.0f) * Matrix.CreateRotationX(rotation); if ((n.burning & k) == 0 && (n.visible[id] == SongData.NoteSet.VIS_STATE.VISIBLE || !n.HasStrummed())) { longEffect.Texture = long_note_color; float long_end = n.length / 500f; // btftest long_note[0] = new VertexPositionTexture(new Vector3(-1, long_end, 0.015f), new Vector2(0, 0)); long_note[1] = new VertexPositionTexture(new Vector3(1, long_end, 0.015f), new Vector2(1, 0)); long_note[2] = new VertexPositionTexture(new Vector3(-1, 0f, 0.015f), new Vector2(0, 1)); long_note[3] = new VertexPositionTexture(new Vector3(1, 0f, 0.015f), new Vector2(1, 1)); // Begin effect and draw for each pass //longEffect.Begin(); foreach (EffectPass pass in longEffect.CurrentTechnique.Passes) { pass.Apply(); /*GraphicsDevice.DrawUserPrimitives<VertexPositionTexture> * (PrimitiveType.TriangleFan, long_note, 0, 2); * pass.End();*/ // 4.0change GraphicsDevice.DrawUserPrimitives <VertexPositionTexture> (PrimitiveType.TriangleStrip, long_note, 0, 2); // 4.0change: strip or list? Include long_note? } //longEffect.End(); } } if (n.visible[id] == SongData.NoteSet.VIS_STATE.INVISIBLE) { if ((n.exploding & k) != 0) { explosion.AddParticles(new Vector2(260 + 70 * id, 520), GetDefaultColor(id)); ceaseExploding = true; } continue; } if (isHopoNote) { foreach (ModelMesh mesh in hopoModels[id].Meshes) { foreach (BasicEffect be in mesh.Effects) { be.EnableDefaultLighting(); be.Projection = projection; be.View = view; be.World = Matrix.Identity * Matrix.CreateRotationX(1.6f) * mesh.ParentBone.Transform * Matrix.CreateScale(0.2f) * Matrix.CreateTranslation(x, y, 0) * Matrix.CreateRotationX(rotation); } mesh.Draw(); } } else { foreach (ModelMesh mesh in draw_notes[id].Meshes) { foreach (BasicEffect be in mesh.Effects) { be.EnableDefaultLighting(); be.Projection = projection; be.View = view; be.World = Matrix.Identity * Matrix.CreateRotationX(1.6f) * mesh.ParentBone.Transform * Matrix.CreateScale(0.2f) * Matrix.CreateTranslation(x, y, 0) * Matrix.CreateRotationX(rotation); } mesh.Draw(); } } } if (ceaseExploding) { n.exploding = 0L; } if (exit_loop) { break; } } } }
public void BurnNote(SongData.NoteSet note, GameTime gameTime) { score += (uint)(note.NumHit * multiplier * gameTime.ElapsedGameTime.Milliseconds / 10); }