Пример #1
0
    private void SortByExperience()
    {
        SelectSortToggle(experienceSortingToggle);
        List <SkillMinionWidget> list = minionWidgets;

        list.Sort(delegate(SkillMinionWidget a, SkillMinionWidget b)
        {
            MinionIdentity minionIdentity  = a.minion as MinionIdentity;
            MinionIdentity minionIdentity2 = b.minion as MinionIdentity;
            if ((UnityEngine.Object)minionIdentity == (UnityEngine.Object)null && (UnityEngine.Object)minionIdentity2 == (UnityEngine.Object)null)
            {
                return(0);
            }
            if ((UnityEngine.Object)minionIdentity == (UnityEngine.Object)null)
            {
                return(-1);
            }
            if ((UnityEngine.Object)minionIdentity2 == (UnityEngine.Object)null)
            {
                return(1);
            }
            MinionResume component  = minionIdentity.GetComponent <MinionResume>();
            MinionResume component2 = minionIdentity2.GetComponent <MinionResume>();
            float num   = (float)(component.AvailableSkillpoints / (component.TotalSkillPointsGained + 1));
            float value = (float)(component2.AvailableSkillpoints / (component2.TotalSkillPointsGained + 1));
            return(num.CompareTo(value));
        });
        ReorderEntries(list, sortReversed);
    }
Пример #2
0
    private void SortByMorale()
    {
        SelectSortToggle(moraleSortingToggle);
        List <SkillMinionWidget> list = minionWidgets;

        list.Sort(delegate(SkillMinionWidget a, SkillMinionWidget b)
        {
            MinionIdentity minionIdentity  = a.minion as MinionIdentity;
            MinionIdentity minionIdentity2 = b.minion as MinionIdentity;
            if ((UnityEngine.Object)minionIdentity == (UnityEngine.Object)null && (UnityEngine.Object)minionIdentity2 == (UnityEngine.Object)null)
            {
                return(0);
            }
            if ((UnityEngine.Object)minionIdentity == (UnityEngine.Object)null)
            {
                return(-1);
            }
            if ((UnityEngine.Object)minionIdentity2 == (UnityEngine.Object)null)
            {
                return(1);
            }
            MinionResume component               = minionIdentity.GetComponent <MinionResume>();
            MinionResume component2              = minionIdentity2.GetComponent <MinionResume>();
            AttributeInstance attributeInstance  = Db.Get().Attributes.QualityOfLife.Lookup(component);
            AttributeInstance attributeInstance2 = Db.Get().Attributes.QualityOfLifeExpectation.Lookup(component);
            AttributeInstance attributeInstance3 = Db.Get().Attributes.QualityOfLife.Lookup(component2);
            AttributeInstance attributeInstance4 = Db.Get().Attributes.QualityOfLifeExpectation.Lookup(component2);
            float num   = attributeInstance.GetTotalValue() / attributeInstance2.GetTotalValue();
            float value = attributeInstance3.GetTotalValue() / attributeInstance4.GetTotalValue();
            return(num.CompareTo(value));
        });
        ReorderEntries(list, sortReversed);
    }
    private bool MinionCloseEnoughToConvo(MinionIdentity minion, Conversation setup)
    {
        Vector3 centroid  = GetCentroid(setup);
        float   magnitude = (centroid - minion.transform.GetPosition()).magnitude;

        return(magnitude < TuningData <Tuning> .Get().maxDistance * 0.5f);
    }
    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();
    }
    protected void on_tooltip_qualityoflife_expectations(IAssignableIdentity minion, GameObject widget_go, ToolTip tooltip)
    {
        tooltip.ClearMultiStringTooltip();
        TableRow widgetRow = GetWidgetRow(widget_go);

        switch (widgetRow.rowType)
        {
        case TableRow.RowType.Header:
            break;

        case TableRow.RowType.Default:
            break;

        case TableRow.RowType.Minion:
        {
            MinionIdentity minionIdentity = minion as MinionIdentity;
            if ((UnityEngine.Object)minionIdentity != (UnityEngine.Object)null)
            {
                tooltip.AddMultiStringTooltip(Db.Get().Attributes.QualityOfLife.Lookup(minionIdentity).GetAttributeValueTooltip(), null);
            }
            break;
        }

        case TableRow.RowType.StoredMinon:
            StoredMinionTooltip(minion, tooltip);
            break;
        }
    }
