コード例 #1
0
ファイル: StageController.cs プロジェクト: uulltt/NitoriWare
    void scheduleNextInterruptionAudio(float timeToPlay)
    {
        Stage.Interruption interruption = interruptionQueue.Peek();
        interruption.scheduledPlayTime = timeToPlay;

        if (interruption.audioSource == null || interruption.audioClip == null)
        {
            return;
        }

        interruption.audioSource.Stop();
        interruption.audioSource.clip = interruption.audioClip;
        if (interruption.applySpeedChangeAtEnd)
        {
            interruption.audioSource.pitch = getSpeedMult();
        }
        else
        {
            interruption.audioSource.pitch = getSpeedMult(getChangedSpeed(interruption));
        }
        if (!muteMusic)
        {
            AudioHelper.playScheduled(interruption.audioSource, timeToPlay - Time.time);
        }
    }
コード例 #2
0
ファイル: StageController.cs プロジェクト: uulltt/NitoriWare
    void updateToInterruption()
    {
        Stage.Interruption interruption = interruptionQueue.Dequeue();
        if (interruption.animation != AnimationPart.Idle)
        {
            setAnimationPart(interruption.animation);
        }

        if (!interruption.applySpeedChangeAtEnd)
        {
            speed = getChangedSpeed(interruption);
        }
        Time.timeScale = getSpeedMult();

        if (interruptionQueue.Count != 0)
        {
            scheduleNextInterruptionAudio(interruption.scheduledPlayTime + (interruption.beatDuration * beatLength));
        }
        else
        {
            if (interruption.applySpeedChangeAtEnd)
            {
                speed = getChangedSpeed(interruption);
            }
            introSource.pitch = getSpeedMult();
            if (!muteMusic && interruption.beatDuration > 0f)
            {
                AudioHelper.playScheduled(introSource, (interruption.scheduledPlayTime + (interruption.beatDuration * beatLength)) - Time.time);
            }
        }
    }
コード例 #3
0
ファイル: StageController.cs プロジェクト: uulltt/NitoriWare
    void invokeInterruptions()
    {
        interruptionQueue = new Queue <Stage.Interruption>();
        Stage.Interruption[] interruptions = stage.getInterruptions(microgameCount);
        float interruptionBeats            = 0f;

        int endSpeed = speed;

        for (int i = 0; i < interruptions.Length; i++)
        {
            Stage.Interruption interruption = interruptions[i];
            interruptionQueue.Enqueue(interruption);
            invokeAtBeat("updateToInterruption", interruptionBeats);

            if (i == 0)
            {
                scheduleNextInterruptionAudio(outroPlayTime + (beatLength * 4f));
            }

            endSpeed           = getChangedSpeed(endSpeed, interruption);
            interruptionBeats += interruption.beatDuration;
        }
        animationStartTime += interruptionBeats * beatLength;
        introSource.pitch   = getSpeedMult(endSpeed);
    }
コード例 #4
0
    public static Stage.Interruption[] add(this Stage.Interruption[] interruptions, Stage.Interruption interruption)
    {
        Stage.Interruption[] newInterruptions = new Stage.Interruption[interruptions.Length + 1];
        for (int i = 0; i < interruptions.Length; i++)
        {
            newInterruptions[i] = interruptions[i];
        }

        newInterruptions[interruptions.Length] = interruption;
        return(newInterruptions);
    }
コード例 #5
0
ファイル: StageController.cs プロジェクト: uulltt/NitoriWare
    int getChangedSpeed(int speed, Stage.Interruption interruption)
    {
        switch (interruption.speedChange)
        {
        case (Stage.Interruption.SpeedChange.SpeedUp):
            return(Mathf.Clamp(speed + 1, 1, MAX_SPEED));

        case (Stage.Interruption.SpeedChange.ResetSpeed):
            return(1);

        case (Stage.Interruption.SpeedChange.Custom):
            return(Mathf.Clamp(stage.getCustomSpeed(microgameCount, interruption), 1, MAX_SPEED));

        default:
            return(speed);
        }
    }
コード例 #6
0
ファイル: StageController.cs プロジェクト: uulltt/NitoriWare
 int getChangedSpeed(Stage.Interruption interruption)
 {
     return(getChangedSpeed(speed, interruption));
 }