Esempio n. 1
0
 public NoteDetails(Note note, Vector3 gridPosition, Note.SlashDirection slashDirection,
                    Note.NoteColor color, float timeToSpawn, bool inverted)
 {
     this.inverted       = inverted;
     this.note           = note;
     this.gridPosition   = gridPosition;
     this.slashDirection = slashDirection;
     this.color          = color;
     this.timeToSpawn    = timeToSpawn;
 }
Esempio n. 2
0
    public void Init(UIAnchor pos, Note.NoteColor newColor, float width, GameObject gameObj)
    {
        Start();

        color = newColor;
        anchor.relativeOffset.x = pos.relativeOffset.x;
        anchor.relativeOffset.y = pos.relativeOffset.y;

        SetColor();
        SetWidth(width);
    }
Esempio n. 3
0
    private void CreateNotes()
    {
        if (noteIndex < notes.Count)
        {
            if (notes[noteIndex].startTotal < timeLapsed + timeOffset)
            {
                pos = spawnPositions[notes[noteIndex].pitchPosition];
                color = notes[noteIndex].color;
                noteWidth = notes[noteIndex].noteDuration * lengthRatio;

                switch(notes[noteIndex].color)
                {
                    case Note.NoteColor.Blue:
                    case Note.NoteColor.Yellow:
                    case Note.NoteColor.Green:
                    case Note.NoteColor.Red:
                    {
                        GameObject newNote = (GameObject)Instantiate(singlePrefab);
                        newNote.transform.parent = noteParent.transform;
                        newNote.transform.localScale = Vector3.one;
                        newNote.name = notesSpawned.ToString() + ": Note (" + notes[noteIndex].color.ToString() + ")";

                        rNote = newNote.GetComponent<RhythmNote>();
                        rNote.Init(pos, color, noteWidth, gameObject);
                        notesSpawned++;
                        break;
                    }
                    default:
                    {
                        GameObject newNote = (GameObject)Instantiate(doublePrefab);
                        newNote.transform.parent = noteParent.transform;
                        newNote.transform.localScale = Vector3.one;
                        newNote.name = notesSpawned.ToString() + ": Note (" + notes[noteIndex].color.ToString() + ")";

                        rNote = newNote.GetComponent<RhythmNote>();
                        rNote.Init(pos, color, noteWidth, gameObject);
                        notesSpawned++;
                        break;
                    }
                }

                noteIndex++;
            }
        }
    }
Esempio n. 4
0
    void OnGUI()
    {
        scrollPos = EditorGUILayout.BeginScrollView (scrollPos);
        {
            songName = EditorGUILayout.TextField ("Song Name: ", songName);
            fileName = songName + ".xml";

            EditorGUILayout.BeginHorizontal();
            {
                if(GUILayout.Button("Load File"))
                {
                    LoadSong(songName);
                }

                if(GUILayout.Button("Save File"))
                {
                    if (notes.Count > 0)
                    {
                        SaveFile(fileName);
                    }
                    else
                    {
                        Debug.Log("Song Not Saved! Please Create Notes First!");
                    }
                }
            }
            EditorGUILayout.EndHorizontal();

            GUILayout.Label("Relative Second To Screen Size Ratio", EditorStyles.boldLabel);
            lengthRatio = EditorGUILayout.Slider(lengthRatio, .001f, 10f);

            EditorGUILayout.Space();

            bNewNote = EditorGUILayout.BeginToggleGroup("Create New Note", bNewNote);
            {
                EditorGUI.indentLevel++;
                pitchPos = EditorGUILayout.IntField("Pitch Position: ", pitchPos);
                color = (Note.NoteColor)EditorGUILayout.EnumPopup("Note Color: ", color);

                startTime = EditorGUILayout.Vector2Field("Start Time\t(Min:Sec): ", startTime);
                startTime.x = Mathf.Floor(startTime.x);
                endTime = EditorGUILayout.Vector2Field("End Time\t(Min:Sec): ", endTime);
                endTime.x = Mathf.Floor(endTime.x);

                startTime.x = Mathf.Clamp(startTime.x, 0f, Mathf.Infinity);
                startTime.y = Mathf.Clamp(startTime.y, 0f, 59.99f);
                endTime.x = Mathf.Clamp(endTime.x, startTime.x, Mathf.Infinity);

                if (startTime.x == endTime.x)
                {
                    endTime.y = Mathf.Clamp(endTime.y, startTime.y, 59.99f);
                }
                else
                {
                    endTime.y = Mathf.Clamp(endTime.y, 0f, 60f);
                }

                startTotal = startTime.x * 60f + startTime.y;
                endTotal = endTime.x * 60f + endTime.y;
                noteDuration = endTotal - startTotal;

                EditorGUILayout.BeginHorizontal();
                {
                    if(GUILayout.Button("Reset Fields"))
                    {
                        pitchPos = 0;
                        startTotal = 0;

                        color = Note.NoteColor.Pause;
                        endTime = Vector2.zero;
                        startTime = Vector2.zero;
                    }

                    if(GUILayout.Button("Save Note"))
                    {
                        Note createdNote = new Note();

                        createdNote.color = color;
                        createdNote.endTime = endTime;
                        createdNote.endTotal = endTotal;
                        createdNote.startTime = startTime;
                        createdNote.startTotal = startTotal;
                        createdNote.pitchPosition = pitchPos;
                        createdNote.noteDuration = noteDuration;

                        notes.Add(createdNote);
                        displayNotes.Add(false);
                        SortNotes();
                    }
                }
                EditorGUILayout.EndHorizontal();

                EditorGUI.indentLevel--;
            }
            EditorGUILayout.EndToggleGroup();

            for(int i = 0; i < notes.Count; i++)
            {
                if (displayNotes.Count != notes.Count)
                {
                    Debug.Log("DisplayNotes != Notes");
                    break;
                }

                displayNotes[i] = EditorGUILayout.Foldout(displayNotes[i], "Note " + (i+1).ToString() + ": ");

                if (displayNotes[i])
                {
                    EditorGUI.indentLevel++;
                    EditorGUILayout.LabelField("Pitch Position: ", notes[i].pitchPosition.ToString());
                    EditorGUILayout.LabelField("Color: ", notes[i].color.ToString());
                    EditorGUILayout.LabelField("Note Duration: ", notes[i].noteDuration.ToString("0.00") + " Seconds");
                    EditorGUILayout.LabelField("Start Time: ", notes[i].startTime.x.ToString() + ":" + notes[i].startTime.y.ToString("00.00"));
                    EditorGUILayout.LabelField("End Time: ", notes[i].endTime.x.ToString() + ":" + notes[i].endTime.y.ToString("00.00"));

                    if (GUILayout.Button("Delete Note"))
                    {
                        notes.RemoveAt(i);
                        displayNotes.RemoveAt(i);
                        break;
                    }

                    EditorGUI.indentLevel--;
                }
            }
        }
        EditorGUILayout.EndScrollView ();
    }
