Merge pull request 'fixbug/npc-dialog' (#376) from fixbug/npc-dialog into develop
Reviewed-on: https://git.pthub.vn/Unity/perfect-world-unity/pulls/376
This commit is contained in:
@@ -17,6 +17,23 @@ namespace BrewMonster
|
||||
public bool isPressMoveUp = false;
|
||||
public bool isPressMoveDown = false;
|
||||
|
||||
void CancelAutoRouteIfManualControl()
|
||||
{
|
||||
if (m_pWorkMan == null)
|
||||
return;
|
||||
|
||||
// When player provides manual control, any auto-route/auto-move must be cancelled immediately.
|
||||
// Otherwise the move work continues to drive movement and can "stick" forward in air.
|
||||
CECHPWorkMove moveWork = m_pWorkMan.GetRunningWork(Host_work_ID.WORK_MOVETOPOS) as CECHPWorkMove;
|
||||
if (moveWork != null && moveWork.GetAutoMove())
|
||||
{
|
||||
m_pWorkMan.FinishRunningWork(Host_work_ID.WORK_MOVETOPOS);
|
||||
}
|
||||
|
||||
// Also reset AutoPF state so it doesn't keep feeding waypoints after a cancel.
|
||||
global::BrewMonster.Scripts.CECIntelligentRoute.Instance().ResetSearch();
|
||||
}
|
||||
|
||||
public void OnKeyDown()
|
||||
{
|
||||
if (Input.GetMouseButtonDown(0) && mainCam != null)
|
||||
@@ -48,6 +65,7 @@ namespace BrewMonster
|
||||
}
|
||||
if (Input.GetKeyDown(KeyCode.F4))
|
||||
{
|
||||
CancelAutoRouteIfManualControl();
|
||||
CmdFly(true);
|
||||
}
|
||||
if (Input.GetKeyDown(KeyCode.Escape))
|
||||
@@ -727,6 +745,13 @@ namespace BrewMonster
|
||||
{
|
||||
m_dwMoveRelDir |= (uint)(MOVE_DIR.MD_ABSDOWN);
|
||||
}
|
||||
|
||||
// Manual movement input should cancel any active auto-route (including in air).
|
||||
if ((m_dwMoveRelDir & (uint)(MOVE_DIR.MD_FORWARD | MOVE_DIR.MD_BACK | MOVE_DIR.MD_LEFT | MOVE_DIR.MD_RIGHT | MOVE_DIR.MD_ABSUP | MOVE_DIR.MD_ABSDOWN)) != 0)
|
||||
{
|
||||
CancelAutoRouteIfManualControl();
|
||||
}
|
||||
|
||||
bool bPushMove = true;
|
||||
if (isPressMoveUp || isPressMoveDown)
|
||||
{
|
||||
|
||||
@@ -985,6 +985,18 @@ namespace BrewMonster
|
||||
// 如果骑乘要飞行,则这些 action switcher,否则 CmdFly
|
||||
// If riding wants to fly, then these action switcher, otherwise CmdFly
|
||||
// Call CmdFly(true) to match F4 key behavior
|
||||
// Manual fly toggle should also cancel any active auto-route/AutoPF move.
|
||||
// Use same behavior as local input (F4) so the player regains control immediately.
|
||||
var wm = pHost.GetWorkMan();
|
||||
if (wm != null)
|
||||
{
|
||||
var mw = wm.GetRunningWork(CECHPWork.Host_work_ID.WORK_MOVETOPOS) as CECHPWorkMove;
|
||||
if (mw != null && mw.GetAutoMove())
|
||||
{
|
||||
wm.FinishRunningWork(CECHPWork.Host_work_ID.WORK_MOVETOPOS);
|
||||
}
|
||||
}
|
||||
CECIntelligentRoute.Instance().ResetSearch();
|
||||
pHost.CmdFly(true);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user