Scriptum/Assets/Scripts/REFACTORING/Models/Shared/PrefabAssetModelData.cs

39 lines
952 B
C#

using System;
using UnityEngine;
[Serializable]
public class PrefabAssetModelData
{
[SerializeField] public string Name;
[SerializeField] public string PrefabAssetName;
[SerializeField] public float[] Position;
public PrefabAssetModelData(PrefabAssetModel assetModel)
{
Name = assetModel.Name;
PrefabAssetName = assetModel.PrefabAssetName;
Position = new float[3];
Position[0] = assetModel.Position.x;
Position[1] = assetModel.Position.y;
Position[2] = assetModel.Position.z;
}
public virtual PrefabAssetModelData PrefabAssetModelToData(PrefabAssetModel assetModel)
{
return new PrefabAssetModelData(assetModel);
}
public virtual PrefabAssetModel MapDataToPrefabAssetModel()
{
return new PrefabAssetModel(
Name,
PrefabAssetName,
new Vector3(Position[0], Position[1], Position[2])
);
}
}