Esempio n. 5
0
 private void CheckColorPress()
 {
     if (otherKeys.Count == 0 && colorKeys.Count > 0)
     {
         if (colorKeys.Contains(blueKey) && colorKeys.Contains(greenKey))
         {
             noteColor = Note.NoteColor.BlueGreen;
             ColorPress(Note.NoteColor.BlueGreen);
         }
         else if (colorKeys.Contains(blueKey) && colorKeys.Contains(redKey))
         {
             noteColor = Note.NoteColor.BlueRed;
             ColorPress(Note.NoteColor.BlueRed);
         }
         else if (colorKeys.Contains(blueKey) && colorKeys.Contains(yellowKey))
         {
             noteColor = Note.NoteColor.BlueYellow;
             ColorPress(Note.NoteColor.BlueYellow);
         }
         else if (colorKeys.Contains(greenKey) && colorKeys.Contains(redKey))
         {
             noteColor = Note.NoteColor.GreenRed;
             ColorPress(Note.NoteColor.GreenRed);
         }
         else if (colorKeys.Contains(greenKey) && colorKeys.Contains(yellowKey))
         {
             noteColor = Note.NoteColor.GreenYellow;
             ColorPress(Note.NoteColor.GreenYellow);
         }
         else if (colorKeys.Contains(redKey) && colorKeys.Contains(yellowKey))
         {
             noteColor = Note.NoteColor.RedYellow;
             ColorPress(Note.NoteColor.RedYellow);
         }
         else if (colorKeys.Contains(blueKey))
         {
             noteColor = Note.NoteColor.Blue;
             ColorPress(Note.NoteColor.Blue);
         }
         else if (colorKeys.Contains(greenKey))
         {
             noteColor = Note.NoteColor.Green;
             ColorPress(Note.NoteColor.Green);
         }
         else if (colorKeys.Contains(redKey))
         {
             noteColor = Note.NoteColor.Red;
             ColorPress(Note.NoteColor.Red);
         }
         else if (colorKeys.Contains(yellowKey))
         {
             noteColor = Note.NoteColor.Yellow;
             ColorPress(Note.NoteColor.Yellow);
         }
     }
     else if (otherKeys.Count > 0 || colorKeys.Count == 0)
     {
         ColorPress(Note.NoteColor.Pause);
     }
 }
Esempio n. 6
0
 public Hit(Vector3 point, Note.NoteColor saberColor)
 {
     this.point      = point;
     this.saberColor = saberColor;
 }
Esempio n. 7
0
 public void AddCollision(Vector3 point, Note.NoteColor saberColor)
 {
     AddCollision(new Hit(point, saberColor));
 }