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

39 lines
952 B
C#
Raw Normal View History

2022-11-06 21:34:17 +01:00
using System;
using UnityEngine;
[Serializable]
public class PrefabAssetModelData
2022-11-06 21:34:17 +01:00
{
[SerializeField] public string Name;
2022-11-06 21:34:17 +01:00
[SerializeField] public string PrefabAssetName;
2022-11-06 21:34:17 +01:00
[SerializeField] public float[] Position;
2022-11-06 21:34:17 +01:00
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);
}
2022-11-06 21:34:17 +01:00
public virtual PrefabAssetModel MapDataToPrefabAssetModel()
{
return new PrefabAssetModel(
Name,
PrefabAssetName,
new Vector3(Position[0], Position[1], Position[2])
);
}
2022-11-06 21:34:17 +01:00
}