fix: update fly hp

This commit is contained in:
Tungdv
2026-01-13 16:24:58 +07:00
parent 8c9f1d401a
commit 986bb52897
9 changed files with 47 additions and 15 deletions
@@ -123,7 +123,7 @@ namespace BrewMonster.Scripts
if (!m_pHost.IsRooting())
{
float fDeltaTime = dwDeltaTime * 0.001f;
float fDeltaTime = dwDeltaTime;
if (m_pHost.m_iMoveEnv == (int)MoveEnvironment.MOVEENV_GROUND ||
m_pHost.m_iMoveEnv == (int)MoveEnvironment.MOVEENV_AIR)
@@ -143,7 +143,7 @@ namespace BrewMonster.Scripts
return true;
else
{
/* m_bFinished = true;
m_bFinished = true;
A3DVECTOR3 vCurPos = m_pHost.GetPos();
m_pHost.m_MoveCtrl.SendStopMoveCmd(EC_Utility.ToVector3(vCurPos), 0, (int)GPMoveMode.GP_MOVE_AIR | (int)GPMoveMode.GP_MOVE_RUN);
@@ -151,7 +151,7 @@ namespace BrewMonster.Scripts
m_pHost.PlayAction(
m_pHost.GetWingType() == enumWingType.WINGTYPE_WING ? (int)PLAYER_ACTION_TYPE.ACT_HANGINAIR : (int)PLAYER_ACTION_TYPE.ACT_HANGINAIR_SWORD,
true,
300);*/
300);
}
return true;
@@ -481,8 +481,8 @@ namespace BrewMonster.Scripts
m_pHost.m_iMoveMode = Move_Mode.MOVE_MOVE;
//PlayMoveTargetGFX();
//if (m_pHost.m_iMoveEnv != CECPlayer::MOVEENV_AIR)
// m_pHost.ShowWing(false);
if (m_pHost.m_iMoveEnv != CECPlayer.Move_environment.MOVEENV_AIR)
m_pHost.ShowWing(false);
if (!m_pHost.IsJumping())
{
@@ -80,6 +80,14 @@ namespace BrewMonster.Scripts
m_pHost.m_iMoveMode = (int)Move_Mode.MOVE_STAND;
// Velocity/acceleration reset are skipped here due to partial host API availability in C#
// If needed, add host velocity reset when fields are available
m_pHost.m_vAccel.Clear();
if (m_pHost.m_iMoveEnv == CECPlayer.Move_environment.MOVEENV_AIR)
m_pHost.m_vVelocity.x = m_pHost.m_vVelocity.z = 0.0f;
else if (m_pHost.m_iMoveEnv == CECPlayer.Move_environment.MOVEENV_WATER)
m_pHost.m_vVelocity.x = m_pHost.m_vVelocity.z = 0.0f;
else
m_pHost.m_vVelocity.Clear();
// if (m_pHost.m_pMoveTargetGFX) m_pHost.m_pMoveTargetGFX.Stop();
}
@@ -31,17 +31,29 @@ namespace BrewMonster
if (Input.GetKeyUp(KeyCode.Space))
{
isPressMoveUp = false;
OnMsgHstPushMove();
}
#endif
if (Input.GetKeyDown(KeyCode.Escape))
if (Input.GetKeyDown(KeyCode.Z))
{
OnClickBtnEscape();
isPressMoveDown = true;
OnMsgHstPushMove();
OnClickBtnJump();
}
if (Input.GetKeyUp(KeyCode.Z))
{
isPressMoveDown = false;
OnMsgHstPushMove();
}
if (Input.GetKeyDown(KeyCode.F4))
{
CmdFly(true);
}
if (Input.GetKeyDown(KeyCode.Escape))
{
OnClickBtnEscape();
}
#endif
}
/// <summary>
@@ -1311,7 +1311,7 @@ namespace BrewMonster
public bool IsFlying()
{
// 临时实现 / Temporary implementation
return m_iMoveEnv == (int)MoveEnvironment.MOVEENV_AIR;
return (m_dwStates & PlayerNPCState.GP_STATE_FLY) != 0 ? true : false;
}
public bool IsInvader()
{
@@ -150,6 +150,11 @@ namespace BrewMonster
dir = vTerStart + vDelta;
countHits = 0;
countHits = Physics.RaycastNonAlloc(vStart, Vector3.down, fHitsTerrain, vExt.y, TerrainMask);
if(countHits > 0 && fHitsTerrain[0].point.y >= vTerStart.y)
{
vTerStart.y = fHitsTerrain[0].point.y;
}
countHits = Physics.RaycastNonAlloc(vTerStart, dir.normalized, fHitsTerrain, vDelta.magnitude, TerrainMask);
if (countHits > 0 && Vector3.Distance(fHitsTerrain[0].point, vTerStart) > 0.0009f)
{
@@ -40,6 +40,7 @@ namespace BrewMonster.UI
if (pHost != null)
{
pHost.isPressMoveUp = false;
pHost.OnMsgHstPushMove();
}
}
}
+11 -5
View File
@@ -143,6 +143,7 @@ namespace BrewMonster
Camera mainCam;
Ray ray;
RaycastHit[] hits = new RaycastHit[5];
bool isDataAwaitToReady = false;
private BaseVfxObject m_pSelectedGFX;
private BaseVfxObject m_pHoverGFX;
@@ -355,6 +356,11 @@ namespace BrewMonster
protected override void Update()
{
base.Update();
if (!isDataAwaitToReady)
{
return;
}
#if UNITY_EDITOR
if (Input.GetKeyDown(KeyCode.C))
{
@@ -2463,7 +2469,7 @@ namespace BrewMonster
SetPlayerInfor(new INFO(role.cid, role.crc_e, role.crc_c));
await SetPlayerModel(UnityGameSession.Instance.GetRoleInfo().occupation,
UnityGameSession.Instance.GetRoleInfo().gender);
isDataAwaitToReady = true;
Vector3 pos = new Vector3(role.pos.x, role.pos.y, role.pos.z);
string roleName = Encoding.Unicode.GetString(UnityGameSession.Instance.GetRoleInfo().name.ByteArray);
if (txtName != null) txtName.text = roleName;
@@ -2472,7 +2478,7 @@ namespace BrewMonster
m_dwResFlags = (uint)PlayerResourcesReadyFlag.RESFG_ALL;
joystick = FindAnyObjectByType<Joystick>();
EventBus.Subscribe<JoystickRealeaseEvent>(JoystickRelease);
EventBus.Subscribe<JoystickPressEvent>(OnMsgHstPushMove);
EventBus.Subscribe<JoystickPressEvent>(OnClickJoystick);
if (TryGetComponent<PlayerVisual>(out var visual))
{
visual.InitPlayerEventDoneHandler();
@@ -2494,9 +2500,9 @@ namespace BrewMonster
m_CDRInfo.vExtent = m_aabbServer.Extents;
Vector3 pStart = pos;
pos.y += m_CDRInfo.vExtent.y;
if (Physics.Raycast(pos, Vector3.down, out RaycastHit hit, m_CDRInfo.vExtent.y, 1 << 6))
if (Physics.RaycastNonAlloc(pos, Vector3.down, hits, m_CDRInfo.vExtent.y, 1 << 6) > 0)
{
m_CDRInfo.vTPNormal = EC_Utility.ToA3DVECTOR3(hit.normal);
m_CDRInfo.vTPNormal = EC_Utility.ToA3DVECTOR3(hits[0].normal);
}
else
{
@@ -2635,7 +2641,7 @@ namespace BrewMonster
private void OnDestroy()
{
EventBus.Unsubscribe<JoystickRealeaseEvent>(JoystickRelease);
EventBus.Unsubscribe<JoystickPressEvent>(OnMsgHstPushMove);
EventBus.Unsubscribe<JoystickPressEvent>(OnClickJoystick);
}
//TODO: Remove this function. Since it has been deprecated.