Пример #6
0
    private IPersonalPriorityManager GetPriorityManager(TableRow row)
    {
        IPersonalPriorityManager result = null;

        switch (row.rowType)
        {
        case TableRow.RowType.Default:
            result = Immigration.Instance;
            break;

        case TableRow.RowType.Minion:
        {
            MinionIdentity minionIdentity = row.GetIdentity() as MinionIdentity;
            if ((UnityEngine.Object)minionIdentity != (UnityEngine.Object)null)
            {
                result = minionIdentity.GetComponent <ChoreConsumer>();
            }
            break;
        }

        case TableRow.RowType.StoredMinon:
            result = (row.GetIdentity() as StoredMinionIdentity);
            break;
        }
        return(result);
    }
Пример #7
0
            public static void Postfix(MinionIdentity __instance)
            {
                var dupe = __instance;

                if (HasDupeValue(dupe.gameObject, ImmuneSystemAmount))
                {
                    var immuneSystem = ImmuneSystemAmount.Lookup(dupe.gameObject);
                    var max          = immuneSystem.GetMax();
                    var value        = immuneSystem.value;


                    var amount = ImmuneSystemAmount.Lookup(dupe.gameObject);
                    for (var index = 0; index != amount.deltaAttribute.Modifiers.Count; ++index)
                    {
                        var mod = amount.deltaAttribute.Modifiers[index];
                        if (mod.AttributeId != ImmuneSystemBaseModifier.AttributeId ||
                            mod.Description != ImmuneSystemBaseModifier.Description)
                        {
                            continue;
                        }
                        if (value >= max)
                        {
                            mod.SetValue(0f);
                        }
                        else
                        {
                            if (mod.Value <= 0f)
                            {
                                mod.SetValue(ImmuneSystemDefaultDelta);
                            }
                        }
                    }
                }
            }
Пример #8
0
    private void OnBlankDropEntryClick(IListableOption option, object obj)
    {
        Schedule       targetSchedule = (Schedule)obj;
        MinionIdentity minionIdentity = (MinionIdentity)option;

        ChangeAssignment(targetSchedule, minionIdentity.GetComponent <Schedulable>());
    }
Пример #9
0
    private void UpdateDisplayInfo(BaseEventData base_ev_data, ref DisplayInfo display_info, IList <MinionIdentity> minions)
    {
        PointerEventData pointerEventData = base_ev_data as PointerEventData;

        if (pointerEventData != null)
        {
            switch (pointerEventData.button)
            {
            case PointerEventData.InputButton.Left:
                if (Components.LiveMinionIdentities.Count < display_info.selectedIndex)
                {
                    display_info.selectedIndex = -1;
                }
                if (Components.LiveMinionIdentities.Count > 0)
                {
                    display_info.selectedIndex = (display_info.selectedIndex + 1) % Components.LiveMinionIdentities.Count;
                    MinionIdentity minionIdentity = minions[display_info.selectedIndex];
                    SelectTool.Instance.SelectAndFocus(minionIdentity.transform.GetPosition(), minionIdentity.GetComponent <KSelectable>(), new Vector3(5f, 0f, 0f));
                }
                break;

            case PointerEventData.InputButton.Right:
                display_info.selectedIndex = -1;
                break;
            }
        }
    }
