public static Item LoadItem(string resref) { AuroraUTI ai = data.Get <AuroraUTI>(resref, ResourceType.UTI); Item i = Item.Create(ai); return(i); }
// An item has a thumbnail and a clickable button next to it public Item(float w, float h, AuroraEngine.Item item) : base(w, h) { this.item = item; template = (AuroraUTI)item.template; tex = AuroraEngine.Resources.LoadTexture2D( AuroraEngine.Resources.From2DA("baseitems", template.BaseItem, "defaulticon") ); if (tex == null) { tex = Texture2D.blackTexture; } name = AuroraEngine.Resources.GetString(template.LocalizedName); button = new Button(w, h, name); }
public WeaponType GetWeaponType() { AuroraUTI item = (AuroraUTI)this.template; string isRangedStr = Resources.From2DA("baseitems", item.BaseItem, "rangedweapon"); if (isRangedStr == null) { isRangedStr = "0"; } int isRanged = int.Parse(isRangedStr); if (isRanged > 0) { return(WeaponType.RANGED); } return(WeaponType.MELEE); }
public static Item Create(AuroraUTI uti) { GameObject gameObject; //get the resource reference for this object, which we'll use as it's in-engine name string name = uti.TemplateResRef; //get the appearance row number in baseitems.2da int appearance = uti.BaseItem; //get the model name for this appearance id string modelRef = Resources.Load2DA("baseitems")[appearance, "defaultmodel"]; //create a new game object and load the model into the scene gameObject = Resources.LoadModel(modelRef); gameObject.name = name; //add the template component to the new object Item item = gameObject.AddComponent <Item>(); item.template = uti; return(item); }