Scriptum/Assets/Scripts/REFACTORING/Models/Item/EquippableItem/EquippableItemPrefabAsset.cs

44 lines
1.3 KiB
C#
Raw Normal View History

2022-11-06 21:34:17 +01:00
using UnityEditor;
using UnityEngine;
[System.Serializable]
public class EquippableItemPrefabAsset : PrefabAssetModel
{
[SerializeField]
public EquippableItem EquippableItem = null;
public EquippableItemPrefabAsset() { }
public EquippableItemPrefabAsset(string _name, string _prefabAssetName, Vector3 _position, EquippableItem _equippableItem = null)
: base(_name, _prefabAssetName, _position)
{
EquippableItem = _equippableItem;
}
/// <summary>
///
/// </summary>
/// <param name="_name"></param>
/// <param name="_prefabAssetName"></param>
/// <param name="_position"></param>
/// <param name="_equippableItemName">the name by which the system will search for the item</param>
public EquippableItemPrefabAsset(string _name, string _prefabAssetName, Vector3 _position, string _equippableItemName)
: base(_name, _prefabAssetName, _position)
{
2022-11-27 21:28:55 +01:00
// 3.2 set EquippableItem object
EquippableItem = Resources.Load<EquippableItem>("Items/" + _equippableItemName);
2022-11-06 21:34:17 +01:00
}
/// <summary>
/// Function to convert Prefab Asset model to data object
/// </summary>
/// <returns></returns>
public EquippableItemPrefabAssetData MapPrefabAssetModelToData()
{
return new EquippableItemPrefabAssetData(this);
}
}