Пример #10
0
    protected override void OnSpawn()
    {
        base.OnSpawn();
        RegisterInGrid(true);
        SetGridRestrictions(null, DefaultPermission);
        foreach (KeyValuePair <Ref <KPrefabID>, Permission> savedPermission in savedPermissions)
        {
            SetGridRestrictions(savedPermission.Key.Get(), savedPermission.Value);
        }
        ListPool <Tuple <MinionAssignablesProxy, Permission>, AccessControl> .PooledList pooledList = ListPool <Tuple <MinionAssignablesProxy, Permission>, AccessControl> .Allocate();

        for (int num = savedPermissions.Count - 1; num >= 0; num--)
        {
            KPrefabID kPrefabID = savedPermissions[num].Key.Get();
            if ((Object)kPrefabID != (Object)null)
            {
                MinionIdentity component = kPrefabID.GetComponent <MinionIdentity>();
                if ((Object)component != (Object)null)
                {
                    pooledList.Add(new Tuple <MinionAssignablesProxy, Permission>(component.assignableProxy.Get(), savedPermissions[num].Value));
                    savedPermissions.RemoveAt(num);
                    ClearGridRestrictions(kPrefabID);
                }
            }
        }
        foreach (Tuple <MinionAssignablesProxy, Permission> item in pooledList)
        {
            SetPermission(item.first, item.second);
        }
        pooledList.Recycle();
        SetStatusItem();
    }
 public void SetTitle(int selectedTabIndex)
 {
     UpdateCodexButton();
     if ((UnityEngine.Object)TabTitle != (UnityEngine.Object)null)
     {
         TabTitle.SetTitle(target.GetProperName());
         MinionIdentity minionIdentity = null;
         StorageLocker  x = null;
         if ((UnityEngine.Object)target != (UnityEngine.Object)null)
         {
             minionIdentity = target.gameObject.GetComponent <MinionIdentity>();
             x = target.gameObject.GetComponent <StorageLocker>();
         }
         if ((UnityEngine.Object)minionIdentity != (UnityEngine.Object)null)
         {
             TabTitle.SetSubText(minionIdentity.GetComponent <MinionResume>().GetSkillsSubtitle(), string.Empty);
             TabTitle.SetUserEditable(true);
         }
         else if ((UnityEngine.Object)x != (UnityEngine.Object)null)
         {
             TabTitle.SetSubText(string.Empty, string.Empty);
             TabTitle.SetUserEditable(true);
         }
         else
         {
             TabTitle.SetSubText(string.Empty, string.Empty);
             TabTitle.SetUserEditable(false);
         }
     }
 }
Пример #12
0
    private void AddToolTipAmountPercentLine(ToolTip tooltip, AmountInstance amount, MinionIdentity id, bool selected)
    {
        string name = id.GetComponent <KSelectable>().GetName();
        string str  = name + ":  " + Mathf.Round(amount.value).ToString() + "%";

        AddToolTipLine(tooltip, str, selected);
    }
Пример #13
0
        // труп изъят из стораге - вернуть все как было
        // а также корректируем позицию чтобы не зависал в воздухе
        private static void UnHideCorpse(DeathMonitor.Instance smi)
        {
            MinionIdentity mi = smi.GetComponent <MinionIdentity>();

            if (mi != null)
            {
                if (!Components.MinionIdentities.Items.Contains(mi))
                {
                    Components.MinionIdentities.Add(mi);
                }
                MinionAssignablesProxy map = mi.assignableProxy.Get();
                if (map != null && !Components.MinionAssignablesProxy.Items.Contains(map))
                {
                    Components.MinionAssignablesProxy.Add(map);
                }
            }
            Transform transform = smi.master.transform;
            Vector3   position  = Grid.CellToPos(Grid.PosToCell(transform.GetPosition()));

            position.z = transform.GetPosition().z;
            transform.SetPosition(position);

            Debug.Log("UnHideCorpse");

            //NameDisplayScreen.Instance.entries.Find(entry => entry.world_go == smi.gameObject)?.display_go.SetActive(true);
            //NameDisplayScreen.Instance.entries.Find(entry => entry.world_go == smi.gameObject).display_go.GetComponent<KBatchedAnimController>().sceneLayer = Grid.SceneLayer.Move;
        }
 private void CheckTarget()
 {
     if (target == null)
     {
         KPrefabID instance = KPrefabIDTracker.Get().GetInstance(target_instance_id);
         if ((Object)instance != (Object)null)
         {
             target = instance.GetComponent <IAssignableIdentity>();
             if (target != null)
             {
                 MinionIdentity minionIdentity = target as MinionIdentity;
                 if ((bool)minionIdentity)
                 {
                     minionIdentity.ValidateProxy();
                 }
                 else
                 {
                     StoredMinionIdentity storedMinionIdentity = target as StoredMinionIdentity;
                     if ((bool)storedMinionIdentity)
                     {
                         storedMinionIdentity.ValidateProxy();
                     }
                 }
             }
         }
     }
 }
