コード例 #1
0
 /// <summary>
 /// Sets the leaves to be used based on the SpawnResource ID (only works for those already in the game)
 /// </summary>
 /// <param name="ID">The ID to get the leaves from</param>
 public FruitPlantableTemplate SetCustomLeaves(SpawnResource.Id ID)
 {
     if (GardenObjects.modelLeavesMeshs.ContainsKey(ID))
     {
         leavesID = ID;
     }
     return(this);
 }
コード例 #2
0
 /// <summary>
 /// Sets the tree to be used based on the SpawnResource ID (only works for those already in the game)
 /// </summary>
 /// <param name="ID">The ID to get the tree from</param>
 public FruitPlantableTemplate SetCustomTree(SpawnResource.Id ID)
 {
     if (GardenObjects.modelTreeMeshs.ContainsKey(ID))
     {
         treeID = ID;
     }
     return(this);
 }
コード例 #3
0
        /// <summary>
        /// Sets the sprout to be used based on the SpawnResource ID (only works for those already in the game)
        /// </summary>
        /// <param name="ID">The ID to get the sprout from</param>
        public VeggiePlantableTemplate SetCustomSprout(SpawnResource.Id ID)
        {
            if (GardenObjects.modelSproutMeshs.ContainsKey(ID))
            {
                sproutID = ID;
            }

            return(this);
        }
コード例 #4
0
 public override void ReadData(BinaryReader reader)
 {
     if (ModdedSaveData.LATEST_READ_VERSION > 3)
     {
         Version = reader.ReadInt32();
     }
     attachedId = (SpawnResource.Id)reader.ReadInt32();
     upgrades.Read(reader);
 }
コード例 #5
0
        private void Handle_Garden_Patch_Destroyed()
        {
            SpawnResource plot = base.gameObject.GetComponent <SpawnResource>();

            SpawnResource.Id ID = plot ? plot.id : SpawnResource.Id.NONE;

            object return_value = new object();

            SiscosHooks.call(HOOK_ID.Destroyed_Garden_Patch, base.gameObject, ref return_value, new object[] { ID });
        }
コード例 #6
0
        /// <summary>
        /// Adds a component to any spawn resource (or the ones in the white list)
        /// </summary>
        /// <typeparam name="T">Type of component to add</typeparam>
        /// <param name="whiteList">White list to add component to (null will add to all)</param>
        public static void AddComponentToSpawnResource <T>(ICollection <SpawnResource.Id> whiteList = null) where T : Component
        {
            foreach (string name in System.Enum.GetValues(typeof(SpawnResource.Id)))
            {
                SpawnResource.Id ID = EnumUtils.Parse <SpawnResource.Id>(name);
                if (whiteList != null && !whiteList.Contains(ID))
                {
                    continue;
                }

                GameContext.Instance.LookupDirector.GetResourcePrefab(ID).AddComponent <T>();
            }
        }
コード例 #7
0
        /// <summary>
        /// Template to create new veggie plantables
        /// </summary>
        /// <param name="name">The name of the object (prefixes are recommended, but not needed)</param>
        /// <param name="isDeluxe">Is this plantable for the deluxe version of the garden?</param>
        /// <param name="ID">The ID of the identifiable spawned by this plantable</param>
        /// <param name="resID">The spawn resource id for this plantable</param>
        /// <param name="toSpawn">The list of things to spawn (null to get it from the ID provided)</param>
        public VeggiePlantableTemplate(string name, bool isDeluxe, Identifiable.Id ID, SpawnResource.Id resID, List <GameObject> toSpawn = null) : base(name)
        {
            this.isDeluxe = isDeluxe;
            this.ID       = ID;
            this.resID    = resID;

            if (toSpawn == null)
            {
                this.toSpawn.Add(GameContext.Instance.LookupDirector.GetPrefab(ID));
            }
            else
            {
                this.toSpawn = toSpawn;
            }
        }
コード例 #8
0
            public Spawnable(SpawnResource.Id ID, Identifiable.Id identID, bool veggie, GameObject[] objectsToSpawn, GameObject[] bonusObjectsToSpawn, Mesh sprout, Material[] sproutMaterials)
            {
                this.ID      = ID;
                this.identID = identID;
                this.veggie  = veggie;

                if (objectsToSpawn != null)
                {
                    this.objectsToSpawn.AddRange(objectsToSpawn);
                }
                else
                {
                    this.objectsToSpawn.Add(GameContext.Instance.LookupDirector.GetPrefab(identID));
                }

                if (bonusObjectsToSpawn != null)
                {
                    this.bonusObjectsToSpawn.AddRange(bonusObjectsToSpawn);
                }

                this.sprout          = sprout;
                this.sproutMaterials = sproutMaterials;
            }
コード例 #9
0
 public override void Pull(VanillaLandPlotData data)
 {
     attachedId      = GiveBackIfModded(data.attachedId);
     data.attachedId = GiveNoneIfModded(data.attachedId);
     upgrades.Pull(data.upgrades);
 }
コード例 #10
0
 /// <summary>
 /// Gets a spawn resource item
 /// </summary>
 /// <typeparam name="T">Type of item</typeparam>
 /// <param name="id">ID of the item</param>
 /// <returns>Item found or null if nothing is found</returns>
 public static T Get <T>(SpawnResource.Id id) where T : SpawnResourceItem
 {
     return(!Items.ContainsKey(id) || !(Items[id] is T) ? null : Items[id] as T);
 }