Exemplo n.º 1
0
/*+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
 * FAST-FORWARD / REWIND
 *+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=*/

    public void FastForwardBalls()
    {
        ClearActiveBalls();

        BallData checkBall   = ballDataList[currentBallIndex];
        float    newSongTime = song.GetSongTimeBeats();

        while (!isFinished && checkBall.notes[0].hitBeat - fallTimeBeats < newSongTime)
        {
            NextBall();
            checkBall = ballDataList[currentBallIndex];
        }
    }
Exemplo n.º 2
0
    public void AttachBallListener(Ball ball)
    {
        ball.onBallCaught += DebugCatch;

        if (!printSpawnDebug)
        {
            return;
        }
        Debug.Log("Spawned " + ball.name + " at beat: " + song.GetSongTimeBeats() + " and position: " + ball.transform.position);
    }
Exemplo n.º 3
0
 void Update()
 {
     if (keyboard.spaceKey.wasPressedThisFrame && active)
     {
         /*
          * NoteData nd = new NoteData();
          *
          * nd.hitPosition = track.GetNearestColumn(mousePos);
          * nd.hitBeat = (int) sc.GetSongTimeBeats();
          * nd.noteDirection = Direction.positive;
          *
          * data.Add(nd);
          */
         Debug.Log("CLICK: " + sc.GetSongTimeBeats());
     }
 }
Exemplo n.º 4
0
    /*+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
     * IDLE
     *+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=*/

    public virtual void OnIdleExit()
    {
        spawnTimeBeats = song.GetSongTimeBeats();
    }
Exemplo n.º 5
0
    void DrawBallDataList(Color color)
    {
        ballList = game.GetBallData();

        GUIStyle s = new GUIStyle(GUI.skin.button);
        GUIStyle b = new GUIStyle(GUI.skin.button);

        s.alignment = TextAnchor.MiddleLeft;
        b.alignment = TextAnchor.MiddleCenter;
        var w      = GUILayout.Width(100);
        var line_h = GUILayout.Height(20);

        float            yPos   = 0;
        List <BallLabel> labels = new List <BallLabel>();

        newBalls.Clear();
        deleteBalls.Clear();
        typeChangeBalls.Clear();

        //Ball Field
        foreach (BallData ball in ballList)
        {
            BallLabel ballLabel = new BallLabel(ball, yPos);

            if (isLabelVisible(ballLabel))
            {
                DrawUILine(dividerLineColor);

                EditorGUILayout.BeginHorizontal();

                yPos += ballLabel.height;

                //________Create New Ball___________________
                ResetColor();
                ChangeColor(Color.green);
                if (GUILayout.Button("+", b, GUILayout.Width(25), line_h))
                {
                    newBalls.Add(ball, ballList.IndexOf(ball));
                }
                ResetColor();

                //________Delete Ball___________________
                ChangeColor(Color.red);
                if (GUILayout.Button("-", b, GUILayout.Width(25), line_h))
                {
                    deleteBalls.Add(ball);
                }
                ResetColor();

                //________Refresh Ball___________________
                ChangeColor(Color.yellow);
                if (GUILayout.Button("R", b, GUILayout.Width(25), line_h))
                {
                    //SongData.DeleteBall(ball);
                    BallData repairedBall;
                    if (ball.GetType() == typeof(SimpleBallData))
                    {
                        repairedBall = SongEdit.CreateBall(typeof(SimpleBallData), ball.notes);
                    }
                    else
                    {
                        Debug.Log("its a bounce ball");
                        repairedBall = SongEdit.CreateBall(typeof(BounceBallData), ball.notes);
                    }

                    ballList.Add(repairedBall);

                    SongEdit.DeleteBallAndNotes(ball);
                    ballList.Remove(ball);

                    game.SortBalls();
                }
                ResetColor();

                //________Ball Type___________________
                GUILayout.Label("type:", GUILayout.Width(40), line_h);
                BallTypes ball_type = (BallTypes)EditorGUILayout.EnumPopup("", ball.type, s, w);
                if (ball_type != ball.type)
                {
                    ball.type = ball_type;     // if new type selected, set equal to type
                    typeChangeBalls.Add(ball, ballList.IndexOf(ball));
                    EditorUtility.SetDirty(ball);
                }

                //________Enabled / Disabled Field___________________
                //ball.enabled = GUILayout.Toggle(ball.enabled, "Enabled", s, w);

                if (Application.isPlaying)
                {
                    float timeDiff = ball.notes[0].hitBeat - songController.GetSongTimeBeats();

                    if (Mathf.Abs(timeDiff) < 4.0f && timeDiff > 0.0f)
                    {
                        ChangeColor(Color.cyan);
                    }
                    else if (Mathf.Abs(timeDiff) < 2.0f)
                    {
                        ChangeColor(Color.yellow);
                    }

                    EditorGUILayout.ObjectField(ball, typeof(Object), true);

                    ResetColor();
                }

                EditorGUILayout.EndHorizontal();

                DrawOptions(ball);

                if (ball.notes != null)
                {
                    int numNotes = DrawNotes(ball);
                }
            }
            else
            {
                GUILayout.Space(60);
                yPos += 60;
            }
        }
        // --------- END BALL ITERATION --------------------------

        foreach (KeyValuePair <BallData, int> pair in newBalls)
        {
            BallData new_ball = SongEdit.CreateBall(typeof(SimpleBallData));
            ballList.Insert(pair.Value + 1, new_ball);
        }

        foreach (BallData ball in deleteBalls)
        {
            SongEdit.DeleteBallAndNotes(ball);
            ballList.Remove(ball);
        }

        foreach (KeyValuePair <BallData, int> pair in typeChangeBalls)
        {
            BallData ball     = pair.Key;
            BallData new_ball = SongEdit.ChangeBallType(ball, ball.type); // create new ball and copy info
            ballList.Insert(pair.Value, new_ball);

            SongEdit.DeleteBallAndNotes(ball);
            ballList.Remove(ball);
        }
    }
