RealizeMethodsInItemManager

This commit is contained in:
Kaktus200020 2024-08-15 14:50:09 +03:00
parent ba42178c38
commit a779d9078e
2 changed files with 25 additions and 3 deletions

View file

@ -15,10 +15,23 @@ namespace ZoFo.GameCore.GameManagers.ItemManager
Texture2D itemTexture; Texture2D itemTexture;
bool isCraftable; bool isCraftable;
Dictionary<string, int> resourcesNeededToCraft; Dictionary<string, int> resourcesNeededToCraft;
public ItemInfo (string tag)
{
this.tag = tag;
}
public ItemInfo(string tag,string textureName,bool isCraftable, Dictionary<string, int> resourcesNeededToCraft)
{
this.tag = tag;
this.textureName = textureName;
this.isCraftable = isCraftable;
this.resourcesNeededToCraft = resourcesNeededToCraft;
}
//методы //методы
private void LoadTexture() public void LoadTexture()
{ {
//я что-то хз как это //я что-то хз как это
itemTexture=AppManager.Instance.Content.Load<Texture2D>(textureName);
} }
} }
} }

View file

@ -15,9 +15,18 @@ namespace ZoFo.GameCore.GameManagers.ItemManager
{ {
return tagItemPairs.GetValueOrDefault(tag); return tagItemPairs.GetValueOrDefault(tag);
} }
void LoadItemTexture() void LoadItemTextures()
{ {
foreach (var item in tagItemPairs)
{
item.Value.LoadTexture();
}
}
void Initialize()
{
tagItemPairs.Add("wood", new ItemInfo("wood","wood",false,null));
tagItemPairs.Add("rock", new ItemInfo("rock", "rock", false, null));
tagItemPairs.Add("steel", new ItemInfo("steel", "steel", false, null));
} }
} }