private bool DoTalking(Conversation setup, MinionIdentity new_speaker)
    {
        DebugUtil.Assert(setup != null, "setup was null");
        DebugUtil.Assert((UnityEngine.Object)new_speaker != (UnityEngine.Object)null, "new_speaker was null");
        if ((UnityEngine.Object)setup.lastTalked != (UnityEngine.Object)null)
        {
            setup.lastTalked.Trigger(25860745, setup.lastTalked.gameObject);
        }
        DebugUtil.Assert(setup.conversationType != null, "setup.conversationType was null");
        Conversation.Topic nextTopic = setup.conversationType.GetNextTopic(new_speaker, setup.lastTopic);
        if (nextTopic == null || nextTopic.mode == Conversation.ModeType.End || nextTopic.mode == Conversation.ModeType.Segue)
        {
            return(false);
        }
        Thought thoughtForTopic = GetThoughtForTopic(setup, nextTopic);

        if (thoughtForTopic == null)
        {
            return(false);
        }
        ThoughtGraph.Instance sMI = new_speaker.GetSMI <ThoughtGraph.Instance>();
        if (sMI == null)
        {
            return(false);
        }
        sMI.AddThought(thoughtForTopic);
        setup.lastTopic      = nextTopic;
        setup.lastTalked     = new_speaker;
        setup.lastTalkedTime = GameClock.Instance.GetTime();
        DebugUtil.Assert(lastConvoTimeByMinion != null, "lastConvoTimeByMinion was null");
        lastConvoTimeByMinion[setup.lastTalked] = GameClock.Instance.GetTime();
        Effects component = setup.lastTalked.GetComponent <Effects>();

        DebugUtil.Assert((UnityEngine.Object)component != (UnityEngine.Object)null, "effects was null");
        component.Add("GoodConversation", true);
        Conversation.Mode mode = Conversation.Topic.Modes[(int)nextTopic.mode];
        DebugUtil.Assert(mode != null, "mode was null");
        StartedTalkingEvent startedTalkingEvent = new StartedTalkingEvent();

        startedTalkingEvent.talker = new_speaker.gameObject;
        startedTalkingEvent.anim   = mode.anim;
        StartedTalkingEvent data = startedTalkingEvent;

        foreach (MinionIdentity minion in setup.minions)
        {
            if (!(bool)minion)
            {
                DebugUtil.DevAssert(false, "minion in setup.minions was null");
            }
            else
            {
                minion.Trigger(-594200555, data);
            }
        }
        setup.numUtterances++;
        return(true);
    }
    private Thought GetThoughtForTopic(Conversation setup, Conversation.Topic topic)
    {
        if (string.IsNullOrEmpty(topic.topic))
        {
            DebugUtil.DevAssert(false, "topic.topic was null");
            return(null);
        }
        Sprite sprite = setup.conversationType.GetSprite(topic.topic);

        if ((UnityEngine.Object)sprite != (UnityEngine.Object)null)
        {
            Conversation.Mode mode = Conversation.Topic.Modes[(int)topic.mode];
            return(new Thought("Topic_" + topic.topic, null, sprite, mode.icon, mode.voice, "bubble_chatter", mode.mouth, DUPLICANTS.THOUGHTS.CONVERSATION.TOOLTIP, true, TuningData <Tuning> .Get().speakTime));
        }
        return(null);
    }
Esempio n. 3
0
    public override Conversation.Topic GetNextTopic(MinionIdentity speaker, Conversation.Topic lastTopic)
    {
        if (lastTopic == null)
        {
            return(new Conversation.Topic(target, Conversation.ModeType.Query));
        }
        List <Conversation.ModeType> list = transitions[lastTopic.mode];

        Conversation.ModeType modeType = list[Random.Range(0, list.Count)];
        if (modeType == Conversation.ModeType.Statement)
        {
            Conversation.ModeType modeForAmount = GetModeForAmount(speaker, target);
            return(new Conversation.Topic(target, modeForAmount));
        }
        return(new Conversation.Topic(target, modeType));
    }
Esempio n. 4
0
    public override Conversation.Topic GetNextTopic(MinionIdentity speaker, Conversation.Topic lastTopic)
    {
        if (string.IsNullOrEmpty(target))
        {
            return(null);
        }
        List <Conversation.ModeType> list2;

        if (lastTopic == null)
        {
            List <Conversation.ModeType> list = new List <Conversation.ModeType>();
            list.Add(Conversation.ModeType.Query);
            list.Add(Conversation.ModeType.Statement);
            list.Add(Conversation.ModeType.Musing);
            list2 = list;
        }
        else
        {
            list2 = transitions[lastTopic.mode];
        }
        Conversation.ModeType mode = list2[Random.Range(0, list2.Count)];
        return(new Conversation.Topic(target, mode));
    }
Esempio n. 5
0
 public virtual Conversation.Topic GetNextTopic(MinionIdentity speaker, Conversation.Topic lastTopic)
 {
     return(null);
 }