Exemplo n.º 6
0
/*+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
 * SONG CONTROLS
 *+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=*/

    void DrawNavSettings()
    {
        GUILayout.BeginArea(navBarSection);
        GUILayout.Label("Navigation");

        game           = FindObjectOfType <Game>();
        songController = FindObjectOfType <SongController>();

        GUILayout.BeginHorizontal();
        if (songData == null)
        {
            songData = game.GetEditorSong();
        }
        SongData newData = (SongData)EditorGUILayout.ObjectField(songData, typeof(SongData), true, GUILayout.MaxWidth(187));

        if (songData != newData)
        {
            Debug.Log("CHANGE SONG TO " + newData.name);
            songData = newData;
            game.SetEditorSong(songData);
            game.ReloadBallData();
            EditorUtility.SetDirty(game);
        }
        GUILayout.EndHorizontal();

        if (songData != null)
        {
            EditorGUILayout.BeginHorizontal();

            // Restart Song
            if (GUILayout.Button("<<", GUILayout.Height(navButtonHeight), GUILayout.Width(navButtonWidth)))
            {
                songController.JumpToStart();
            }

            // Go Back 8 beats
            if (GUILayout.Button("<", GUILayout.Height(navButtonHeight), GUILayout.Width(navButtonWidth)))
            {
                songController.JumpToBeat(songController.GetSongTimeBeats() - 8);
            }

            // Pause/Play
            if (GUILayout.Button("Play", GUILayout.Height(navButtonHeight), GUILayout.Width(navButtonWidth)))
            {
                songController.JumpToBeat(jumpToTime);
            }

            // Go Forward 8 beats
            if (GUILayout.Button(">", GUILayout.Height(navButtonHeight), GUILayout.Width(navButtonWidth)))
            {
                songController.JumpToBeat(songController.GetSongTimeBeats() + 8);
            }

            // Go to end of song
            if (GUILayout.Button(">>", GUILayout.Height(navButtonHeight), GUILayout.Width(navButtonWidth)))
            {
                songController.JumpToEnd();
            }

            // Current Beat
            if (Application.isPlaying)
            {
                GUILayout.Label("Beat: " + songController.GetSongTimeBeats(), GUILayout.Width(100));
            }

            // Song Slider
            jumpToTime = (int)EditorGUILayout.Slider((float)jumpToTime, songData.startBeat, songData.endBeat);

            EditorGUILayout.EndHorizontal();
        }
        GUILayout.EndArea();
    }