60 lines
1.7 KiB
C#
60 lines
1.7 KiB
C#
using System;
|
|
using GeometryTD.Definition;
|
|
using UnityEngine;
|
|
|
|
namespace GeometryTD.Entity.EntityData
|
|
{
|
|
[Serializable]
|
|
public class TowerData : EntityDataBase
|
|
{
|
|
[SerializeField] private TowerStatsData _stats;
|
|
[SerializeField] private int _towerLevel = 0;
|
|
[SerializeField] private Color _muzzleColor;
|
|
[SerializeField] private Color _bearingColor;
|
|
[SerializeField] private Color _baseColor;
|
|
|
|
public TowerData(int entityId, int typeId, Vector3 position, Quaternion rotation,
|
|
TowerStatsData stats, int towerLevel = 0, Color? muzzleColor = null, Color? bearingColor = null,
|
|
Color? baseColor = null)
|
|
: base(entityId, typeId)
|
|
{
|
|
Position = position;
|
|
Rotation = rotation;
|
|
_stats = stats ?? new TowerStatsData();
|
|
_towerLevel = Mathf.Max(0, towerLevel);
|
|
_muzzleColor = muzzleColor ?? Color.white;
|
|
_bearingColor = bearingColor ?? Color.white;
|
|
_baseColor = baseColor ?? Color.white;
|
|
}
|
|
|
|
public TowerStatsData Stats
|
|
{
|
|
get => _stats;
|
|
set => _stats = value ?? new TowerStatsData();
|
|
}
|
|
|
|
public int TowerLevel
|
|
{
|
|
get => _towerLevel;
|
|
set => _towerLevel = Mathf.Max(0, value);
|
|
}
|
|
|
|
public Color MuzzleColor
|
|
{
|
|
get => _muzzleColor;
|
|
set => _muzzleColor = value;
|
|
}
|
|
|
|
public Color BearingColor
|
|
{
|
|
get => _bearingColor;
|
|
set => _bearingColor = value;
|
|
}
|
|
|
|
public Color BaseColor
|
|
{
|
|
get => _baseColor;
|
|
set => _baseColor = value;
|
|
}
|
|
}
|
|
} |