public override void InstantiateThis(EnumResourceType materialType) { if (matDict.ContainsKey(materialType.ToString())) { gameObject.GetComponent <MeshRenderer>().material = matDict[materialType.ToString()]; } }
public ResourceFilterAttribute(EnumResourceType resouceType, params string[] fileFilter) : this(fileFilter) { this.ResourceTypeFilter = new EnumResourceType[1] { resouceType }; }
public int ResourceRequestReserve(EnumResourceType resourceType, int ammount) { if (this.m_ResourcesStored[resourceType] >= ammount) { this.m_ResourcesStored[resourceType] -= ammount; return(ammount); } else { int _Temp = this.m_ResourcesStored[resourceType]; this.m_ResourcesStored[resourceType] -= _Temp; return(_Temp); } }
/// <summary> /// /// </summary> /// <param name="Item">This is one of many types of Enums (ClothingItems, EquipableItem, TrinketItem, ConsumableItem, ContainerItem) </param> /// <param name="resourceType"></param> /// <param name="ItemType"></param> /// <returns></returns> public GameObject CreateCraftableItem(object Item, EnumResourceType resourceType, EnumItemTypes ItemType) { print("Creating Game Object "); GameObject item = null; switch (ItemType) { case EnumItemTypes.ClothingItem: item = CreateCraftableItem(Item, resourceType, ClothingPrefabDict); break; case EnumItemTypes.EquipableItem: item = CreateCraftableItem(Item, resourceType, EquipablePrefabDict); break; default: break; } return(item); }
public int GetResourcesCounter(EnumRace race, EnumSex sex, EnumResourceType type, int skin) { var dir = type == EnumResourceType.Skin ? Util.GeneratorCharasetPath : Util.GeneratorPortraitPath; string prefix = string.Format("{0}_{1}_{2}", race, sex, type); if (type == EnumResourceType.Skin) { prefix = string.Format("{0}_{1}_Skin", race, sex); } string sufix = ""; switch (type) { case EnumResourceType.Face: case EnumResourceType.Nose: sufix = string.Format("Skin{0}", skin); break; } var pattern = string.Format("{0}*{1}.png", prefix, sufix); var files = Directory.GetFiles(dir, pattern); return(files.Length); }
/// <summary> /// Every Craftable Item is created through this function /// </summary> /// <param name="Item">This is one of many types of Enums (ClothingItems, EquipableItem, TrinketItem, ConsumableItem, ContainerItem)</param> /// <param name="resourceType"></param> /// <param name="itemDictionary"></param> /// <returns></returns> private GameObject CreateCraftableItem(object Item, EnumResourceType resourceType, Dictionary <string, GameObject> itemDictionary) { GameObject item = null; if (itemDictionary.ContainsKey(Item.ToString() + "Prefab")) { print("The prefab was found "); item = GameObject.Instantiate(itemDictionary[Item.ToString() + "Prefab"]); item.GetComponent <BasePrefabInterface>().constructor(Item); print(item.ToString()); //Extract the prefab info to ensure right resourceType. if (item.GetComponent <BasePrefabInterface>().matDict.ContainsKey(resourceType.ToString())) { item.GetComponent <BasePrefabInterface>().InstantiateThis(resourceType); } else { print("Material does not match"); Destroy(item); } } return(item); }
public string GetResourcesPath(bool isPortrait, int index, EnumRace race, EnumSex sex, EnumResourceType type, int skin) { string basePath = isPortrait ? Util.GeneratorPortraitPath : Util.GeneratorCharasetPath; string path = ""; switch (type) { case EnumResourceType.Skin: path = string.Format(@"{0}/{1}_{2}_Skin{3}.png", basePath, race, sex, skin); break; case EnumResourceType.Face: case EnumResourceType.Nose: path = string.Format(@"{0}/{1}_{2}_{3}{4}_Skin{5}.png", basePath, race, sex, type, index, skin); break; case EnumResourceType.Ears: path = string.Format(@"{0}/{1}_{2}_{3}_Skin{4}.png", basePath, race, sex, type, skin); break; case EnumResourceType.Hair1: case EnumResourceType.Hair2: path = string.Format(@"{0}/{1}_{2}_{3}_{4}.png", basePath, race, sex, type, index); break; default: path = string.Format(@"{0}/{1}_{2}_{3}{4}.png", basePath, race, sex, type, index); break; } return(path); }
/// <summary> /// Every Non Cractable Item is created this way (It doesnt need a resource type /// </summary> /// <param name="resource"></param> /// <returns></returns> public GameObject CreateResource(EnumResourceType resource) { return(null); }
public ResourceItemData(EnumResourceType type, string path, string plistFile) : base(type, path, plistFile) { }
public ResourceItemData(EnumResourceType type, string path) : base(type, path) { }
public ResourceData(EnumResourceType type, string path, string plist) { this.Type = type; this.Path = path == null ? string.Empty : path; this.Plist = plist == null ? string.Empty : plist; }
public ResourceData(EnumResourceType type, string path) : this(type, path, string.Empty) { }
public void ResourceAddToReserves(EnumResourceType resourceType, int ammount) { this.m_ResourcesStored[resourceType] = this.m_ResourcesStored[resourceType] + ammount; }
public int ResourceGetReserveStatus(EnumResourceType resourceType) { return(this.m_ResourcesStored[resourceType]); }
public abstract void InstantiateThis(EnumResourceType materialType);