60 lines
1.6 KiB
C#
60 lines
1.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using SepCore.DataTable;
|
|
using SepCore.Definition;
|
|
using UnityEngine;
|
|
|
|
namespace SepCore.Entity
|
|
{
|
|
[Serializable]
|
|
public class EnemyData : TargetableObjectData
|
|
{
|
|
private DREnemy _drEnemy;
|
|
|
|
public EnemyData(int entityId, DREnemy drEnemy, int level) : base(
|
|
entityId, drEnemy.Id, CampType.Enemy)
|
|
{
|
|
_drEnemy = drEnemy;
|
|
int effectiveLevel = Mathf.Max(1, level);
|
|
MaxHealthBase = _drEnemy.MaxHealth + _drEnemy.HpAddPerLevel * (effectiveLevel - 1);
|
|
}
|
|
|
|
public EnemyType EnemyType => (EnemyType)_drEnemy.Id;
|
|
|
|
public int EntityTypeId => _drEnemy.EntityTypeId;
|
|
|
|
public override int MaxHealthBase { get; }
|
|
|
|
public int AttackDamage => _drEnemy.AttackDamage;
|
|
|
|
public float AttackCooldown => _drEnemy.AttackCooldown;
|
|
|
|
public float AttackRange => _drEnemy.AttackRange;
|
|
|
|
public float SpeedBase => _drEnemy.Speed;
|
|
|
|
public int DropCoin => _drEnemy.DropCoin;
|
|
|
|
public int DropExp => _drEnemy.DropExp;
|
|
|
|
public float DropPercent => _drEnemy.DropPercent;
|
|
|
|
public float Scale => _drEnemy.Scale;
|
|
|
|
public Color Color => _drEnemy.Color;
|
|
|
|
public IReadOnlyDictionary<string, string> Params => _drEnemy.Params;
|
|
|
|
public bool TryGetParam(string key, out string value)
|
|
{
|
|
value = null;
|
|
if (string.IsNullOrEmpty(key) || _drEnemy?.Params == null)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
return _drEnemy.Params.TryGetValue(key, out value);
|
|
}
|
|
}
|
|
}
|