导入敌人模型素材,统一经验和金币掉落物
This commit is contained in:
@@ -1,18 +0,0 @@
|
||||
namespace SepCore.Entity
|
||||
{
|
||||
public class CoinData : EntityDataBase
|
||||
{
|
||||
private int _value;
|
||||
|
||||
public CoinData(int value, int entityId, string assetName = "CoinEntity") : base(assetName, entityId)
|
||||
{
|
||||
_value = value;
|
||||
}
|
||||
|
||||
public int Value
|
||||
{
|
||||
get => _value;
|
||||
set => _value = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d9caee22d67a42018113acc77155d6ba
|
||||
timeCreated: 1770292597
|
||||
@@ -0,0 +1,27 @@
|
||||
namespace SepCore.Entity
|
||||
{
|
||||
public class DropData : EntityDataBase
|
||||
{
|
||||
private int _coinCount;
|
||||
private int _expCount;
|
||||
|
||||
public DropData(int coinCount, int expCount, int entityId, string assetName = "DropEntity")
|
||||
: base(assetName, entityId)
|
||||
{
|
||||
_coinCount = coinCount;
|
||||
_expCount = expCount;
|
||||
}
|
||||
|
||||
public int CoinCount
|
||||
{
|
||||
get => _coinCount;
|
||||
set => _coinCount = value;
|
||||
}
|
||||
|
||||
public int ExpCount
|
||||
{
|
||||
get => _expCount;
|
||||
set => _expCount = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9fde8f604fb5b7646b201ca25bb5b86b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using SepCore.Definition;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -32,10 +31,6 @@ namespace SepCore.Entity
|
||||
|
||||
public float SpeedBase => Config.Speed;
|
||||
|
||||
public int DropCoin => Config.CoinDrop;
|
||||
|
||||
public int DropExp => Config.ExpDrop;
|
||||
|
||||
public float DropPercent => Config.DropPercent;
|
||||
|
||||
public float Scale => Config.Scale;
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
namespace SepCore.Entity
|
||||
{
|
||||
public class ExpData : EntityDataBase
|
||||
{
|
||||
private int _value;
|
||||
|
||||
public ExpData(int value, int entityId, string assetName = "ExpEntity") : base(assetName, entityId)
|
||||
{
|
||||
_value = value;
|
||||
}
|
||||
|
||||
public int Value
|
||||
{
|
||||
get => _value;
|
||||
set => _value = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e0f6c8e117da49f1ad04fd8810882043
|
||||
timeCreated: 1770292932
|
||||
@@ -24,8 +24,6 @@ public sealed partial class EnemyConfig : Luban.BeanBase
|
||||
AttackCooldown = _buf.ReadFloat();
|
||||
AttackRange = _buf.ReadFloat();
|
||||
Speed = _buf.ReadFloat();
|
||||
CoinDrop = _buf.ReadInt();
|
||||
ExpDrop = _buf.ReadInt();
|
||||
DropPercent = _buf.ReadFloat();
|
||||
Scale = _buf.ReadFloat();
|
||||
Color = _buf.ReadString();
|
||||
@@ -71,14 +69,6 @@ public sealed partial class EnemyConfig : Luban.BeanBase
|
||||
/// </summary>
|
||||
public readonly float Speed;
|
||||
/// <summary>
|
||||
/// 金币掉落
|
||||
/// </summary>
|
||||
public readonly int CoinDrop;
|
||||
/// <summary>
|
||||
/// 经验掉落
|
||||
/// </summary>
|
||||
public readonly int ExpDrop;
|
||||
/// <summary>
|
||||
/// 掉落概率
|
||||
/// </summary>
|
||||
public readonly float DropPercent;
|
||||
@@ -112,8 +102,6 @@ public sealed partial class EnemyConfig : Luban.BeanBase
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Prefab_Ref = tables.TbEntityConfig.GetOrDefault(Prefab);
|
||||
}
|
||||
|
||||
@@ -128,8 +116,6 @@ public sealed partial class EnemyConfig : Luban.BeanBase
|
||||
+ "attackCooldown:" + AttackCooldown + ","
|
||||
+ "attackRange:" + AttackRange + ","
|
||||
+ "speed:" + Speed + ","
|
||||
+ "coinDrop:" + CoinDrop + ","
|
||||
+ "expDrop:" + ExpDrop + ","
|
||||
+ "dropPercent:" + DropPercent + ","
|
||||
+ "scale:" + Scale + ","
|
||||
+ "color:" + Color + ","
|
||||
|
||||
@@ -48,8 +48,10 @@ public sealed partial class GlobalConfig : Luban.BeanBase
|
||||
ProjectileEntity = _buf.ReadString();
|
||||
ProjectileEntity_Ref = null;
|
||||
DamageTextYOffset = _buf.ReadInt();
|
||||
EntityAsyncTimeout = _buf.ReadInt();
|
||||
EntityAsyncTimeout = _buf.ReadFloat();
|
||||
CritMultiplier = _buf.ReadFloat();
|
||||
DropEntityCoinCount = _buf.ReadInt();
|
||||
DropEntityExpCount = _buf.ReadInt();
|
||||
EnemyBodyRadius = _buf.ReadFloat();
|
||||
EnemySeparationIterations = _buf.ReadInt();
|
||||
}
|
||||
@@ -184,12 +186,20 @@ public sealed partial class GlobalConfig : Luban.BeanBase
|
||||
/// <summary>
|
||||
/// 实体生成超时时间
|
||||
/// </summary>
|
||||
public readonly int EntityAsyncTimeout;
|
||||
public readonly float EntityAsyncTimeout;
|
||||
/// <summary>
|
||||
/// 暴击伤害倍率
|
||||
/// </summary>
|
||||
public readonly float CritMultiplier;
|
||||
/// <summary>
|
||||
/// 掉落物金币数
|
||||
/// </summary>
|
||||
public readonly int DropEntityCoinCount;
|
||||
/// <summary>
|
||||
/// 掉落物经验数
|
||||
/// </summary>
|
||||
public readonly int DropEntityExpCount;
|
||||
/// <summary>
|
||||
/// 敌人碰撞半径
|
||||
/// </summary>
|
||||
public readonly float EnemyBodyRadius;
|
||||
@@ -237,6 +247,8 @@ public sealed partial class GlobalConfig : Luban.BeanBase
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
@@ -274,6 +286,8 @@ public sealed partial class GlobalConfig : Luban.BeanBase
|
||||
+ "damageTextYOffset:" + DamageTextYOffset + ","
|
||||
+ "entityAsyncTimeout:" + EntityAsyncTimeout + ","
|
||||
+ "critMultiplier:" + CritMultiplier + ","
|
||||
+ "dropEntityCoinCount:" + DropEntityCoinCount + ","
|
||||
+ "dropEntityExpCount:" + DropEntityExpCount + ","
|
||||
+ "enemyBodyRadius:" + EnemyBodyRadius + ","
|
||||
+ "enemySeparationIterations:" + EnemySeparationIterations + ","
|
||||
+ "}";
|
||||
|
||||
@@ -153,12 +153,20 @@ public partial class TbGlobalConfig
|
||||
/// <summary>
|
||||
/// 实体生成超时时间
|
||||
/// </summary>
|
||||
public int EntityAsyncTimeout => _data.EntityAsyncTimeout;
|
||||
public float EntityAsyncTimeout => _data.EntityAsyncTimeout;
|
||||
/// <summary>
|
||||
/// 暴击伤害倍率
|
||||
/// </summary>
|
||||
public float CritMultiplier => _data.CritMultiplier;
|
||||
/// <summary>
|
||||
/// 掉落物金币数
|
||||
/// </summary>
|
||||
public int DropEntityCoinCount => _data.DropEntityCoinCount;
|
||||
/// <summary>
|
||||
/// 掉落物经验数
|
||||
/// </summary>
|
||||
public int DropEntityExpCount => _data.DropEntityExpCount;
|
||||
/// <summary>
|
||||
/// 敌人碰撞半径
|
||||
/// </summary>
|
||||
public float EnemyBodyRadius => _data.EnemyBodyRadius;
|
||||
|
||||
@@ -12,21 +12,23 @@ namespace SepCore.Procedure
|
||||
{
|
||||
public class GameStateBattle : GameStateBase
|
||||
{
|
||||
private const float VacuumMaxDuration = 0.8f;
|
||||
private const float VacuumAbsorbSpeed = 30f;
|
||||
|
||||
public override GameStateType GameStateType => GameStateType.Battle;
|
||||
|
||||
private EnemyManagerComponent _enemyManager;
|
||||
|
||||
private int _currentLevel;
|
||||
|
||||
private TimerHandle _levelTimerHandle;
|
||||
private bool _isWaveEnding;
|
||||
private float _vacuumTimer;
|
||||
|
||||
private Player Player => _procedureGame.Player;
|
||||
|
||||
private ProcedureGame _procedureGame;
|
||||
|
||||
public void AddBattleDuration(float seconds)
|
||||
{
|
||||
if (seconds <= 0f) return;
|
||||
if (_isWaveEnding || seconds <= 0f) return;
|
||||
|
||||
float remaining = GameEntry.Timer.GetRemainingTime(_levelTimerHandle);
|
||||
if (remaining < 0f) return;
|
||||
@@ -45,6 +47,8 @@ namespace SepCore.Procedure
|
||||
public override void OnEnter()
|
||||
{
|
||||
_currentLevel = _procedureGame.CurrentLevel;
|
||||
_isWaveEnding = false;
|
||||
_vacuumTimer = 0f;
|
||||
|
||||
var levelConfig = GameEntry.Luban.Get<LevelConfig>(_currentLevel);
|
||||
_levelTimerHandle = GameEntry.Timer.ScheduleOnce(levelConfig.Duration, OnLevelTimeUp, this);
|
||||
@@ -60,6 +64,21 @@ namespace SepCore.Procedure
|
||||
|
||||
public override void OnUpdate(float elapseSeconds, float realElapseSeconds)
|
||||
{
|
||||
if (_isWaveEnding)
|
||||
{
|
||||
Vector3 currentPos = Player.CachedTransform.position;
|
||||
GameEntry.SimulationWorld.Tick(new SimulationTickContext(elapseSeconds, currentPos));
|
||||
|
||||
_vacuumTimer -= elapseSeconds;
|
||||
if (GameEntry.SimulationWorld.PickupCount == 0 || _vacuumTimer <= 0f)
|
||||
{
|
||||
CollectAllRemainingDrops(Player);
|
||||
_isWaveEnding = false;
|
||||
_procedureGame.BattleToShopOrLevelUp();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
_enemyManager.OnUpdate(elapseSeconds, realElapseSeconds);
|
||||
|
||||
Vector3 playerPosition = Player.CachedTransform.position;
|
||||
@@ -71,15 +90,36 @@ namespace SepCore.Procedure
|
||||
|
||||
private void OnLevelTimeUp()
|
||||
{
|
||||
_procedureGame.BattleToShopOrLevelUp();
|
||||
if (_isWaveEnding) return;
|
||||
|
||||
_isWaveEnding = true;
|
||||
_vacuumTimer = VacuumMaxDuration;
|
||||
|
||||
// 1. 停止玩家移动与射击
|
||||
Player.Enable = false;
|
||||
|
||||
// 2. 清退所有敌人并停止刷怪
|
||||
_enemyManager.OnReset();
|
||||
|
||||
// 3. 隐藏所有投射物
|
||||
HideEntityGroup(GameEntry.Luban.Global.ProjectileGroupName);
|
||||
|
||||
// 4. 触发全图磁铁,并提高吸附速度
|
||||
GameEntry.SimulationWorld.TriggerFullMapMagnet();
|
||||
GameEntry.SimulationWorld.SyncPlayerAbsorbSettings(999f, VacuumAbsorbSpeed, GameEntry.Luban.Global.CollectDistance);
|
||||
}
|
||||
|
||||
public override void OnLeave()
|
||||
{
|
||||
GameEntry.UIRouter.CloseUIAsync(UIFormType.JoystickForm).Forget();
|
||||
|
||||
GameEntry.Timer.Cancel(_levelTimerHandle);
|
||||
_levelTimerHandle = TimerHandle.Invalid;
|
||||
if (_levelTimerHandle.IsValid)
|
||||
{
|
||||
GameEntry.Timer.Cancel(_levelTimerHandle);
|
||||
_levelTimerHandle = TimerHandle.Invalid;
|
||||
}
|
||||
|
||||
_isWaveEnding = false;
|
||||
|
||||
// 隐藏所有敌人实体
|
||||
_enemyManager.OnReset();
|
||||
@@ -98,6 +138,24 @@ namespace SepCore.Procedure
|
||||
_procedureGame = null;
|
||||
}
|
||||
|
||||
private static void CollectAllRemainingDrops(Player player)
|
||||
{
|
||||
if (player == null || !GameEntry.Entity.HasEntityGroup(GameEntry.Luban.Global.DropGroupName))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var entityGroup = GameEntry.Entity.GetEntityGroup(GameEntry.Luban.Global.DropGroupName);
|
||||
var entities = entityGroup.GetAllEntities();
|
||||
foreach (var entity in entities)
|
||||
{
|
||||
if (entity is UnityGameFramework.Runtime.Entity runtimeEntity && runtimeEntity.Logic is DropEntity drop)
|
||||
{
|
||||
drop.TryCollect(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void HideEntityGroup(string groupName)
|
||||
{
|
||||
if (!GameEntry.Entity.HasEntityGroup(groupName))
|
||||
|
||||
@@ -201,26 +201,14 @@ namespace SepCore.AsyncTask
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 异步显示金币掉落实体。
|
||||
/// 异步显示掉落实体。
|
||||
/// </summary>
|
||||
public static UniTask<CoinEntity> ShowCoinAsync(this EntityComponent entityComponent,
|
||||
CoinData data,
|
||||
public static UniTask<DropEntity> ShowDropAsync(this EntityComponent entityComponent,
|
||||
DropData data,
|
||||
float timeout = 30f,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
return ShowEntityByDataAsync<CoinEntity>(entityComponent, typeof(CoinEntity), GameEntry.Luban.Global.DropGroupName,
|
||||
Constant.AssetPriority.EffectAsset, data, timeout, cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 异步显示经验掉落实体。
|
||||
/// </summary>
|
||||
public static UniTask<ExpEntity> ShowExpAsync(this EntityComponent entityComponent,
|
||||
ExpData data,
|
||||
float timeout = 30f,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
return ShowEntityByDataAsync<ExpEntity>(entityComponent, typeof(ExpEntity), GameEntry.Luban.Global.DropGroupName,
|
||||
return ShowEntityByDataAsync<DropEntity>(entityComponent, typeof(DropEntity), GameEntry.Luban.Global.DropGroupName,
|
||||
Constant.AssetPriority.EffectAsset, data, timeout, cancellationToken);
|
||||
}
|
||||
|
||||
|
||||
@@ -63,20 +63,13 @@ namespace SepCore.Components
|
||||
{
|
||||
Transform transformToUnregister = _cachedTransform;
|
||||
|
||||
float defaultRadius = GameEntry.Luban != null && GameEntry.Luban.IsReady
|
||||
? GameEntry.Luban.Global.EnemyBodyRadius / 1000f
|
||||
: 0.5f;
|
||||
int defaultIterations = GameEntry.Luban != null && GameEntry.Luban.IsReady
|
||||
? GameEntry.Luban.Global.EnemySeparationIterations
|
||||
: 4;
|
||||
|
||||
_enemyBodyRadius = GameEntry.Luban.Global.EnemyBodyRadius;
|
||||
_separationIterations = GameEntry.Luban.Global.EnemySeparationIterations;
|
||||
_speedBase = 0;
|
||||
_cachedTransform = null;
|
||||
_direction = Vector3.zero;
|
||||
_isMoving = false;
|
||||
_avoidEnemyOverlap = false;
|
||||
_enemyBodyRadius = defaultRadius;
|
||||
_separationIterations = defaultIterations;
|
||||
_player = null;
|
||||
_enemy = null;
|
||||
|
||||
|
||||
@@ -39,11 +39,10 @@ namespace SepCore.Components
|
||||
public void SetMove(bool canMove)
|
||||
{
|
||||
_canMove = canMove;
|
||||
if (!canMove)
|
||||
{
|
||||
_direction = Vector3.zero;
|
||||
SetWalking(false);
|
||||
}
|
||||
if (canMove) return;
|
||||
|
||||
_direction = Vector3.zero;
|
||||
SetWalking(false);
|
||||
}
|
||||
|
||||
public void SetDirection(Vector3 direction)
|
||||
|
||||
@@ -6,6 +6,8 @@ namespace SepCore.Simulation
|
||||
{
|
||||
SimulationStats Stats { get; }
|
||||
|
||||
int PickupCount { get; }
|
||||
|
||||
void Tick(in SimulationTickContext context);
|
||||
|
||||
void ClearSimulationState();
|
||||
|
||||
+3
-18
@@ -224,33 +224,18 @@ namespace SepCore.Simulation
|
||||
continue;
|
||||
}
|
||||
|
||||
if (entity is CoinEntity coin)
|
||||
if (entity is DropEntity drop)
|
||||
{
|
||||
if (player != null)
|
||||
{
|
||||
coin.TryCollect(player);
|
||||
drop.TryCollect(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
var entityComponent = GameEntry.Entity;
|
||||
if (entityComponent != null)
|
||||
{
|
||||
entityComponent.HideEntity(coin);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (entity is ExpEntity exp)
|
||||
{
|
||||
if (player != null)
|
||||
{
|
||||
exp.TryCollect(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
var entityComponent = GameEntry.Entity;
|
||||
if (entityComponent != null)
|
||||
{
|
||||
entityComponent.HideEntity(exp);
|
||||
entityComponent.HideEntity(drop);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0878ab0829c34f44a83d5e5a1eb586ea
|
||||
timeCreated: 1770292173
|
||||
+18
-11
@@ -4,40 +4,47 @@ using UnityGameFramework.Runtime;
|
||||
|
||||
namespace SepCore.Entity
|
||||
{
|
||||
public class CoinEntity : EntityBase
|
||||
public class DropEntity : EntityBase
|
||||
{
|
||||
private CoinData _coinData;
|
||||
private DropData _dropData;
|
||||
private bool _isCollected;
|
||||
|
||||
|
||||
protected override void OnShow(object userData)
|
||||
{
|
||||
base.OnShow(userData);
|
||||
_isCollected = false;
|
||||
|
||||
if (userData is CoinData coinData)
|
||||
if (userData is DropData dropData)
|
||||
{
|
||||
_coinData = coinData;
|
||||
_dropData = dropData;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Error("CoinEntity.OnShow() called with wrong type.");
|
||||
Log.Error("DropEntity.OnShow() called with wrong type: {0}.", userData?.GetType().Name);
|
||||
}
|
||||
|
||||
this.CachedTransform.localScale = new Vector3(0.3f, 0.3f, 0.3f);
|
||||
|
||||
CachedTransform.localScale = new Vector3(0.3f, 0.3f, 0.3f);
|
||||
}
|
||||
|
||||
public bool TryCollect(Player player, float collectDistance = 0f)
|
||||
{
|
||||
if (_isCollected || player == null || !player.Available || _coinData == null) return false;
|
||||
if (_isCollected || player == null || !player.Available || _dropData == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (collectDistance > 0f)
|
||||
{
|
||||
float distance = Vector3.Distance(player.CachedTransform.position, CachedTransform.position);
|
||||
if (distance > collectDistance) return false;
|
||||
if (distance > collectDistance)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
_isCollected = true;
|
||||
player.Coin += _coinData.Value;
|
||||
player.Coin += _dropData.CoinCount;
|
||||
player.Exp += _dropData.ExpCount;
|
||||
GameEntry.Entity.HideEntity(this);
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 46bb2720dba28ea4eb80892da753e866
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -75,20 +75,13 @@ namespace SepCore.Entity
|
||||
{
|
||||
if (Random.value < EnemyData.DropPercent)
|
||||
{
|
||||
var data = new CoinData(EnemyData.DropCoin, GameEntry.Entity.NextId())
|
||||
int coinCount = GameEntry.Luban.Global.DropEntityCoinCount;
|
||||
int expCount = GameEntry.Luban.Global.DropEntityExpCount;
|
||||
var data = new DropData(coinCount, expCount, GameEntry.Entity.NextId())
|
||||
{
|
||||
Position = CachedTransform.position
|
||||
};
|
||||
GameEntry.Entity.ShowCoinAsync(data).Forget();
|
||||
}
|
||||
|
||||
if (Random.value < EnemyData.DropPercent)
|
||||
{
|
||||
var data = new ExpData(EnemyData.DropExp, GameEntry.Entity.NextId())
|
||||
{
|
||||
Position = CachedTransform.position
|
||||
};
|
||||
GameEntry.Entity.ShowExpAsync(data).Forget();
|
||||
GameEntry.Entity.ShowDropAsync(data).Forget();
|
||||
}
|
||||
|
||||
base.OnDead(attacker);
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
using SepCore.Entity;
|
||||
using UnityEngine;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace SepCore.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>());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ec4ae4b0a327442a88463eafd59c5b6e
|
||||
timeCreated: 1770293001
|
||||
@@ -105,7 +105,7 @@ namespace SepCore.Entity
|
||||
return null;
|
||||
}
|
||||
|
||||
float actualTimeout = timeout ?? (GameEntry.Luban.Global.EntityAsyncTimeout / 1000f);
|
||||
float actualTimeout = GameEntry.Luban.Global.EntityAsyncTimeout;
|
||||
WeaponBase weapon = await GameEntry.Entity.ShowWeaponAsync(weaponData, actualTimeout);
|
||||
if (weapon == null)
|
||||
{
|
||||
@@ -160,7 +160,7 @@ namespace SepCore.Entity
|
||||
int id = GameEntry.Entity.NextId();
|
||||
var weaponData = EntityDataFactory.Create(id, nextTierConfig, Id, CampType.Player);
|
||||
|
||||
float actualTimeout = timeout ?? (GameEntry.Luban.Global.EntityAsyncTimeout / 1000f);
|
||||
float actualTimeout = GameEntry.Luban.Global.EntityAsyncTimeout;
|
||||
WeaponBase newWeapon = await GameEntry.Entity.ShowWeaponAsync(weaponData, actualTimeout);
|
||||
if (newWeapon == null)
|
||||
{
|
||||
|
||||
@@ -30,7 +30,8 @@ namespace SepCore.Entity
|
||||
float fromHPRatio = _healthComponent.HealthRatio;
|
||||
_healthComponent.TakeDamage(damageResult.Damage, damageResult.IsCrit, false, hitPosition);
|
||||
float toHPRatio = _healthComponent.HealthRatio;
|
||||
if (fromHPRatio > toHPRatio)
|
||||
bool isDead = _healthComponent.CurrentHealth <= 0;
|
||||
if (fromHPRatio > toHPRatio && !isDead)
|
||||
{
|
||||
GameEntry.HPBar.ShowHPBar(this, fromHPRatio, toHPRatio);
|
||||
}
|
||||
@@ -49,7 +50,7 @@ namespace SepCore.Entity
|
||||
}
|
||||
}
|
||||
|
||||
if (_healthComponent.CurrentHealth <= 0)
|
||||
if (isDead)
|
||||
{
|
||||
OnDead(attacker);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user