36 lines
966 B
C#
36 lines
966 B
C#
using System;
|
|
using GeometryTD.Definition;
|
|
using UnityEngine;
|
|
|
|
namespace GeometryTD.Entity.EntityData
|
|
{
|
|
[Serializable]
|
|
public class TowerData : EntityDataBase
|
|
{
|
|
[SerializeField] private TowerStatsData _stats = new TowerStatsData();
|
|
[SerializeField] private int _towerLevel = 0;
|
|
|
|
public TowerData(int entityId, int typeId, Vector3 position, Quaternion rotation,
|
|
TowerStatsData stats, int towerLevel = 0)
|
|
: base(entityId, typeId)
|
|
{
|
|
Position = position;
|
|
Rotation = rotation;
|
|
_stats = stats ?? new TowerStatsData();
|
|
_towerLevel = Mathf.Max(0, towerLevel);
|
|
}
|
|
|
|
public TowerStatsData Stats
|
|
{
|
|
get => _stats;
|
|
set => _stats = value ?? new TowerStatsData();
|
|
}
|
|
|
|
public int TowerLevel
|
|
{
|
|
get => _towerLevel;
|
|
set => _towerLevel = Mathf.Max(0, value);
|
|
}
|
|
}
|
|
}
|