示例#1
0
    public GameObject CreatePrefab()
    {
        string    id          = "ResearchDatabank";
        string    name        = ITEMS.INDUSTRIAL_PRODUCTS.RESEARCH_DATABANK.NAME;
        string    desc        = ITEMS.INDUSTRIAL_PRODUCTS.RESEARCH_DATABANK.DESC;
        float     mass        = 1f;
        bool      unitMass    = true;
        KAnimFile anim        = Assets.GetAnim("floppy_disc_kanim");
        string    initialAnim = "object";

        Grid.SceneLayer sceneLayer = Grid.SceneLayer.Front;
        EntityTemplates.CollisionShape collisionShape = EntityTemplates.CollisionShape.CIRCLE;
        float      width        = 0.35f;
        float      height       = 0.35f;
        bool       isPickupable = true;
        List <Tag> list         = new List <Tag>();

        list.Add(GameTags.IndustrialIngredient);
        list.Add(GameTags.Experimental);
        list = list;
        GameObject     gameObject     = EntityTemplates.CreateLooseEntity(id, name, desc, mass, unitMass, anim, initialAnim, sceneLayer, collisionShape, width, height, isPickupable, 0, SimHashes.Creature, list);
        EntitySplitter entitySplitter = gameObject.AddOrGet <EntitySplitter>();

        entitySplitter.maxStackSize = (float)ROCKETRY.DESTINATION_RESEARCH.BASIC;
        return(gameObject);
    }
示例#2
0
 private static void PickupComplete(Instance smi)
 {
     if (!(bool)smi.targetSeed)
     {
         Debug.LogWarningFormat("PickupComplete seed {0} is null", smi.targetSeed);
     }
     else
     {
         UnreserveSeed(smi);
         int num = Grid.PosToCell(smi.targetSeed);
         if (smi.seed_cell != num)
         {
             Debug.LogWarningFormat("PickupComplete seed {0} moved {1} != {2}", smi.targetSeed, num, smi.seed_cell);
             smi.targetSeed = null;
         }
         else if (smi.targetSeed.HasTag(GameTags.Stored))
         {
             Debug.LogWarningFormat("PickupComplete seed {0} was stored by {1}", smi.targetSeed, smi.targetSeed.storage);
             smi.targetSeed = null;
         }
         else
         {
             smi.targetSeed = EntitySplitter.Split(smi.targetSeed, 1f, null);
             smi.GetComponent <Storage>().Store(smi.targetSeed.gameObject, false, false, true, false);
             AddMouthOverride(smi);
         }
     }
 }
示例#3
0
        /// <summary>
        /// A version of Compostable.OnToggleCompost that does not crash if the select tool
        /// is not in use.
        /// </summary>
        /// <param name="comp">The item to toggle compost.</param>
        private static void DoToggleCompost(Compostable comp)
        {
            var obj        = comp.gameObject;
            var pickupable = obj.GetComponent <Pickupable>();

            if (comp.isMarkedForCompost)
            {
                EntitySplitter.Split(pickupable, pickupable.TotalAmount, comp.originalPrefab);
            }
            else
            {
                pickupable.storage?.Drop(obj, true);
                EntitySplitter.Split(pickupable, pickupable.TotalAmount, comp.compostPrefab);
            }
        }
示例#4
0
 private void OnToggleCompost()
 {
     if (!isMarkedForCompost)
     {
         Pickupable component = GetComponent <Pickupable>();
         if ((UnityEngine.Object)component.storage != (UnityEngine.Object)null)
         {
             component.storage.Drop(base.gameObject, true);
         }
         Pickupable pickupable = EntitySplitter.Split(component, component.TotalAmount, compostPrefab);
         if ((UnityEngine.Object)pickupable != (UnityEngine.Object)null)
         {
             SelectTool.Instance.SelectNextFrame(pickupable.GetComponent <KSelectable>(), true);
         }
     }
     else
     {
         Pickupable component2  = GetComponent <Pickupable>();
         Pickupable pickupable2 = EntitySplitter.Split(component2, component2.TotalAmount, originalPrefab);
         SelectTool.Instance.SelectNextFrame(pickupable2.GetComponent <KSelectable>(), true);
     }
 }