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
+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.