Esempio n. 1
0
        public void Copy(GameObject to, GameObject from)
        {
            AmountInstance amountInstance  = Lookup(to);
            AmountInstance amountInstance2 = Lookup(from);

            amountInstance.value = amountInstance2.value;
        }
			/// <summary>
			/// Applied before Update runs.
			/// </summary>
			internal static bool Prefix(DecorMonitor.Instance __instance, float dt,
					Klei.AI.AmountInstance ___amount, Klei.AI.AttributeModifier ___modifier,
					ref float ___cycleTotalDecor) {
				bool cont = true;
				ChoreDriver driver;
				// If no chore driver, allow stock implementation
				if ((driver = __instance.GetComponent<ChoreDriver>()) != null) {
					var chore = driver.GetCurrentChore();
					cont = false;
					// Slew to half decor if sleeping
					float decorAtCell = GameUtil.GetDecorAtCell(Grid.PosToCell(__instance));
					if (chore != null && chore.choreType == Db.Get().ChoreTypes.Sleep)
						decorAtCell *= DecorTuning.DECOR_FRACTION_SLEEP;
					___cycleTotalDecor += decorAtCell * dt;
					// Constants are the same as the base game
					float value = 0.0f, curDecor = ___amount.value;
					if (Mathf.Abs(decorAtCell - curDecor) > 0.5f) {
						if (decorAtCell > curDecor)
							value = 3.0f * SLEW;
						else if (decorAtCell < curDecor)
							value = -SLEW;
					} else
						___amount.value = decorAtCell;
					___modifier.SetValue(value);
				}
				return cont;
			}
Esempio n. 3
0
                private void ProduceSlime(GameObject cougher)
                {
                    AmountInstance amountInstance = Db.Get().Amounts.Temperature.Lookup(cougher);
                    int            gameCell       = Grid.PosToCell(cougher);

                    SimMessages.AddRemoveSubstance(gameCell, SimHashes.ContaminatedOxygen, CellEventLogger.Instance.Cough, 0.1f, amountInstance.value, Db.Get().Diseases.GetIndex("Radioactive"), 1000, true, -1);
                    PopFXManager.Instance.SpawnFX(PopFXManager.Instance.sprite_Resource, string.Format(DUPLICANTS.DISEASES.ADDED_POPFX, base.master.modifier.Name, 1000), cougher.transform, 1.5f, false);
                }
        /// <summary>
        /// Gets the value to be displayed by the standard amount displayer.
        /// </summary>
        /// <param name="text">The location where the result will be stored.</param>
        /// <param name="formatter">Formats the value to user-friendly units.</param>
        /// <param name="instance">The value to be displayed.</param>
        /// <param name="master">The amount to be displayed.</param>
        private static void GetValueString(StringBuilder text, IAttributeFormatter formatter,
                                           Klei.AI.AmountInstance instance, Klei.AI.Amount master)
        {
            string formatted = formatter.GetFormattedValue(instance.value, TimeSlice.None);

            text.Append(formatted);
            if (master.showMax)
            {
                text.Append(" / ").Append(formatter.GetFormattedValue(instance.GetMax(),
                                                                      TimeSlice.None));
            }
        }
Esempio n. 5
0
                private void ProduceSlime(GameObject cougher)
                {
                    AmountInstance amountInstance = Db.Get().Amounts.Temperature.Lookup(cougher);
                    int            gameCell       = Grid.PosToCell(cougher);
                    string         id             = Db.Get().Diseases.SlimeGerms.Id;
                    Equippable     equippable     = base.master.gameObject.GetComponent <SuitEquipper>().IsWearingAirtightSuit();

                    if ((UnityEngine.Object)equippable != (UnityEngine.Object)null)
                    {
                        equippable.GetComponent <Storage>().AddGasChunk(SimHashes.ContaminatedOxygen, 0.1f, amountInstance.value, Db.Get().Diseases.GetIndex(id), 1000, false, true);
                    }
                    else
                    {
                        SimMessages.AddRemoveSubstance(gameCell, SimHashes.ContaminatedOxygen, CellEventLogger.Instance.Cough, 0.1f, amountInstance.value, Db.Get().Diseases.GetIndex(id), 1000, true, -1);
                    }
                    PopFXManager.Instance.SpawnFX(PopFXManager.Instance.sprite_Resource, string.Format(DUPLICANTS.DISEASES.ADDED_POPFX, base.master.modifier.Name, 1000), cougher.transform, 1.5f, false);
                }
Esempio n. 6
0
 public void Run(BatchUpdateContext context)
 {
     for (int i = start; i != end; i++)
     {
         UpdateBucketWithUpdater <ISim200ms> .Entry entry = context.amount_instances[i];
         AmountInstance amountInstance = (AmountInstance)entry.data;
         float          num            = amountInstance.GetDelta() * context.time_delta;
         if (num != 0f)
         {
             context.results.Add(new BatchUpdateContext.Result
             {
                 amount_instance = amountInstance,
                 previous        = amountInstance.value,
                 delta           = num
             });
             amountInstance.SetValue(amountInstance.value + num);
         }
     }
 }
Esempio n. 7
0
 public string GetTooltip(AmountInstance instance)
 {
     return(displayer.GetTooltip(this, instance));
 }
Esempio n. 8
0
 public string GetDescription(AmountInstance instance)
 {
     return(displayer.GetDescription(this, instance));
 }
Esempio n. 9
0
 public string GetValueString(AmountInstance instance)
 {
     return(displayer.GetValueString(this, instance));
 }