Пример #15
0
 private void RefreshHat()
 {
     if (currentlySelectedMinion != null && !currentlySelectedMinion.IsNull())
     {
         List <IListableOption> list   = new List <IListableOption>();
         string         empty          = string.Empty;
         MinionIdentity minionIdentity = currentlySelectedMinion as MinionIdentity;
         if ((UnityEngine.Object)minionIdentity != (UnityEngine.Object)null)
         {
             MinionResume component = minionIdentity.GetComponent <MinionResume>();
             empty = ((!string.IsNullOrEmpty(component.TargetHat)) ? component.TargetHat : component.CurrentHat);
             foreach (KeyValuePair <string, bool> item in component.MasteryBySkillID)
             {
                 if (item.Value)
                 {
                     list.Add(new SkillListable(item.Key));
                 }
             }
             hatDropDown.Initialize(list, OnHatDropEntryClick, hatDropDownSort, hatDropEntryRefreshAction, false, currentlySelectedMinion);
         }
         else
         {
             StoredMinionIdentity storedMinionIdentity = currentlySelectedMinion as StoredMinionIdentity;
             empty = ((!string.IsNullOrEmpty(storedMinionIdentity.targetHat)) ? storedMinionIdentity.targetHat : storedMinionIdentity.currentHat);
         }
         hatDropDown.openButton.enabled = ((UnityEngine.Object)minionIdentity != (UnityEngine.Object)null);
         selectedHat.transform.Find("Arrow").gameObject.SetActive((UnityEngine.Object)minionIdentity != (UnityEngine.Object)null);
         selectedHat.sprite = Assets.GetSprite((!string.IsNullOrEmpty(empty)) ? empty : "hat_role_none");
     }
 }
Пример #16
0
    private void RefreshBio()
    {
        MinionIdentity component = selectedTarget.GetComponent <MinionIdentity>();

        if (!(bool)component)
        {
            bioPanel.SetActive(false);
        }
        else
        {
            bioPanel.SetActive(true);
            bioPanel.GetComponent <CollapsibleDetailContentPanel>().HeaderLabel.text = UI.DETAILTABS.PERSONALITY.GROUPNAME_BIO;
            bioDrawer.BeginDrawing().NewLabel(DUPLICANTS.NAMETITLE + component.name).NewLabel((string)DUPLICANTS.ARRIVALTIME + ((float)GameClock.Instance.GetCycle() - component.arrivalTime) + " Cycles")
            .Tooltip(string.Format(DUPLICANTS.ARRIVALTIME_TOOLTIP, component.arrivalTime, component.name))
            .NewLabel(DUPLICANTS.GENDERTITLE + string.Format(Strings.Get($"STRINGS.DUPLICANTS.GENDER.{component.genderStringKey.ToUpper()}.NAME"), component.gender))
            .NewLabel(string.Format(Strings.Get($"STRINGS.DUPLICANTS.PERSONALITIES.{component.nameStringKey.ToUpper()}.DESC"), component.name))
            .Tooltip(string.Format(Strings.Get(string.Format("STRINGS.DUPLICANTS.DESC_TOOLTIP", component.nameStringKey.ToUpper())), component.name));
            MinionResume component2 = selectedTarget.GetComponent <MinionResume>();
            if ((Object)component2 != (Object)null && component2.AptitudeBySkillGroup.Count > 0)
            {
                bioDrawer.NewLabel(UI.DETAILTABS.PERSONALITY.RESUME.APTITUDES.NAME + "\n").Tooltip(string.Format(UI.DETAILTABS.PERSONALITY.RESUME.APTITUDES.TOOLTIP, selectedTarget.name));
                foreach (KeyValuePair <HashedString, float> item in component2.AptitudeBySkillGroup)
                {
                    if (item.Value != 0f)
                    {
                        SkillGroup skillGroup = Db.Get().SkillGroups.Get(item.Key);
                        bioDrawer.NewLabel("  • " + skillGroup.Name).Tooltip(string.Format(DUPLICANTS.ROLES.GROUPS.APTITUDE_DESCRIPTION, skillGroup.Name, item.Value));
                    }
                }
            }
            bioDrawer.EndDrawing();
        }
    }
