Пример #1
0
 public override void Clear()
 {
     if (activeType != null)
     {
         activeType.active = false;
         activeType.Clear();
         activeType = null;
         SetDirty();
     }
 }
Пример #2
0
        public override void Update()
        {
            //Find selected thing or thing to build
            ThingDef def = null;

            if (Find.DesignatorManager.SelectedDesignator is Designator_Place des)
            {
                def = des.PlacingDef as ThingDef;
            }
            if (def == null)
            {
                def = Find.Selector.SingleSelectedThing.GetInnerIfMinified()?.def;
            }
            if (def != null)
            {
                def = GenConstruct.BuiltDefOf(def) as ThingDef;
                foreach (CoverageType cov in types)
                {
                    if (cov.MakeActive(def))
                    {
                        SetDirty();
                        if (cov.active)
                        {
                            activeType = cov;
                        }
                        else
                        {
                            Clear();
                        }
                    }
                }

                if (dirty)                  //From MakeActive or otherwise
                {
                    activeType?.Init();
                }
            }
            else if (activeType != null)
            {
                Clear();
            }

            base.Update();
        }