示例#1
0
 public void ChangeEmotion(string speaker, EmotionalResponse response)
 {
     // The overlay only updates the actor currently speaking, and they always face left.
     if (speaker == _currentSpeakerName)
     {
         _portraitView.SetActor(speaker, response.Emotion, Facing.Left);
     }
 }
    private IEnumerator MoveActor(string speaker, EmotionalResponse response, DialoguePortraitView source,
                                  DialoguePortraitView destination)
    {
        yield return(StartCoroutine(source.FadeToEmpty()));

        yield return(StartCoroutine(destination.FadeInActor(speaker, response.Emotion, response.Facing)));

        _slotIndexBySpeaker[speaker] = response.Slot;
    }
    public void ChangeEmotion(string speaker, EmotionalResponse response)
    {
        var slotIndex = _slotIndexBySpeaker[speaker];

        if (slotIndex != response.Slot)
        {
            var currentSlot = _slots[slotIndex];
            var nextSlot    = _slots[response.Slot];

            var currentView = currentSlot.GetComponent <DialoguePortraitView>();
            var nextView    = nextSlot.GetComponent <DialoguePortraitView>();
            StartCoroutine(MoveActor(speaker, response, currentView, nextView));
        }
        else
        {
            var view = FindViewBySpeaker(speaker);
            view.SetActor(speaker, response.Emotion, response.Facing);
        }
    }