清理项目目录并进行一次打包验证
This commit is contained in:
@@ -8,6 +8,7 @@ using GameFramework.Fsm;
|
||||
using GameFramework.Procedure;
|
||||
using SepCore.EnemyManager;
|
||||
using SepCore.Simulation;
|
||||
using SepCore.Timer;
|
||||
using UnityEngine;
|
||||
|
||||
namespace SepCore.Procedure
|
||||
@@ -20,7 +21,7 @@ namespace SepCore.Procedure
|
||||
|
||||
private int _currentLevel;
|
||||
|
||||
private float _levelTimeLeft;
|
||||
private TimerHandle _levelTimerHandle;
|
||||
|
||||
private Player Player => _procedureGame.Player;
|
||||
|
||||
@@ -29,7 +30,11 @@ namespace SepCore.Procedure
|
||||
public void AddBattleDuration(float seconds)
|
||||
{
|
||||
if (seconds <= 0f) return;
|
||||
_levelTimeLeft += seconds;
|
||||
|
||||
float remaining = GameEntry.Timer.GetRemainingTime(_levelTimerHandle);
|
||||
if (remaining < 0f) return;
|
||||
|
||||
GameEntry.Timer.ResetRemainingTime(_levelTimerHandle, remaining + seconds);
|
||||
}
|
||||
|
||||
#region FSM
|
||||
@@ -51,7 +56,7 @@ namespace SepCore.Procedure
|
||||
throw new Exception($"GameStateBattle.OnEnter: {_currentLevel} is not found.");
|
||||
}
|
||||
|
||||
_levelTimeLeft = drLevel.Duration;
|
||||
_levelTimerHandle = GameEntry.Timer.ScheduleOnce(drLevel.Duration, OnLevelTimeUp, this);
|
||||
_enemyManager.OnInit(drLevel, Player);
|
||||
|
||||
if (Player != null) Player.Enable = true;
|
||||
@@ -64,12 +69,6 @@ namespace SepCore.Procedure
|
||||
|
||||
public override void OnUpdate(float elapseSeconds, float realElapseSeconds)
|
||||
{
|
||||
if (_levelTimeLeft < 0)
|
||||
{
|
||||
_procedureGame.BattleToShopOrLevelUp();
|
||||
return;
|
||||
}
|
||||
|
||||
_enemyManager.OnUpdate(elapseSeconds, realElapseSeconds);
|
||||
|
||||
SimulationWorld simulationWorld = GameEntry.SimulationWorld;
|
||||
@@ -79,14 +78,22 @@ namespace SepCore.Procedure
|
||||
simulationWorld.Tick(new SimulationTickContext(elapseSeconds, realElapseSeconds, playerPosition));
|
||||
}
|
||||
|
||||
_levelTimeLeft -= elapseSeconds;
|
||||
GameEntry.Event.Fire(this, LevelProcessEventArgs.Create((int)_levelTimeLeft));
|
||||
int timeLeft = Mathf.Max(0, (int)GameEntry.Timer.GetRemainingTime(_levelTimerHandle));
|
||||
GameEntry.Event.Fire(this, LevelProcessEventArgs.Create(timeLeft));
|
||||
}
|
||||
|
||||
private void OnLevelTimeUp()
|
||||
{
|
||||
_procedureGame.BattleToShopOrLevelUp();
|
||||
}
|
||||
|
||||
public override void OnLeave()
|
||||
{
|
||||
GameEntry.UIRouter.CloseUIAsync(UIFormType.JoystickForm).Forget();
|
||||
|
||||
GameEntry.Timer.Cancel(_levelTimerHandle);
|
||||
_levelTimerHandle = TimerHandle.Invalid;
|
||||
|
||||
// 隐藏所有敌人实体
|
||||
_enemyManager.OnReset();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user