示例#1
0
        public void Draw(double currentBeat, Note prevNote, NoteType type = NoteType.All)
        {
            if (!texturesLoaded)
            {
                GetNoteObject(prevNote);
            }

            var curDist = (float)Globals.GetDistAtBeat(currentBeat);
            var beatLoc = (float)Globals.GetDistAtBeat(BeatLocation);

            bool regen = !isScaleSet || (lastSpeed != GameState.ScrollSpeed);

            switch (Type)
            {
            case NoteType.Step:
            case NoteType.Motion:
                Draw(currentBeat);
                break;

            case NoteType.Hold:
                if (regen)
                {
                    quadObject.SetVerts(this, prevNote);
                    quadObject.transform.position = new Vector3(quadObject.XOffset, -0.0001f, beatLoc - curDist - quadObject.YOffset);
                    lastSpeed  = GameState.ScrollSpeed;
                    isScaleSet = true;
                }
                quadObject.transform.position = quadObject.transform.position.ModZ(beatLoc - curDist - quadObject.YOffset);
                break;

            case NoteType.Slide:
                if (regen)
                {
                    quadObject.SetVerts(this, prevNote);
                    quadObject.transform.position = new Vector3(quadObject.XOffset, -0.0001f, beatLoc - curDist - quadObject.YOffset);
                    lastSpeed  = GameState.ScrollSpeed;
                    isScaleSet = true;
                }
                quadObject.transform.position = quadObject.transform.position.ModZ(beatLoc - curDist - quadObject.YOffset);
                break;

            case NoteType.Shuffle:
                if (regen)
                {
                    int   minLane, maxLane;
                    float flip, center;
                    if (this.IsComplexShuffle)
                    {
                        minLane = LaneIndex < EndLaneIndex ? LaneIndex : EndLaneIndex;
                        maxLane = (LaneIndex + Width) < (EndLaneIndex + EndWidth) ? (EndLaneIndex + EndWidth) : (LaneIndex + Width);
                        flip    = LaneIndex > prevNote.LaneIndex ? -1.0f : 1.0f;
                    }
                    else
                    {
                        minLane = LaneIndex < prevNote.LaneIndex ? LaneIndex : prevNote.LaneIndex;
                        maxLane = (LaneIndex + Width) < (prevNote.LaneIndex + prevNote.Width) ? (prevNote.LaneIndex + prevNote.Width) : (LaneIndex + Width);
                        flip    = LaneIndex > prevNote.LaneIndex ? 1.0f : -1.0f;
                    }
                    center = (float)((minLane - Globals.NumLanes / 2 + (maxLane - minLane) / 2.0f) * Globals.BeatToWorldXUnits);
                    noteObject.transform.position   = new Vector3(center, 0, -5);
                    noteObject.transform.localScale = new Vector3(flip * Globals.BaseShuffleScale / 16.0f * (maxLane - minLane), (float)(Globals.BaseNoteZScale * GameState.ScrollSpeed * Globals.ShuffleNoteMultiplier), 1);
                    quadObject.SetVerts(this, prevNote);
                    quadObject.transform.position = new Vector3(quadObject.XOffset, -0.0001f, -10);
                    lastSpeed  = GameState.ScrollSpeed;
                    isScaleSet = true;
                }
                float noteHeight = (float)(Globals.BaseNoteZScale * lastSpeed * Globals.ShuffleNoteMultiplier);
                //noteObject.transform.position = noteObject.transform.position.ModZ(beatLoc - curDist + (noteHeight - 0.5f) / 2);
                noteObject.transform.position = noteObject.transform.position.ModZ(beatLoc - curDist + noteHeight / 2);
                quadObject.transform.position = quadObject.transform.position.ModZ(beatLoc - curDist - quadObject.YOffset);
                break;

            default:
                break;
            }
        }