private void specialRevertLogic(GameObject g, GameObject sg = null) { if (sg != null) { } PathFollowing p = g.GetComponent <PathFollowing>(); if (p != null) { p.setStateToIdle(); } CollideTrigger ct = g.GetComponent <CollideTrigger>(); if (ct != null) { ct.reset(); } TimeTrigger tt = g.GetComponent <TimeTrigger>(); if (tt != null) { tt.reset(); } DeathTrigger dt = g.GetComponent <DeathTrigger>(); if (dt != null) { dt.reset(); } Health h = g.GetComponent <Health>(); if (h != null) { h.hp = h.startHP; } StarPower sp = g.GetComponent <StarPower>(); if (sp != null) { sp.reset(); } }
/// <summary> /// Checks the current file line, and compares the contents with the previous event. /// </summary> /// <param name="line">The current line we are working with.</param> /// <param name="currentEvent">The current event we are comparing.</param> /// <param name="previousEvent">The previous event we previously managed.</param> /// <param name="notesList">The current event list.</param> /// <param name="starPowersList">The current event list.</param> /// <param name="keyParent">The current key parent.</param> internal void CheckLineContent(string line, ref NoteEvent currentEvent, ref NoteEvent previousEvent, ref List <Note> notesList, ref List <StarPower> starPowersList, string keyParent ) { EventLine eventLine = new EventLine(line); // Create a new INoteable and process the provided line currentEvent = new NoteEvent(Chart, eventLine, keyParent); if (eventLine.Index == 5) { currentEvent.ForcedSolid = true; } if (eventLine.Index == 6) { currentEvent.IsHOPO = true; } // If there are no notes, add it to the list. if (notesList.Count == 0) { notesList.Add(Note.GetCopy(currentEvent)); } // If previous event is null, just make a new copy. if (previousEvent == null) { previousEvent = (NoteEvent)currentEvent.Clone(); } // If the previous starPower is on the same tick and has the same type. if (previousEvent.Tick == currentEvent.Tick && previousEvent.Type == currentEvent.Type) { previousEvent.AppendFret(eventLine); if (previousEvent.Type.Contains("N")) { if (notesList.Count - 1 >= 0) { notesList.RemoveAt(notesList.Count - 1); } notesList.Add(Note.GetCopy(previousEvent)); } else { if (starPowersList.Count - 1 >= 0) { starPowersList.RemoveAt(starPowersList.Count - 1); } starPowersList.Add(StarPower.GetCopy(previousEvent)); } } else { /* Else if it is diferent and is a StarPower type, * add it to the list and re-assign the previous starPower.*/ if (currentEvent.Type.Contains("N")) { currentEvent.Index = notesList.Count; notesList.Add(Note.GetCopy(currentEvent)); } else { currentEvent.Index = starPowersList.Count; starPowersList.Add(StarPower.GetCopy(currentEvent)); } previousEvent = currentEvent; } }
/// <summary> /// Processes all note events. /// </summary> /// <param name="NoteType">The current note type.</param> internal void ProcessNoteEvents(string NoteType) { Dictionary <string, Array> container; Note[] playerNotes; StarPower[] playerSP; string currentLine; currentLine = string.Empty; NoteEvent noteEvent = null; NoteEvent previousNoteEvent = null; List <Note> notesList = new List <Note>(); List <StarPower> starPowersList = new List <StarPower>(); NoteType = NoteType.Replace("[", string.Empty) .Replace("]", string.Empty); while ((_fileScanner.MoveNext()) && (_fileScanner.Current != null)) { currentLine = string.Empty; currentLine = _fileScanner.Current as string; if (!currentLine.Equals(string.Empty)) { // If we reached the end of this section, break out of the loop. if (currentLine.Contains("}")) { break; } // If the line does not contain a '{' character, begin to parse the string. else if (!currentLine.Contains("{")) { CheckLineContent(currentLine, ref noteEvent, ref previousNoteEvent, ref notesList, ref starPowersList, NoteType ); } } } container = new Dictionary <string, Array>(); playerNotes = new Note[notesList.Count]; notesList.CopyTo(playerNotes); playerSP = new StarPower[starPowersList.Count]; starPowersList.CopyTo(playerSP); container.Add("Notes", playerNotes); container.Add("SP", playerSP); Chart.Notes.Add(NoteType, container); }