添加 SepCore.Runtime 和 SepCore.Base 程序集

- 暂时将 Entity 全部归进 Runtime 程序集里
- 调整部分 UI 的 UseCase/RawData/Context 之间的关系,让 RawData 更接近业务原始数据,Context 更接近 UI 直接可读的数据
- 调整其他程序集的引用关系
This commit is contained in:
SepComet
2026-06-03 11:15:58 +08:00
parent d5893ac52b
commit 91f70dd783
176 changed files with 245 additions and 231 deletions
@@ -0,0 +1,49 @@
using Entity.EntityData;
using UnityEngine;
using UnityGameFramework.Runtime;
namespace Entity
{
public class ExpEntity:EntityBase
{
private ExpData _expData;
private bool _isCollected;
protected override void OnShow(object userData)
{
base.OnShow(userData);
_isCollected = false;
if (userData is ExpData expData)
{
_expData = expData;
}
else
{
Log.Error("expEntity.OnShow() called with wrong type.");
}
this.CachedTransform.localScale = new Vector3(0.3f, 0.3f, 0.3f);
}
public bool TryCollect(Player player, float collectDistance = 0f)
{
if (_isCollected || player == null || !player.Available || _expData == null) return false;
if (collectDistance > 0f)
{
float distance = Vector3.Distance(player.CachedTransform.position, CachedTransform.position);
if (distance > collectDistance) return false;
}
_isCollected = true;
player.Exp += _expData.Value;
GameEntry.Entity.HideEntity(this);
return true;
}
private void OnTriggerEnter(Collider other)
{
TryCollect(other.GetComponent<Player>());
}
}
}