using System; using GeometryTD.Definition; using UnityEngine; namespace GeometryTD.Entity.EntityData { [Serializable] public class BulletData : EntityDataBase { [SerializeField] private Transform _target = null; [SerializeField] private float _speed = 0f; [SerializeField] private float _maxLifetime = 3f; [SerializeField] private AttackPayload _attackPayload = new AttackPayload(); public BulletData( int entityId, int typeId, Vector3 position, Transform target, AttackPayload attackPayload, float speed, float maxLifetime = 3f) : base(entityId, typeId) { Position = position; _target = target; _attackPayload = attackPayload?.Clone() ?? new AttackPayload(); _speed = speed; _maxLifetime = maxLifetime; } public Transform Target { get => _target; set => _target = value; } public float Speed { get => _speed; set => _speed = value; } public float MaxLifetime { get => _maxLifetime; set => _maxLifetime = value; } public AttackPayload AttackPayload { get => _attackPayload; set => _attackPayload = value?.Clone() ?? new AttackPayload(); } } }