fix hpwork move

This commit is contained in:
NguyenVanDat
2025-12-01 17:20:36 +07:00
parent 1aa3de6c15
commit 3c347adb0f
4 changed files with 54 additions and 8 deletions
@@ -439,7 +439,34 @@ namespace BrewMonster.Scripts
public bool DelayWork(int iPriority, CECHPWork pWork)
{
return false;
if (pWork == null){
// ASSERT(false);
return false;
}
if (!ValidatePriority(iPriority)){
// ASSERT(false);
return false;
}
if (!IsAnyWorkRunning()){
return false;
}
if (CanRunSimultaneouslyWithCurrentWork(iPriority, pWork)){
return false;
}
bool bDelay = false;
if (m_pHost.IsMeleeing()){
UnityGameSession.c2s_CmdCancelAction();
bDelay = true;
}else if (IsPickingUp() || IsSpellingMagic()){
bDelay = true;
}
if (bDelay){
ClearDelayedWork();
m_Delayed.iPriority = iPriority;
m_Delayed.pWork = pWork;
// LOG_DEBUG_INFO(AString().Format("CECHPWork::%s delayed, priority=%d", pWork->GetWorkName(), iPriority));
}
return bDelay;
}
public void StartDelayedWork()
{
@@ -662,12 +689,30 @@ namespace BrewMonster.Scripts
}
KillWork(m_iCurPriority, i);
}
if (workList == null || workList.Count ==0)
if (workList.Count ==0)
{
StartAwaitingWorks();
}
}
}
//todo: use this method
public void FinishAllWork(bool bGotoStand){
for (int i =0; i < Work_priority.NUM_PRIORITY; ++ i){
FinishWorkAtPriority(i);
}
ClearDelayedWork();
if (bGotoStand){
StartWork_p0(CreateWork(CECHPWork.Host_work_ID.WORK_STAND));
}
}
bool IsPickingUp()
{
return IsWorkRunning(CECHPWork.Host_work_ID.WORK_PICKUP);
}
bool IsSpellingMagic()
{
return IsWorkRunning(CECHPWork.Host_work_ID.WORK_SPELLOBJECT);
}
}
public abstract class CECHPWorkPostTickCommand
@@ -128,7 +128,7 @@ namespace BrewMonster.Scripts
}
// Tick routine
public virtual bool Tick(float dwDeltaTime)
public override bool Tick(float dwDeltaTime)
{
UpdateResetUseAutoPF();
if (m_bSwitchTo2D)
+5 -4
View File
@@ -35,7 +35,7 @@ namespace BrewMonster
private PlayerStateMachine _playerStateMachine;
private PlayerMoveState _moveState;
private PlayerIdleState _idleState;
// private PlayerIdleState _idleState;
public CECHostMove m_MoveCtrl;
private CECHPWorkMan m_pWorkMan; // Host work manager
@@ -135,6 +135,7 @@ namespace BrewMonster
public EC_Inventory PackInventory => m_packInventory;
public EC_Inventory EquipInventory => m_equipInventory;
public EC_Inventory TaskInventory => m_taskInventory;
public bool IsMeleeing() { return m_bMelee; }
public EC_Inventory GetInventory(byte byPackage)
{
@@ -162,7 +163,7 @@ namespace BrewMonster
{
base.Awake();
_moveState = new PlayerMoveState(this);
_idleState = new PlayerIdleState(this);
// _idleState = new PlayerIdleState(this);
_playerStateMachine = new PlayerStateMachine();
m_MoveCtrl = new CECHostMove(this);
@@ -238,7 +239,7 @@ namespace BrewMonster
mainCam = FindFirstObjectByType<Camera>();
}
_playerStateMachine.InitState(_idleState);
// _playerStateMachine.InitState(_idleState);
// btnJump.onClick.AddListener(HandleJump);
// Cache input devices for better performance
@@ -438,7 +439,7 @@ namespace BrewMonster
private void JoystickRelease(JoystickRealeaseEvent joystickRealeaseEvent)
{
_playerStateMachine.ChangeState(_idleState);
// _playerStateMachine.ChangeState(_idleState);
}
public bool GroundCheck(out RaycastHit hit)
+1 -1
View File
@@ -37,7 +37,7 @@ namespace BrewMonster.Scripts.Player
}
public void UpdateState()
{
_state.Update();
// _state.Update();
}
}