Пример #17
0
        public static void CreateAndAddNotification(GermExposureMonitor.Instance monitor, string sicknessName)
        {
            string text = string.Format(DUPE_EXPOSED_TO_GERMS_NOTIFICATION, sicknessName);

            Notification.ClickCallback callback = new Notification.ClickCallback(Notification_Callback);
            MinionIdentity             minion   = monitor.gameObject.GetComponent <MinionIdentity>();
            ShowLocationObject         slo      = new ShowLocationObject(minion);

            slo.ShowLocation = MinionsLoaded && showLocation;
            Notification notification = new Notification(text, NotificationType.BadMinor, HashedString.Invalid,
                                                         (List <Notification> n, object d) => string.Format(DUPE_EXPOSED_TO_GERMS_TOOLTIP, sicknessName) + n.ReduceMessages(true),
                                                         null, false, 0, callback, slo);

            monitor.gameObject.AddOrGet <Notifier>().Add(notification);
            Action <object> act = null;

            act = x =>
            {
                monitor.gameObject.AddOrGet <Notifier>().Remove(notification);
                monitor.Unsubscribe((int)GameHashes.SleepFinished, act);
                monitor.Unsubscribe((int)GameHashes.DuplicantDied, act);
            };
            monitor.Subscribe((int)GameHashes.SleepFinished, act);
            monitor.Subscribe((int)GameHashes.DuplicantDied, act);
        }
    private void RefreshAttributes()
    {
        MinionIdentity component = selectedTarget.GetComponent <MinionIdentity>();

        if (!(bool)component)
        {
            attributesPanel.SetActive(false);
        }
        else
        {
            attributesPanel.SetActive(true);
            attributesPanel.GetComponent <CollapsibleDetailContentPanel>().HeaderLabel.text = UI.DETAILTABS.STATS.GROUPNAME_ATTRIBUTES;
            List <AttributeInstance> list  = new List <AttributeInstance>(selectedTarget.GetAttributes().AttributeTable);
            List <AttributeInstance> list2 = list.FindAll((AttributeInstance a) => a.Attribute.ShowInUI == Attribute.Display.Skill);
            attributesDrawer.BeginDrawing();
            if (list2.Count > 0)
            {
                foreach (AttributeInstance item in list2)
                {
                    attributesDrawer.NewLabel($"{item.Name}: {item.GetFormattedValue()}").Tooltip(item.GetAttributeValueTooltip());
                }
            }
            attributesDrawer.EndDrawing();
        }
    }
