public void SetCutDirection(Note.CutDirection cutDirection)
    {
        if (hasSetCutDirection)
        {
            return;
        }

        _CutDirection = cutDirection;

        hasSetCutDirection = true;
    }
    public static float?GetAngle(Note.CutDirection cutDirection)
    {
        switch (cutDirection)
        {
        case Note.CutDirection.Right:
            return(0);

        case Note.CutDirection.UpRight:
            return(45);

        case Note.CutDirection.Up:
            return(90);

        case Note.CutDirection.UpLeft:
            return(135);

        case Note.CutDirection.Left:
            return(180);

        case Note.CutDirection.DownLeft:
            return(225);

        case Note.CutDirection.Down:
            return(270);

        case Note.CutDirection.DownRight:
            return(315);

        case Note.CutDirection.Dot:
            return(null);

        default:
            break;
        }

        return(null);
    }
Beispiel #3
0
    public Note AddNote(Note notePrefab, GameObject bombSpherePrefab, GameObject blueCubePrefab, GameObject redCubePrefab, Note.CutDirection cutDirection, Vector2Int coordinate, float time, Note.ItemType type, bool active = false)
    {
        time -= GetMSInBeats(MapCreator._Map._beatsPerMinute, MapCreator._MapInfo.currentDifficulty.oldOffset);

        if (!NotesOnSameTime.ContainsKey(time))
        {
            NotesOnSameTime.Add(time, new List <Note>());
        }

        Note note = Note.Instantiate(notePrefab, bombSpherePrefab, blueCubePrefab, redCubePrefab, cutDirection, coordinate, time, type, active);

        NotesOnSameTime[time].Add(note);

        if (timeStamps.IndexOf(BeatLenghtInSeconds * note._time) < 0)
        {
            timeStamps.Add(BeatLenghtInSeconds * note._time);
        }

        float chunkTime = time.GetNearestRoundedDown(ChunkBeatSize);

        if (!NoteChunks.ContainsKey(chunkTime))
        {
            NoteChunks.Add(chunkTime, new List <Note>());
        }

        NoteChunks[chunkTime].Add(note);

        return(note);
    }
Beispiel #4
0
    public static Note Instantiate(Note notePrefab, GameObject bombSpherePrefab, GameObject blueCubePrefab, GameObject redCubePrefab, Note.CutDirection cutDirection, Vector2Int coordinate, double time, Note.ItemType type, bool active = false)
    {
        Note note = GameObject.Instantiate(notePrefab);

        note.gameObject.transform.SetParent(GameObject.FindGameObjectWithTag("2DGrid").transform);
        if (CutDirectionButton.GetAngle(cutDirection).HasValue)
        {
            note.gameObject.transform.Rotate(Vector3.forward, CutDirectionButton.GetAngle(cutDirection).Value);
        }
        note.gameObject.transform.position = GridGenerator.Instance.Tiles[coordinate].gameObject.transform.position;
        note.Set(time, coordinate.x, coordinate.y, type, cutDirection);


        GameObject arrowCube = null;

        switch (type)
        {
        case Note.ItemType.Red:
            arrowCube = GameObject.Instantiate(redCubePrefab);
            break;

        case Note.ItemType.Blue:
            arrowCube = GameObject.Instantiate(blueCubePrefab);
            break;

        case Note.ItemType.Bomb:
            arrowCube = GameObject.Instantiate(bombSpherePrefab);
            break;

        default:
            break;
        }

        Vector2 arrowCubePos = _3DGridGenerator.Instance.GetCoordinatePosition(coordinate, arrowCube);

        arrowCube.transform.position = new Vector3(arrowCubePos.x, (float)_3DGridGenerator.Instance.GetBeatPosition(time), arrowCubePos.y);
        if (CutDirectionButton.GetAngle(cutDirection).HasValue)
        {
            arrowCube.transform.Rotate(Vector3.back, CutDirectionButton.GetAngle(cutDirection).Value);
        }
        arrowCube.transform.SetParent(GameObject.FindGameObjectWithTag("3DCanvas").transform, false);

        arrowCube.SetActive(false);
        note.arrowCube = arrowCube;
        note.gameObject.SetActive(active);

        return(note);
    }
Beispiel #5
0
 public JsonNote(float _time, double _lineIndex, double _lineLayer, Note.ItemType _type, Note.CutDirection _cutDirection)
 {
     this._time         = _time;
     this._lineIndex    = _lineIndex;
     this._lineLayer    = _lineLayer;
     this._type         = (int)_type;
     this._cutDirection = (int)_cutDirection;
 }