迁移数据表到 Luban,移除 JsonNet、EnumUtility
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using SepCore.Definition;
|
||||
using UnityEngine;
|
||||
|
||||
namespace SepCore.Entity
|
||||
{
|
||||
[Serializable]
|
||||
public class EnemyData : TargetableObjectData
|
||||
{
|
||||
private readonly EnemyConfig _enemyConfig;
|
||||
private readonly EnemyType _enemyType;
|
||||
|
||||
public EnemyData(int entityId, EnemyConfig enemyConfig, EnemyType enemyType, int level)
|
||||
: base(enemyConfig != null ? enemyConfig.Prefab : string.Empty, entityId, CampType.Enemy)
|
||||
{
|
||||
_enemyConfig = enemyConfig;
|
||||
_enemyType = enemyType;
|
||||
int effectiveLevel = Mathf.Max(1, level);
|
||||
MaxHealthBase = _enemyConfig != null
|
||||
? _enemyConfig.MaxHealth + _enemyConfig.HpAddPerLevel * (effectiveLevel - 1)
|
||||
: 100;
|
||||
}
|
||||
|
||||
public EnemyType EnemyType => _enemyType;
|
||||
|
||||
public override int MaxHealthBase { get; }
|
||||
|
||||
public int AttackDamage => _enemyConfig?.AttackDamage ?? 0;
|
||||
|
||||
public float AttackCooldown => _enemyConfig?.AttackCooldown ?? 1f;
|
||||
|
||||
public float AttackRange => _enemyConfig?.AttackRange ?? 1.5f;
|
||||
|
||||
public float SpeedBase => _enemyConfig?.Speed ?? 2f;
|
||||
|
||||
public int DropCoin => _enemyConfig?.CoinDrop ?? 0;
|
||||
|
||||
public int DropExp => _enemyConfig?.ExpDrop ?? 0;
|
||||
|
||||
public float DropPercent => _enemyConfig?.DropPercent ?? 0f;
|
||||
|
||||
public float Scale => _enemyConfig?.Scale ?? 1f;
|
||||
|
||||
public Color Color
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_enemyConfig != null &&
|
||||
!string.IsNullOrEmpty(_enemyConfig.Color) &&
|
||||
ColorUtility.TryParseHtmlString(_enemyConfig.Color, out Color color))
|
||||
{
|
||||
return color;
|
||||
}
|
||||
|
||||
return Color.white;
|
||||
}
|
||||
}
|
||||
|
||||
public IReadOnlyDictionary<string, string> Params => null;
|
||||
|
||||
public bool TryGetParam(string key, out string value)
|
||||
{
|
||||
value = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1b802c30cc274e04929b8659ec631e84
|
||||
timeCreated: 1768890974
|
||||
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using SepCore.Definition;
|
||||
using UnityEngine;
|
||||
|
||||
namespace SepCore.Entity
|
||||
{
|
||||
[Serializable]
|
||||
public class EnemyProjectileData : EntityDataBase
|
||||
{
|
||||
public EnemyProjectileData(int entityId, int ownerEntityId, CampType ownerCamp, int attackDamage,
|
||||
float speed, float lifeTime, Vector3 direction, string assetName = "BulletHandgun")
|
||||
: base(assetName, entityId)
|
||||
{
|
||||
OwnerEntityId = ownerEntityId;
|
||||
OwnerCamp = ownerCamp;
|
||||
AttackDamage = attackDamage;
|
||||
Speed = speed;
|
||||
LifeTime = lifeTime;
|
||||
Direction = direction;
|
||||
}
|
||||
|
||||
public int OwnerEntityId { get; }
|
||||
public CampType OwnerCamp { get; }
|
||||
public int AttackDamage { get; }
|
||||
public float Speed { get; }
|
||||
public float LifeTime { get; }
|
||||
public Vector3 Direction { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 52b38f83ab6c4029803d40c189db47c7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user