Пример #19
0
        private void Emit(object data)
        {
            GameObject gameObject = (GameObject)data;

            global::Components.Cmps <MinionIdentity> liveMinionIdentities = global::Components.LiveMinionIdentities;
            Vector2 a = gameObject.transform.GetPosition();

            for (int i = 0; i < liveMinionIdentities.Count; i++)
            {
                MinionIdentity minionIdentity = liveMinionIdentities[i];
                if (minionIdentity.gameObject != gameObject.gameObject)
                {
                    Vector2 b   = minionIdentity.transform.GetPosition();
                    float   num = Vector2.SqrMagnitude(a - b);
                    if (num <= 2.25f)
                    {
                        minionIdentity.Trigger((int)GameHashes.Cringe, Strings.Get("STRINGS.DUPLICANTS.DISEASES.PUTRIDODOUR.CRINGE_EFFECT").String);
                        minionIdentity.gameObject.GetSMI <ThoughtGraph.Instance>().AddThought(Db.Get().Thoughts.PutridOdour);
                    }
                }
            }

            int   gameCell = Grid.PosToCell(gameObject.transform.GetPosition());
            float temp     = Db.Get().Amounts.Temperature.Lookup(this).value;

            SimMessages.AddRemoveSubstance(gameCell, SimHashes.ContaminatedOxygen, CellEventLogger.Instance.ElementConsumerSimUpdate, 0.0025f, temp, DiseaseInfo.Invalid.idx, DiseaseInfo.Invalid.count);
            KFMOD.PlayOneShot(GlobalAssets.GetSound("Dupe_Flatulence"), base.transform.GetPosition());
        }
    private void BeginReacting(GameObject minionGO)
    {
        MinionIdentity component = minionGO.GetComponent <MinionIdentity>();
        Vector3        vector    = Vector3.zero;

        foreach (GreetingSetup activeSetup in activeSetups)
        {
            if ((UnityEngine.Object)activeSetup.A.minion == (UnityEngine.Object)component)
            {
                vector = activeSetup.B.minion.transform.GetPosition();
                break;
            }
            if ((UnityEngine.Object)activeSetup.B.minion == (UnityEngine.Object)component)
            {
                vector = activeSetup.A.minion.transform.GetPosition();
                break;
            }
        }
        Facing  component2 = minionGO.GetComponent <Facing>();
        Facing  facing     = component2;
        float   x          = vector.x;
        Vector3 position   = minionGO.transform.GetPosition();

        facing.SetFacing(x < position.x);
        Effects component3 = minionGO.GetComponent <Effects>();

        component3.Add("Greeting", true);
        cooldowns[component] = GameClock.Instance.GetTime();
    }
Пример #21
0
            public void CalculateImmuneSystem(MinionIdentity dupe)
            {
                var totalGerms = 0;

                foreach (var germ in germList)
                {
                    if (germ.Id == Db.Get().Diseases.SlimeGerms.Id)
                    {
                        totalGerms += (int)(germ.Amount * 1.0f);
                    }
                    else if (germ.Id == Db.Get().Diseases.PollenGerms.Id)
                    {
                        totalGerms += (int)(germ.Amount * 0.5f);
                    }
                    else
                    {
                        totalGerms += (int)germ.Amount;
                    }
                }

                var amount = ImmuneSystemAmount.Lookup(dupe);

                for (int index = 0; index != amount.deltaAttribute.Modifiers.Count; ++index)
                {
                    AttributeModifier mod = amount.deltaAttribute.Modifiers[index];
                    if (mod.AttributeId == ImmuneSystemGermModifier.AttributeId &&
                        mod.Description == ImmuneSystemGermModifier.Description)
                    {
                        mod.SetValue((float)-(totalGerms / 900D / 500D));
                    }
                }
            }
