Example #1
0
 public void Sim4000ms(float dt)
 {
     if (growing.IsGrown() && !wilting.IsWilting())
     {
         TrySpawnRandomBud(null, 0f);
         GetComponent <KSelectable>().AddStatusItem(growingBranchesStatusItem, null);
     }
     else
     {
         GetComponent <KSelectable>().RemoveStatusItem(growingBranchesStatusItem, false);
     }
 }
Example #2
0
        public void Sim4000ms(float dt)
        {
            var obj = gameObject;
            int cell;

            if (obj != null && Grid.IsValidCell(cell = Grid.PosToCell(obj)) && isWilted?.
                IsWilting() == false && disease != SimUtil.DiseaseInfo.Invalid.idx &&
                uprooted != null)
            {
                cell = Grid.OffsetCell(cell, uprooted.monitorCell);
                if (Grid.IsValidCell(cell) && Grid.Solid[cell])
                {
                    // Flower is growing and on a solid cell, infect it!
                    SimMessages.ModifyDiseaseOnCell(cell, disease, Mathf.RoundToInt(
                                                        GermExposureTuning.SPORECHID_GERMS_PER_S * dt));
                }
            }
        }
 public override void InitializeStates(out BaseState default_state)
 {
     default_state     = exchanging;
     base.serializable = true;
     exchanging.Enter(delegate(StatesInstance smi)
     {
         WiltCondition component = smi.master.gameObject.GetComponent <WiltCondition>();
         if ((UnityEngine.Object)component != (UnityEngine.Object)null && component.IsWilting())
         {
             smi.GoTo(smi.sm.paused);
         }
     }).EventTransition(GameHashes.Wilt, paused, null).ToggleStatusItem(Db.Get().CreatureStatusItems.ExchangingElementConsume, (object)null)
     .ToggleStatusItem(Db.Get().CreatureStatusItems.ExchangingElementOutput, (object)null)
     .Update("EntityElementExchanger", delegate(StatesInstance smi, float dt)
     {
         HandleVector <Game.ComplexCallbackInfo <Sim.MassConsumedCallback> > .Handle handle = Game.Instance.massConsumedCallbackManager.Add(OnSimConsumeCallback, smi.master, "EntityElementExchanger");
         SimMessages.ConsumeMass(Grid.PosToCell(smi.master.gameObject), smi.master.consumedElement, smi.master.consumeRate * dt, 3, handle.index);
     }, UpdateRate.SIM_1000ms, false);
     paused.EventTransition(GameHashes.WiltRecover, exchanging, null);
 }
Example #4
0
    public void Refresh(HarvestDesignatable target_harvestable)
    {
        Image          image          = bar.GetComponent <HierarchyReferences>().GetReference("Fill") as Image;
        AmountInstance amountInstance = Db.Get().Amounts.Maturity.Lookup(target_harvestable);

        if (amountInstance != null)
        {
            float         num           = amountInstance.value / amountInstance.GetMax();
            RectTransform rectTransform = image.rectTransform;
            Vector2       offsetMin     = image.rectTransform.offsetMin;
            rectTransform.offsetMin = new Vector2(offsetMin.x, 3f);
            if (bar.activeSelf != !target_harvestable.CanBeHarvested())
            {
                bar.SetActive(!target_harvestable.CanBeHarvested());
            }
            float         num2           = (!target_harvestable.CanBeHarvested()) ? (19f - 19f * num + 3f) : 3f;
            RectTransform rectTransform2 = image.rectTransform;
            Vector2       offsetMax      = image.rectTransform.offsetMax;
            rectTransform2.offsetMax = new Vector2(offsetMax.x, 0f - num2);
        }
        else if (bar.activeSelf)
        {
            bar.SetActive(false);
        }
        WiltCondition component = target_harvestable.GetComponent <WiltCondition>();

        if ((Object)component != (Object)null)
        {
            for (int i = 0; i < horizontal_containers.Length; i++)
            {
                horizontal_containers[i].SetActive(false);
            }
            foreach (KeyValuePair <WiltCondition.Condition, GameObject> condition_icon in condition_icons)
            {
                condition_icon.Value.SetActive(false);
            }
            if (component.IsWilting())
            {
                vertical_container.SetActive(true);
                image.color = wilting_color;
                List <WiltCondition.Condition> list = component.CurrentWiltSources();
                if (list.Count > 0)
                {
                    for (int j = 0; j < list.Count; j++)
                    {
                        if (condition_icons.ContainsKey(list[j]))
                        {
                            condition_icons[list[j]].SetActive(true);
                            horizontal_containers[j / 2].SetActive(true);
                            condition_icons[list[j]].transform.SetParent(horizontal_containers[j / 2].transform);
                        }
                    }
                }
            }
            else
            {
                vertical_container.SetActive(false);
                image.color = growing_color;
            }
        }
        else
        {
            image.color = growing_color;
            vertical_container.SetActive(false);
        }
    }