public static void Emit(object data, int EmissionRadius)
    {
        GameObject gameObject = (GameObject)data;

        Components.Cmps <MinionIdentity> liveMinionIdentities = Components.LiveMinionIdentities;
        Vector2 vector    = gameObject.transform.GetPosition();
        int     num       = Grid.PosToCell(vector);
        int     num2      = EmissionRadius * EmissionRadius;
        int     max_depth = Mathf.CeilToInt((float)EmissionRadius);

        DetermineCellsInRadius(num, 0, max_depth, cellsInRange);
        DrawVisualEffect(num, cellsInRange);
        for (int i = 0; i < liveMinionIdentities.Count; i++)
        {
            MinionIdentity minionIdentity = liveMinionIdentities[i];
            if ((UnityEngine.Object)minionIdentity.gameObject != (UnityEngine.Object)gameObject.gameObject)
            {
                Vector2 vector2 = minionIdentity.transform.GetPosition();
                float   num3    = Vector2.SqrMagnitude(vector - vector2);
                if (num3 <= (float)num2)
                {
                    int item = Grid.PosToCell(vector2);
                    if (cellsInRange.Contains(item) && minionIdentity.GetSMI <StaminaMonitor.Instance>().IsSleeping())
                    {
                        minionIdentity.Trigger(-527751701, data);
                        minionIdentity.Trigger(1621815900, data);
                    }
                }
            }
        }
        cellsInRange.Clear();
    }
    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 static string ReduceNotifications(List <Notification> list, object tooltipData)
        {
            string text = "";

            foreach (Notification n in list)
            {
                MinionIdentity minion            = (MinionIdentity)n.customClickData;
                string         sickness_id       = (string)tooltipData;
                string         name              = n.NotifierName;
                ExposureType   type              = TUNING.GERM_EXPOSURE.TYPES.First(x => x.sickness_id == sickness_id);
                GermExposureMonitor.Instance smi = minion.GetSMI <GermExposureMonitor.Instance>();
                float  chance            = ((!type.infect_immediately) ? GermExposureMonitor.GetContractionChance(smi.GetResistanceToExposureType(type, -1f)) : 1f);
                string contractionChance = GameUtil.GetFormattedPercent(chance * 100);
                text = text + $"\n{name} - {contractionChance}";
            }
            return(text);
        }
예제 #4
0
 public override void NewTarget(MinionIdentity speaker)
 {
     ConversationMonitor.Instance sMI = speaker.GetSMI <ConversationMonitor.Instance>();
     target = sMI.GetATopic();
 }
 public override void Populate(MinionIdentity _identity)
 {
     base.Populate(_identity);
     rationMonitor = _identity.GetSMI <RationMonitor.Instance>();
     Refresh();
 }