Пример #22
0
    private string OnSickTooltip()
    {
        int num = CountSickDupes();

        SickTooltip.ClearMultiStringTooltip();
        SickTooltip.AddMultiStringTooltip(string.Format(UI.TOOLTIPS.METERSCREEN_SICK_DUPES, num.ToString()), ToolTipStyle_Header);
        for (int i = 0; i < Components.LiveMinionIdentities.Count; i++)
        {
            MinionIdentity minionIdentity = Components.LiveMinionIdentities[i];
            string         text           = minionIdentity.GetComponent <KSelectable>().GetName();
            Sicknesses     sicknesses     = minionIdentity.GetComponent <MinionModifiers>().sicknesses;
            if (sicknesses.IsInfected())
            {
                text += " (";
                int num2 = 0;
                foreach (SicknessInstance item in sicknesses)
                {
                    text = text + ((num2 <= 0) ? string.Empty : ", ") + item.modifier.Name;
                    num2++;
                }
                text += ")";
            }
            bool selected = i == immunityDisplayInfo.selectedIndex;
            AddToolTipLine(SickTooltip, text, selected);
        }
        return(string.Empty);
    }
 private Reactable GetReactable(MinionIdentity minion)
 {
     return(new SelfEmoteReactable(minion.gameObject, "NavigatorPassingGreeting", Db.Get().ChoreTypes.Emote, waveAnims[UnityEngine.Random.Range(0, waveAnims.Count)], 1000f, 20f, float.PositiveInfinity).AddStep(new EmoteReactable.EmoteStep
     {
         anim = (HashedString)"react",
         startcb = new Action <GameObject>(BeginReacting)
     }).AddThought(Db.Get().Thoughts.Chatty));
 }
 public void OpenSkills(MinionIdentity minionIdentity)
 {
     if (activeScreen != ScreenInfoMatch[Instance.skillsInfo])
     {
         skillsScreen.CurrentlySelectedMinion = minionIdentity;
         ToggleScreen(ScreenInfoMatch[Instance.skillsInfo]);
     }
 }
Пример #25
0
            public AttributeModifier baseHeartAttackChance; // базовый шанс

            public Instance(IStateMachineTarget master) : base(master)
            {
                minionIdentity        = master.GetComponent <MinionIdentity>();
                effects               = master.GetComponent <Effects>();
                sicknesses            = master.gameObject.GetSicknesses();
                health                = master.GetComponent <Health>();
                baseHeartAttackChance = new AttributeModifier(ATTRIBUTE_ID, 0, STRINGS.DUPLICANTS.ATTRIBUTES.HEARTATTACKSUSCEPTIBILITY.AGE_MODIFIER, false, false, false);
            }
    private void BeginNewGreeting(MinionIdentity minion_a, MinionIdentity minion_b, int cell)
    {
        GreetingSetup greetingSetup = new GreetingSetup();

        greetingSetup.cell = cell;
        greetingSetup.A    = new GreetingUnit(minion_a, GetReactable(minion_a));
        greetingSetup.B    = new GreetingUnit(minion_b, GetReactable(minion_b));
        activeSetups.Add(greetingSetup);
    }
    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);
    }
Пример #28
0
            private static void Postfix(Clinic __instance, MinionAssignablesProxy worker, ref bool __result)
            {
                MinionIdentity minionIdentity = worker.target as MinionIdentity;

                if (minionIdentity != null)
                {
                    __result = __result || minionIdentity.HasTag(GameTags.Incapacitated) || (!string.IsNullOrEmpty(__instance.diseaseEffect) && HasCriticalDisease(minionIdentity.GetSicknesses()));
                }
            }
Пример #29
0
            /// <summary>
            /// Applied after OnSpawn runs.
            /// </summary>
            internal static void Postfix(MinionIdentity __instance)
            {
                var cc = __instance.gameObject.GetComponentSafe <ConsumableConsumer>();

                if (cc != null)
                {
                    TraitReworkUtils.ApplyBannedFoods(cc);
                }
            }
Пример #30
0
    private void OnAddDupe(MinionIdentity minion)
    {
        Schedulable component = minion.GetComponent <Schedulable>();

        if (GetSchedule(component) == null)
        {
            schedules[0].Assign(component);
        }
    }