예제 #1
0
    private Speaker GetSpeaker(IDialogueContext context)
    {
        if (context.OnlyPlayer())
        {
            return(speakers[playerSpeaker]);
        }

        if (context.ProceedToNextSpeaker())
        {
            return(speakers[++currentSpeakerIndex % speakerCount]);
        }

        return(speakers[currentSpeakerIndex % speakerCount]);
    }
예제 #2
0
    private Speaker GetSpeaker(IDialogueContext context)
    {
        if (context.OnlyPlayer())
        {
            // If the current context also proceeds to next speaker then increment after returning the player speaker index.
            return(speakers[(context.ProceedToNextSpeaker()) ? playerSpeaker++ : playerSpeaker]);
        }

        if (context.ProceedToNextSpeaker())
        {
            return(speakers[currentSpeakerIndex++ % speakerCount]);
        }

        return(speakers[currentSpeakerIndex % speakerCount]);
    }