Exemplo n.º 1
0
        public override object OnInfect(GameObject go, SicknessInstance diseaseInstance)
        {
            var statesInstance = new StatesInstance(diseaseInstance);

            statesInstance.StartSM();
            return(statesInstance);
        }
Exemplo n.º 2
0
        private void InitializeAndStart()
        {
            Sickness disease = modifier;
            Func <List <Notification>, object, string> tooltip = delegate(List <Notification> notificationList, object data)
            {
                string text = string.Empty;
                for (int i = 0; i < notificationList.Count; i++)
                {
                    Notification notification = notificationList[i];
                    string       arg          = (string)notification.tooltipData;
                    text += string.Format(DUPLICANTS.DISEASES.NOTIFICATION_TOOLTIP, notification.NotifierName, disease.Name, arg);
                    if (i < notificationList.Count - 1)
                    {
                        text += "\n";
                    }
                }
                return(text);
            };
            string           name       = disease.Name;
            string           title      = name;
            NotificationType type       = (disease.severity > Sickness.Severity.Minor) ? NotificationType.Bad : NotificationType.BadMinor;
            HashedString     invalid    = HashedString.Invalid;
            string           sourceInfo = exposureInfo.sourceInfo;

            notification = new Notification(title, type, invalid, tooltip, sourceInfo, true, 0f, null, null, null);
            statusItem   = new StatusItem(disease.Id, disease.Name, DUPLICANTS.DISEASES.STATUS_ITEM_TOOLTIP.TEMPLATE, string.Empty, (disease.severity > Sickness.Severity.Minor) ? StatusItem.IconType.Exclamation : StatusItem.IconType.Info, (disease.severity > Sickness.Severity.Minor) ? NotificationType.Bad : NotificationType.BadMinor, false, OverlayModes.None.ID, 129022);
            statusItem.resolveTooltipCallback = ResolveString;
            if (smi != null)
            {
                smi.StopSM("refresh");
            }
            smi = new StatesInstance(this);
            smi.StartSM();
        }
Exemplo n.º 3
0
    protected override void OnSpawn()
    {
        base.OnSpawn();
        base.workable.requiredSkillPerk = Db.Get().SkillPerks.CanElectricGrill.Id;
        base.workable.WorkerStatusItem  = Db.Get().DuplicantStatusItems.Cooking;
        base.workable.overrideAnims     = new KAnimFile[1]
        {
            Assets.GetAnim("anim_interacts_cookstation_gourtmet_kanim")
        };
        base.workable.AttributeConverter            = Db.Get().AttributeConverters.CookingSpeed;
        base.workable.AttributeExperienceMultiplier = DUPLICANTSTATS.ATTRIBUTE_LEVELING.MOST_DAY_EXPERIENCE;
        base.workable.SkillExperienceSkillGroup     = Db.Get().SkillGroups.Cooking.Id;
        base.workable.SkillExperienceMultiplier     = SKILLS.MOST_DAY_EXPERIENCE;
        ComplexFabricatorWorkable workable = base.workable;

        workable.OnWorkTickActions = (Action <Worker, float>) Delegate.Combine(workable.OnWorkTickActions, (Action <Worker, float>) delegate(Worker worker, float dt)
        {
            Debug.Assert((UnityEngine.Object)worker != (UnityEngine.Object)null, "How did we get a null worker?");
            if (diseaseCountKillRate > 0)
            {
                PrimaryElement component = GetComponent <PrimaryElement>();
                int num = Math.Max(1, (int)((float)diseaseCountKillRate * dt));
                component.ModifyDiseaseCount(-num, "GourmetCookingStation");
            }
        });
        smi = new StatesInstance(this);
        smi.StartSM();
    }
 protected override void OnSpawn()
 {
     base.OnSpawn();
     Prioritizable.AddRef(base.gameObject);
     doctor_workable = GetComponent <DoctorStationDoctorWorkable>();
     SetWorkTime(float.PositiveInfinity);
     smi = new StatesInstance(this);
     smi.StartSM();
     OnStorageChange(null);
     Subscribe(-1697596308, OnStorageChangeDelegate);
 }
    protected override void OnSpawn()
    {
        base.OnSpawn();
        KBatchedAnimController component = GetComponent <KBatchedAnimController>();

        meter_coolant = new MeterController((KAnimControllerBase)component, "meter_target", "meter_coolant", Meter.Offset.Infront, Grid.SceneLayer.NoLayer, Vector3.zero, (string[])null);
        meter_metal   = new MeterController((KAnimControllerBase)component, "meter_target_metal", "meter_metal", Meter.Offset.Infront, Grid.SceneLayer.NoLayer, Vector3.zero, (string[])null);
        meter_metal.SetPositionPercent(1f);
        smi = new StatesInstance(this);
        smi.StartSM();
        ConduitFlow liquidConduitFlow = Game.Instance.liquidConduitFlow;

        liquidConduitFlow.AddConduitUpdater(OnConduitUpdate, ConduitFlowPriority.Default);
        Building component2 = GetComponent <Building>();

        outputCell = component2.GetUtilityOutputCell();
        workable.OnWorkTickActions = delegate
        {
            float percentComplete = workable.GetPercentComplete();
            meter_metal.SetPositionPercent(percentComplete);
        };
    }
