调整部分数据表配置,优化 SpriteCache 功能
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using SepCore.Definition;
|
||||
using UnityEngine;
|
||||
|
||||
namespace SepCore.Entity
|
||||
{
|
||||
[Serializable]
|
||||
public class EnemyData : TargetableObjectData
|
||||
{
|
||||
private readonly EnemyConfig _enemyConfig;
|
||||
|
||||
public EnemyData(int entityId, EnemyConfig enemyConfig, int level)
|
||||
: base(enemyConfig.Prefab, entityId, CampType.Enemy)
|
||||
{
|
||||
_enemyConfig = enemyConfig;
|
||||
int effectiveLevel = Mathf.Max(1, level);
|
||||
MaxHealthBase = enemyConfig.MaxHealth + enemyConfig.HpAddPerLevel * (effectiveLevel - 1);
|
||||
}
|
||||
|
||||
public EnemyType EnemyType => _enemyConfig.EnemyType;
|
||||
|
||||
public string LogicType => _enemyConfig.LogicType;
|
||||
|
||||
public override int MaxHealthBase { get; }
|
||||
|
||||
public int AttackDamage => _enemyConfig.AttackDamage;
|
||||
|
||||
public float AttackCooldown => _enemyConfig.AttackCooldown;
|
||||
|
||||
public float AttackRange => _enemyConfig.AttackRange;
|
||||
|
||||
public float SpeedBase => _enemyConfig.Speed;
|
||||
|
||||
public int DropCoin => _enemyConfig.CoinDrop;
|
||||
|
||||
public int DropExp => _enemyConfig.ExpDrop;
|
||||
|
||||
public float DropPercent => _enemyConfig.DropPercent;
|
||||
|
||||
public float Scale => _enemyConfig.Scale;
|
||||
|
||||
public Color Color
|
||||
{
|
||||
get
|
||||
{
|
||||
// 空/非法颜色值视为无染色(乘以白色)。
|
||||
return ColorUtility.TryParseHtmlString(_enemyConfig.Color, out Color color)
|
||||
? color
|
||||
: 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