2022-11-19 17:02:31 +01:00
|
|
|
|
using System.Collections;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
[System.Serializable]
|
2022-12-19 03:34:45 +01:00
|
|
|
|
public abstract class ModelData<T, V> : IModelMapper<T>
|
2022-11-19 17:02:31 +01:00
|
|
|
|
{
|
|
|
|
|
[SerializeField]
|
|
|
|
|
public int id;
|
|
|
|
|
|
|
|
|
|
[SerializeField]
|
|
|
|
|
public string name;
|
|
|
|
|
|
|
|
|
|
// to handle object created on scene for example after removing from inventory
|
|
|
|
|
[SerializeField]
|
|
|
|
|
public string modelName;
|
|
|
|
|
|
|
|
|
|
protected virtual string SPRITE_LOCALIZATION => "";
|
|
|
|
|
|
|
|
|
|
protected virtual string MODEL_LOCALIZATION => "";
|
|
|
|
|
|
2022-12-19 03:34:45 +01:00
|
|
|
|
public ModelData() { }
|
|
|
|
|
|
2022-11-19 17:02:31 +01:00
|
|
|
|
public ModelData(int _id, string _name)
|
|
|
|
|
{
|
|
|
|
|
id = _id;
|
|
|
|
|
name = _name;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ModelData(int _id, string _name, string _modelName)
|
|
|
|
|
{
|
|
|
|
|
id = _id;
|
|
|
|
|
name = _name;
|
|
|
|
|
modelName = _modelName; // name of the prefab
|
|
|
|
|
}
|
2022-12-19 03:34:45 +01:00
|
|
|
|
protected abstract V TryFindResource(string modelName);
|
2022-11-19 17:02:31 +01:00
|
|
|
|
|
|
|
|
|
public abstract T MapDataToObject(string prefarbAssetName);
|
|
|
|
|
|
|
|
|
|
public abstract T MapDataToObject();
|
2023-01-01 17:03:35 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public abstract class ModelData<T> : ModelData<T, T>
|
|
|
|
|
{
|
|
|
|
|
|
2022-11-19 17:02:31 +01:00
|
|
|
|
}
|