Exemplo n.º 6
0
    protected override void OnSpawn()
    {
        base.OnSpawn();
        Subscribe(824508782, OnActiveChangedDelegate);
        smi = new StatesInstance(this);
        smi.StartSM();
        accumulator = Game.Instance.accumulators.Add("Element", this);
        BuildingDef def  = GetComponent <BuildingComplete>().Def;
        int         cell = Grid.PosToCell(this);

        for (int i = 0; i < def.WidthInCells; i++)
        {
            int x   = i - (def.WidthInCells - 1) / 2;
            int num = Grid.OffsetCell(cell, new CellOffset(x, 0));
            SimMessages.SetCellProperties(num, 39);
            Grid.Foundation[num] = true;
            Grid.SetSolid(num, true, CellEventLogger.Instance.SimCellOccupierForceSolid);
            World.Instance.OnSolidChanged(num);
            GameScenePartitioner.Instance.TriggerEvent(num, GameScenePartitioner.Instance.solidChangedLayer, null);
            Grid.RenderedByWorld[num] = false;
        }
        meter = new MeterController(GetComponent <KBatchedAnimController>(), "meter_target", "meter", Meter.Offset.Infront, Grid.SceneLayer.NoLayer, "meter_target", "meter_fill", "meter_frame", "meter_OL");
    }
Exemplo n.º 7
0
    protected override void OnSpawn()
    {
        base.OnSpawn();
        Prioritizable.AddRef(base.gameObject);
        accumulator     = Game.Instance.accumulators.Add("pressuregas", this);
        showProgressBar = false;
        SetWorkTime(float.PositiveInfinity);
        overrideAnims = new KAnimFile[1]
        {
            Assets.GetAnim("anim_interacts_oil_cap_kanim")
        };
        workingStatusItem             = Db.Get().BuildingStatusItems.ReleasingPressure;
        attributeConverter            = Db.Get().AttributeConverters.MachinerySpeed;
        attributeExperienceMultiplier = DUPLICANTSTATS.ATTRIBUTE_LEVELING.PART_DAY_EXPERIENCE;
        skillExperienceSkillGroup     = Db.Get().SkillGroups.Technicals.Id;
        skillExperienceMultiplier     = SKILLS.PART_DAY_EXPERIENCE;
        KBatchedAnimController component = GetComponent <KBatchedAnimController>();

        pressureMeter = new MeterController((KAnimControllerBase)component, "meter_target", "meter", Meter.Offset.Infront, Grid.SceneLayer.NoLayer, new Vector3(0f, 0f, 0f), (string[])null);
        smi           = new StatesInstance(this);
        smi.StartSM();
        UpdatePressurePercent();
    }