46 lines
1.5 KiB
C#
46 lines
1.5 KiB
C#
using UnityEngine;
|
|
|
|
[System.Serializable]
|
|
public class EquippableItemPrefabAssetData : PrefabAssetModelData
|
|
{
|
|
public EquippableItemData EquippableItemData;
|
|
|
|
public EquippableItemPrefabAssetData(EquippableItemPrefabAsset assetModel) : base(assetModel)
|
|
{
|
|
EquippableItemData = MapModelToData(assetModel.EquippableItem);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Function to convert equitable item (current object partial variable) object to data format
|
|
/// </summary>
|
|
/// <param name="equippableItem"></param>
|
|
/// <returns></returns>
|
|
public EquippableItemData MapModelToData(EquippableItem equippableItem)
|
|
{
|
|
return new EquippableItemData(equippableItem);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Function to convert EquippableItem Asset format to data format
|
|
/// </summary>
|
|
/// <param name="assetModel"></param>
|
|
/// <returns></returns>
|
|
public override PrefabAssetModelData PrefabAssetModelToData(PrefabAssetModel assetModel)
|
|
{
|
|
return new EquippableItemPrefabAssetData((EquippableItemPrefabAsset)assetModel);
|
|
}
|
|
|
|
public override PrefabAssetModel MapDataToPrefabAssetModel()
|
|
{
|
|
EquippableItemPrefabAsset equippableItemPrefabAsset = new EquippableItemPrefabAsset(
|
|
Name,
|
|
PrefabAssetName,
|
|
new Vector3(Position[0], Position[1], Position[2])
|
|
);
|
|
|
|
equippableItemPrefabAsset.EquippableItem = (EquippableItem)EquippableItemData.MapDataToObject(equippableItemPrefabAsset.PrefabAssetName);
|
|
|
|
return equippableItemPrefabAsset;
|
|
}
|
|
}
|