Scriptum/Assets/Scripts/SceneManager/SaveItem/EquippableItemData/EquippableItemData.cs

62 lines
2.0 KiB
C#
Raw Permalink Normal View History

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
[System.Serializable]
public class EquippableItemData : ItemData
{
public int strengthBonus;
public int agilityBonus;
public int inteligenceBonus;
public int vitalityBonus;
public bool isStackable;
public EquipmentType equipmentType;
private const string ITEM_LOCALIZATION = "Assets/Items/";
public EquippableItemData(EquippableItem equippableItem) : base(equippableItem)
{
strengthBonus = equippableItem.StrengthBonus;
agilityBonus = equippableItem.AgilityBonus;
inteligenceBonus = equippableItem.InteligenceBonus;
vitalityBonus = equippableItem.VitalityBonus;
isStackable = equippableItem.isStackable;
equipmentType = equippableItem.EquipmentType;
}
public EquippableItem MapDataToEquippableItem(string prefarbAssetName)
{
// Find prefarb in Assets/
//Debug.Log("MapDataToEquippableItem: " + ITEM_LOCALIZATION + prefarbAssetName + ".asset");
EquippableItem equippableItem = (EquippableItem)AssetDatabase.LoadAssetAtPath(ITEM_LOCALIZATION + prefarbAssetName + ".asset", typeof(EquippableItem));
///
// DONT OVERWRITE PROPERTIES BECOUSE ITS EDIT MAIN OBJECT IN ASSET/
///
// equippableItem.StrengthBonus = strengthBonus;
// equippableItem.AgilityBonus = agilityBonus;
// equippableItem.InteligenceBonus = inteligenceBonus;
// equippableItem.VitalityBonus = vitalityBonus;
// equippableItem.isStackable = isStackable;
// equippableItem.EquipmentType = equipmentType;
// Item item = base.MapDataToItem(prefarbAssetName);
// equippableItem.Name = item.Name;
// equippableItem.Description = item.Description;
// equippableItem.Level = item.Level;
// equippableItem.ItemModel = item.ItemModel;
// equippableItem.Image = item.Image;
return equippableItem;
}
}