Merge branch 'feature/movefix' into feature/HP_jump
# Conflicts: # Assets/PerfectWorld/Scripts/Managers/EC_HPWork.cs # Assets/Scripts/CECHostPlayer.cs
This commit is contained in:
@@ -26,13 +26,13 @@ Transform:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6259358396516466834}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalRotation: {x: 0, y: 0.7071068, z: 0, w: 0.7071068}
|
||||
m_LocalPosition: {x: 0.486, y: -0, z: -0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 90, z: 0}
|
||||
--- !u!33 &3427556616546842202
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -13,11 +13,11 @@ RenderTexture:
|
||||
m_IsAlphaChannelOptional: 0
|
||||
serializedVersion: 6
|
||||
m_Width: 256
|
||||
m_Height: 256
|
||||
m_Height: 512
|
||||
m_AntiAliasing: 1
|
||||
m_MipCount: -1
|
||||
m_DepthStencilFormat: 94
|
||||
m_ColorFormat: 8
|
||||
m_DepthStencilFormat: 0
|
||||
m_ColorFormat: 59
|
||||
m_MipMap: 0
|
||||
m_GenerateMips: 1
|
||||
m_SRGB: 0
|
||||
@@ -28,7 +28,7 @@ RenderTexture:
|
||||
m_EnableRandomWrite: 0
|
||||
m_TextureSettings:
|
||||
serializedVersion: 2
|
||||
m_FilterMode: 1
|
||||
m_FilterMode: 0
|
||||
m_Aniso: 0
|
||||
m_MipBias: 0
|
||||
m_WrapU: 1
|
||||
|
||||
@@ -112,3 +112,4 @@ namespace BrewMonster.Managers
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -440,7 +440,42 @@ 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()
|
||||
{
|
||||
@@ -472,15 +507,15 @@ namespace BrewMonster.Scripts
|
||||
}
|
||||
if (pWork.GetWorkID() == CECHPWork.Host_work_ID.WORK_TRACEOBJECT)
|
||||
{
|
||||
/* if (EC_Game.GetGameRun().GetHostInputFilter()->IsMoveUsagePressed())
|
||||
{
|
||||
CECHPWorkTrace pWorkTrace = pWork as CECHPWorkTrace;
|
||||
if (!pWorkTrace.CanTouch())
|
||||
{ // 2014-8-16 ������ͨ�����̲����ƶ�ʱ������������ CECHPWorkTrace,
|
||||
//delete pWorkTrace; // ������� CECHPWorkTrace ����ʱת��Ŀ��λ�á������ֱ����̲��ݵ����ƶ������·���˲�䶶��
|
||||
return false; // �� CECHPWorkTrace ��Ŀ��������Ӵ�ʱ�������� CECHPWorkTrace����ʵ�ּ��̿����ƶ��С���ij��Ӧ�ü���ʱ������ת���ʩ�ż���
|
||||
}
|
||||
}*/
|
||||
/* if (EC_Game.GetGameRun().GetHostInputFilter()->IsMoveUsagePressed())
|
||||
{
|
||||
CECHPWorkTrace pWorkTrace = pWork as CECHPWorkTrace;
|
||||
if (!pWorkTrace.CanTouch())
|
||||
{ // 2014-8-16 ������ͨ�����̲����ƶ�ʱ������������ CECHPWorkTrace,
|
||||
//delete pWorkTrace; // ������� CECHPWorkTrace ����ʱת��Ŀ��λ�á������ֱ����̲��ݵ����ƶ������·���˲�䶶��
|
||||
return false; // �� CECHPWorkTrace ��Ŀ��������Ӵ�ʱ�������� CECHPWorkTrace����ʵ�ּ��̿����ƶ��С���ij��Ӧ�ü���ʱ������ת���ʩ�ż���
|
||||
}
|
||||
}*/
|
||||
}
|
||||
if (!bNoDelay && DelayWork(iPriority, pWork))
|
||||
{
|
||||
@@ -630,7 +665,7 @@ namespace BrewMonster.Scripts
|
||||
if (ValidatePriority(m_iCurPriority))
|
||||
{
|
||||
WorkList workList = m_WorkStack[m_iCurPriority];
|
||||
if(workList != null)
|
||||
if (workList != null)
|
||||
{
|
||||
for (int i = 0; i < workList.Count; ++i)
|
||||
{
|
||||
@@ -652,7 +687,7 @@ namespace BrewMonster.Scripts
|
||||
return;
|
||||
}
|
||||
WorkList workList = m_WorkStack[m_iCurPriority];
|
||||
if(workList != null)
|
||||
if (workList != null)
|
||||
{
|
||||
for (int i = 0; i < workList.Count;)
|
||||
{
|
||||
@@ -663,7 +698,7 @@ namespace BrewMonster.Scripts
|
||||
}
|
||||
KillWork(m_iCurPriority, i);
|
||||
}
|
||||
if (workList == null || workList.Count ==0)
|
||||
if (workList.Count == 0)
|
||||
{
|
||||
StartAwaitingWorks();
|
||||
}
|
||||
@@ -672,26 +707,42 @@ namespace BrewMonster.Scripts
|
||||
|
||||
public bool IsReviving()
|
||||
{
|
||||
return IsWorkRunning(Host_work_ID.WORK_REVIVE);
|
||||
return IsWorkRunning(Host_work_ID.WORK_REVIVE);
|
||||
}
|
||||
public bool IsSpellingMagic()
|
||||
{
|
||||
return IsWorkRunning(Host_work_ID.WORK_SPELLOBJECT);
|
||||
return IsWorkRunning(Host_work_ID.WORK_SPELLOBJECT);
|
||||
}
|
||||
public bool IsUsingItem()
|
||||
{
|
||||
return IsWorkRunning(Host_work_ID.WORK_USEITEM);
|
||||
return IsWorkRunning(Host_work_ID.WORK_USEITEM);
|
||||
}
|
||||
public bool IsPassiveMoving()
|
||||
{
|
||||
return IsWorkRunning(Host_work_ID.WORK_PASSIVEMOVE);
|
||||
return IsWorkRunning(Host_work_ID.WORK_PASSIVEMOVE);
|
||||
}
|
||||
public bool IsSitting()
|
||||
{
|
||||
return IsWorkRunning(Host_work_ID.WORK_SIT);
|
||||
return IsWorkRunning(Host_work_ID.WORK_SIT);
|
||||
}
|
||||
//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);
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class CECHPWorkPostTickCommand
|
||||
{
|
||||
public abstract bool Run(CECHPWorkMan pWorkMan);
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
using BrewMonster.Network;
|
||||
using CSNetwork.GPDataType;
|
||||
using UnityEngine;
|
||||
using static CECPlayer;
|
||||
using Types = BrewMonster.Scripts.CECHPWorkMove.DestTypes;
|
||||
|
||||
namespace BrewMonster.Scripts
|
||||
{
|
||||
public class CECHPWorkMove : CECHPWork
|
||||
{
|
||||
public static class Types
|
||||
public static class DestTypes
|
||||
{
|
||||
public const int DEST_2D = 0,
|
||||
DEST_3D = 1,
|
||||
@@ -15,6 +18,8 @@ namespace BrewMonster.Scripts
|
||||
DEST_AUTOPF = 5; // Movement type
|
||||
}
|
||||
|
||||
private const uint MoveInputMask = 0x0F; // MD_FORWARD | MD_RIGHT | MD_BACK | MD_LEFT
|
||||
|
||||
protected A3DVECTOR3 m_vMoveDest; // Move destination position or direction
|
||||
protected int m_iDestType; // Destination type
|
||||
protected bool m_bHaveDest; // true, have destination
|
||||
@@ -30,6 +35,8 @@ namespace BrewMonster.Scripts
|
||||
protected float m_fCurPitch;
|
||||
protected float m_fPushPitch;
|
||||
protected float m_fPushLean;
|
||||
protected A3DVECTOR3 vDir = new A3DVECTOR3();
|
||||
|
||||
|
||||
protected bool m_bUseAutoMoveDialog; // Auto move
|
||||
protected float m_fAutoHeight; // Height of auto moving destination
|
||||
@@ -121,107 +128,107 @@ namespace BrewMonster.Scripts
|
||||
}
|
||||
|
||||
// Tick routine
|
||||
public virtual bool Tick(float dwDeltaTime)
|
||||
public override bool Tick(float dwDeltaTime)
|
||||
{
|
||||
//UpdateResetUseAutoPF();
|
||||
//if (m_bSwitchTo2D)
|
||||
//{
|
||||
// SwitchToDest2D();
|
||||
// m_bSwitchTo2D = false;
|
||||
// return true;
|
||||
//}
|
||||
//if (IsAutoPF())
|
||||
//{
|
||||
// if (CECIntelligentRoute::Instance().IsIdle())
|
||||
// {
|
||||
// // ����Ѱ·ģʽδ�ɹ�ʱ���ȴ��¸� Tick �л��� DEST_2D ģʽ
|
||||
// return true;
|
||||
// }
|
||||
// if (m_pHost.IsFlying())
|
||||
// {
|
||||
// // ��;�л�������ģʽʱ���л��� DEST_2D ģʽ
|
||||
// CECIntelligentRoute::Instance().ResetSearch();
|
||||
// m_bSwitchTo2D = true;
|
||||
// return true;
|
||||
// }
|
||||
//}
|
||||
UpdateResetUseAutoPF();
|
||||
if (m_bSwitchTo2D)
|
||||
{
|
||||
SwitchToDest2D();
|
||||
m_bSwitchTo2D = false;
|
||||
return true;
|
||||
}
|
||||
/* if (IsAutoPF())
|
||||
{
|
||||
if (CECIntelligentRoute::Instance().IsIdle())
|
||||
{
|
||||
// ����Ѱ·ģʽδ�ɹ�ʱ���ȴ��¸� Tick �л��� DEST_2D ģʽ
|
||||
return true;
|
||||
}
|
||||
if (m_pHost.IsFlying())
|
||||
{
|
||||
// ��;�л�������ģʽʱ���л��� DEST_2D ģʽ
|
||||
CECIntelligentRoute::Instance().ResetSearch();
|
||||
m_bSwitchTo2D = true;
|
||||
return true;
|
||||
}
|
||||
}*/
|
||||
|
||||
//base.Tick(dwDeltaTime);
|
||||
base.Tick(dwDeltaTime);
|
||||
|
||||
//if (m_pHost.IsRooting())
|
||||
// return true;
|
||||
if (m_pHost.IsRooting())
|
||||
return true;
|
||||
|
||||
//if (m_bUseAutoMoveDialog)
|
||||
//{
|
||||
// if (m_pHost.IsFlying())
|
||||
// {
|
||||
// m_bAutoFly = false;
|
||||
// m_bAutoFlyPending = false;
|
||||
// }
|
||||
if (m_bUseAutoMoveDialog)
|
||||
{
|
||||
if (m_pHost.IsFlying())
|
||||
{
|
||||
m_bAutoFly = false;
|
||||
m_bAutoFlyPending = false;
|
||||
}
|
||||
|
||||
// if (m_bAutoFly && !m_bAutoFlyPending && !m_pHost.IsFlying())
|
||||
// {
|
||||
// if (m_pHost.CmdFly())
|
||||
// {
|
||||
// m_bAutoFly = false;
|
||||
// m_bAutoFlyPending = true;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// // Make sure 'Win_AutoPlay' dialog doesn't show up
|
||||
// CECGameUIMan pGameUI = g_pGame.GetGameRun().GetUIManager().GetInGameUIMan();
|
||||
// pGameUI.AutoMoveShowDialog(false);
|
||||
//}
|
||||
if (m_bAutoFly && !m_bAutoFlyPending && !m_pHost.IsFlying())
|
||||
{
|
||||
/* if (m_pHost.CmdFly())
|
||||
{
|
||||
m_bAutoFly = false;
|
||||
m_bAutoFlyPending = true;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Make sure 'Win_AutoPlay' dialog doesn't show up
|
||||
/* CECGameUIMan pGameUI = g_pGame.GetGameRun().GetUIManager().GetInGameUIMan();
|
||||
pGameUI.AutoMoveShowDialog(false);*/
|
||||
}
|
||||
|
||||
////Ѱ·�������ҵ�NPC����תΪWorkTrace״̬
|
||||
//if ((m_vMoveDest - m_pHost.GetPos()).MagnitudeH() <= 5.0f)
|
||||
//{
|
||||
// if (m_iNPCTempleId)
|
||||
// {
|
||||
// CECNPC pNPC = g_pGame.GetGameRun().GetWorld().GetNPCMan().FindNPCByTempleID(m_iNPCTempleId);
|
||||
// if (pNPC && m_pHost.SelectTarget(pNPC.GetNPCID()))
|
||||
// {
|
||||
// CECHPWorkTrace pWork = m_pWorkMan.CreateNPCTraceWork(pNPC, m_iTaskId);
|
||||
// if (pWork)
|
||||
// {
|
||||
// m_bAutoLand = false; //��ֹ����״̬Ѱ·������ת��worktrace֮ǰ�Զ���½������workfall��
|
||||
// Finish();
|
||||
// m_pWorkMan.SetPostTickCommand(new CECHPWorkPostTickRunWorkCommand(pWork, true));
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//Ѱ·�������ҵ�NPC����תΪWorkTrace״̬
|
||||
/*if ((m_vMoveDest - m_pHost.GetPos()).MagnitudeH() <= 5.0f)
|
||||
{
|
||||
if (m_iNPCTempleId != 0)
|
||||
{
|
||||
CECNPC pNPC = EC_Game.GetGameRun().GetWorld().GetNPCMan().FindNPCByTempleID(m_iNPCTempleId);
|
||||
if (pNPC && m_pHost.SelectTarget(pNPC.GetNPCID()))
|
||||
{
|
||||
CECHPWorkTrace pWork = m_pWorkMan.CreateNPCTraceWork(pNPC, m_iTaskId);
|
||||
if (pWork != null)
|
||||
{
|
||||
m_bAutoLand = false; //��ֹ����״̬Ѱ·������ת��worktrace֮ǰ�Զ���½������workfall��
|
||||
Finish();
|
||||
m_pWorkMan.SetPostTickCommand(new CECHPWorkPostTickRunWorkCommand(pWork, true));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
//float fDeltaTime = dwDeltaTime;
|
||||
//if (m_pHost.m_iMoveEnv == CECPlayer::MOVEENV_GROUND ||
|
||||
// m_pHost.m_iMoveEnv == CECPlayer::MOVEENV_WATER && m_pHost.IsJumping() && (m_pHost.m_CDRInfo.vAbsVelocity.y > 0 || m_pHost.m_CDRInfo.fYVel > 0))
|
||||
//{
|
||||
// // Play appropriate actions
|
||||
// if (!m_pHost.IsJumping() && !m_pHost.IsPlayingAction(CECPlayer::ACT_TRICK_RUN) &&
|
||||
// m_pHost.m_iMoveMode != CECPlayer::MOVE_SLIDE && !m_bMeetSlide)
|
||||
// {
|
||||
// int iAction = m_pHost.GetMoveStandAction(true);
|
||||
// m_pHost.PlayAction(iAction, false);
|
||||
// }
|
||||
float fDeltaTime = dwDeltaTime;
|
||||
if (m_pHost.m_iMoveEnv == (int)MoveEnvironment.MOVEENV_GROUND ||
|
||||
m_pHost.m_iMoveEnv == (int)MoveEnvironment.MOVEENV_WATER && m_pHost.IsJumping() && (m_pHost.m_CDRInfo.vAbsVelocity.y > 0 || m_pHost.m_CDRInfo.fYVel > 0))
|
||||
{
|
||||
// Play appropriate actions
|
||||
if (!m_pHost.IsJumping() && !m_pHost.IsPlayingAction((int)CECPlayer.PLAYER_ACTION_TYPE.ACT_TRICK_RUN) &&
|
||||
m_pHost.m_iMoveMode != (int)MoveMode.MOVE_SLIDE && !m_bMeetSlide)
|
||||
{
|
||||
int iAction = m_pHost.GetMoveStandAction(true);
|
||||
m_pHost.PlayAction(iAction, false);
|
||||
}
|
||||
|
||||
// Tick_Walk(fDeltaTime);
|
||||
//}
|
||||
//else // (m_pHost.m_iMoveEnv == CECPlayer::MOVEENV_AIR || m_pHost.m_iMoveEnv == CECPlayer::MOVEENV_WATER)
|
||||
//{
|
||||
// m_pHost.ResetJump();
|
||||
Tick_Walk(fDeltaTime);
|
||||
}
|
||||
else // (m_pHost.m_iMoveEnv == CECPlayer::MOVEENV_AIR || m_pHost.m_iMoveEnv == CECPlayer::MOVEENV_WATER)
|
||||
{
|
||||
m_pHost.ResetJump();
|
||||
|
||||
// // Play appropriate actions
|
||||
// if (!m_bGliding)
|
||||
// {
|
||||
// int iAction = m_pHost.GetMoveStandAction(true);
|
||||
// m_pHost.PlayAction(iAction, false);
|
||||
// }
|
||||
// Play appropriate actions
|
||||
if (!m_bGliding)
|
||||
{
|
||||
int iAction = m_pHost.GetMoveStandAction(true);
|
||||
m_pHost.PlayAction(iAction, false);
|
||||
}
|
||||
|
||||
// Tick_FlySwim(fDeltaTime);
|
||||
//}
|
||||
Tick_FlySwim(fDeltaTime);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -327,8 +334,330 @@ namespace BrewMonster.Scripts
|
||||
// Tick routine of walking on ground
|
||||
protected bool Tick_Walk(float fDeltaTime)
|
||||
{
|
||||
A3DVECTOR3 vCurPos = m_pHost.GetPos();
|
||||
ref CDR_INFO cdr = ref m_pHost.m_CDRInfo;
|
||||
|
||||
if (m_pHost.m_iMoveMode == (int)MoveMode.MOVE_SLIDE)
|
||||
{
|
||||
m_pHost.PlayAction((int)CECPlayer.PLAYER_ACTION_TYPE.ACT_JUMP_LOOP, false);
|
||||
|
||||
A3DVECTOR3 vDir;
|
||||
if (m_iDestType == DestTypes.DEST_DIR)
|
||||
{
|
||||
vDir = m_vCurDir;
|
||||
}
|
||||
else if (m_iDestType == DestTypes.DEST_PUSH)
|
||||
{
|
||||
vDir = GetCurrentModelDir();
|
||||
}
|
||||
#if ENABLE_CEC_INTELLIGENT_ROUTE
|
||||
else if (IsAutoPF())
|
||||
{
|
||||
vDir = CECIntelligentRoute.Instance().GetCurDest() - vCurPos;
|
||||
vDir.y = 0.0f;
|
||||
vDir.Normalize();
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
vDir = m_vMoveDest - vCurPos;
|
||||
vDir.y = 0.0f;
|
||||
vDir.Normalize();
|
||||
}
|
||||
|
||||
float fMaxSpeedV = 0.0f;
|
||||
m_bMeetSlide = m_pHost.m_MoveCtrl.MeetSlope(vDir, fMaxSpeedV);
|
||||
cdr.fYVel = EC_Utility.a_ClampFloor(cdr.fYVel, -fMaxSpeedV);
|
||||
|
||||
if (m_pHost.m_GndInfo.bOnGround)
|
||||
m_vCurDir = vDir;
|
||||
|
||||
vCurPos = m_pHost.m_MoveCtrl.GroundMove(m_vCurDir, m_pHost.GetGroundSpeed(), fDeltaTime);
|
||||
if (m_pHost.m_MoveCtrl.MoveBlocked() >= 3)
|
||||
{
|
||||
m_pHost.m_MoveCtrl.SetSlideLock(true);
|
||||
cdr.fYVel = 0.0f;
|
||||
|
||||
Finish();
|
||||
m_pHost.m_MoveCtrl.SendStopMoveCmd(EC_Utility.ToVector3(vCurPos), m_pHost.GetGroundSpeed(), (int)GPMoveMode.GP_MOVE_SLIDE);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pHost.SetPos(EC_Utility.ToVector3(vCurPos));
|
||||
#if ENABLE_CEC_INTELLIGENT_ROUTE
|
||||
if (IsAutoPF() && CECIntelligentRoute.Instance().IsMoveOn())
|
||||
CECIntelligentRoute.Instance().OnPlayerPosChange(vCurPos);
|
||||
#endif
|
||||
#if SHOW_AUTOMOVE_FOOTPRINTS
|
||||
if (IsAutoPF() || m_iDestType == DestTypes.DEST_2D)
|
||||
g_AutoPFFollowPoints.Add(vCurPos);
|
||||
#endif
|
||||
m_pHost.m_MoveCtrl.SendMoveCmd(
|
||||
vCurPos,
|
||||
2,
|
||||
GPDataTypeHelper.g_vOrigin,
|
||||
EC_Utility.ToA3DVECTOR3(cdr.vAbsVelocity),
|
||||
(int)GPMoveMode.GP_MOVE_SLIDE);
|
||||
}
|
||||
}
|
||||
else if (!m_bMeetSlide)
|
||||
{
|
||||
float fSpeed = m_pHost.GetGroundSpeed();
|
||||
int iMoveMode = m_pHost.m_bWalkRun ? (int)GPMoveMode.GP_MOVE_RUN : (int)GPMoveMode.GP_MOVE_WALK;
|
||||
if (m_pHost.IsJumping())
|
||||
iMoveMode = (int)GPMoveMode.GP_MOVE_JUMP;
|
||||
else if (!m_pHost.m_GndInfo.bOnGround)
|
||||
iMoveMode = (int)GPMoveMode.GP_MOVE_FALL;
|
||||
|
||||
if (m_bReadyCancel && m_pHost.m_GndInfo.bOnGround)
|
||||
{
|
||||
Finish();
|
||||
m_pHost.m_MoveCtrl.SendStopMoveCmd(EC_Utility.ToVector3(vCurPos), fSpeed, iMoveMode);
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((GetMoveRelDirMask() & MoveInputMask) != 0)
|
||||
m_iDestType = DestTypes.DEST_PUSH;
|
||||
|
||||
if (m_iDestType == DestTypes.DEST_2D)
|
||||
{
|
||||
float fDist;
|
||||
if (m_pHost.m_GndInfo.bOnGround)
|
||||
{
|
||||
m_vCurDir = m_vMoveDest - vCurPos;
|
||||
m_vCurDir.y = 0.0f;
|
||||
fDist = m_vCurDir.Normalize();
|
||||
}
|
||||
else
|
||||
{
|
||||
fDist = (m_vMoveDest - vCurPos).MagnitudeH();
|
||||
}
|
||||
|
||||
vCurPos = m_pHost.m_MoveCtrl.GroundMove(m_vCurDir, fSpeed, fDeltaTime, m_pHost.m_fVertSpeed);
|
||||
UpdateFacingFromDelta(vCurPos);
|
||||
|
||||
if (m_pHost.m_MoveCtrl.MoveBlocked() >= 3)
|
||||
{
|
||||
cdr.fYVel = 0.0f;
|
||||
|
||||
Finish();
|
||||
m_pHost.m_MoveCtrl.SendStopMoveCmd(EC_Utility.ToVector3(vCurPos), fSpeed, iMoveMode);
|
||||
}
|
||||
else if (m_pHost.m_GndInfo.bOnGround && cdr.vTPNormal != Vector3.zero)
|
||||
{
|
||||
A3DVECTOR3 vMoveDelta = vCurPos - m_pHost.GetPos();
|
||||
vMoveDelta.y = 0.0f;
|
||||
float fMoveDist = vMoveDelta.Normalize();
|
||||
|
||||
if (fMoveDist >= fDist)
|
||||
{
|
||||
Finish();
|
||||
m_bUseAutoMoveDialog = false;
|
||||
m_pHost.SetPos(EC_Utility.ToVector3(vCurPos));
|
||||
m_pHost.m_MoveCtrl.SendStopMoveCmd(EC_Utility.ToVector3(vCurPos), fSpeed, iMoveMode);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pHost.SetPos(EC_Utility.ToVector3(vCurPos));
|
||||
m_pHost.m_MoveCtrl.SendMoveCmd(
|
||||
vCurPos,
|
||||
0,
|
||||
m_vMoveDest,
|
||||
EC_Utility.ToA3DVECTOR3(cdr.vAbsVelocity),
|
||||
iMoveMode);
|
||||
}
|
||||
#if SHOW_AUTOMOVE_FOOTPRINTS
|
||||
g_AutoPFFollowPoints.Add(vCurPos);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#if SHOW_AUTOMOVE_FOOTPRINTS
|
||||
g_AutoPFFollowPoints.Add(vCurPos);
|
||||
#endif
|
||||
m_pHost.SetPos(EC_Utility.ToVector3(vCurPos));
|
||||
m_pHost.m_MoveCtrl.SendMoveCmd(
|
||||
vCurPos,
|
||||
1,
|
||||
m_vMoveDest,
|
||||
EC_Utility.ToA3DVECTOR3(cdr.vAbsVelocity),
|
||||
iMoveMode);
|
||||
}
|
||||
}
|
||||
else if (m_iDestType == DestTypes.DEST_DIR)
|
||||
{
|
||||
vCurPos = m_pHost.m_MoveCtrl.GroundMove(m_vCurDir, fSpeed, fDeltaTime, m_pHost.m_fVertSpeed);
|
||||
UpdateFacingFromDelta(vCurPos);
|
||||
m_pHost.SetPos(EC_Utility.ToVector3(vCurPos));
|
||||
|
||||
if (m_pHost.m_MoveCtrl.MoveBlocked() >= 3)
|
||||
{
|
||||
cdr.fYVel = 0.0f;
|
||||
|
||||
Finish();
|
||||
m_pHost.m_MoveCtrl.SendStopMoveCmd(EC_Utility.ToVector3(vCurPos), fSpeed, iMoveMode);
|
||||
}
|
||||
else if (m_pHost.m_GndInfo.bOnGround)
|
||||
{
|
||||
m_pHost.m_MoveCtrl.SendMoveCmd(
|
||||
vCurPos,
|
||||
2,
|
||||
GPDataTypeHelper.g_vOrigin,
|
||||
EC_Utility.ToA3DVECTOR3(cdr.vAbsVelocity),
|
||||
iMoveMode);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pHost.m_MoveCtrl.SendMoveCmd(
|
||||
vCurPos,
|
||||
1,
|
||||
m_vMoveDest,
|
||||
EC_Utility.ToA3DVECTOR3(cdr.vAbsVelocity),
|
||||
iMoveMode);
|
||||
}
|
||||
}
|
||||
else if (m_iDestType == DestTypes.DEST_STANDJUMP)
|
||||
{
|
||||
if (!m_pHost.IsJumping())
|
||||
{
|
||||
Finish();
|
||||
m_pHost.m_MoveCtrl.SendStopMoveCmd(EC_Utility.ToVector3(vCurPos), fSpeed, iMoveMode);
|
||||
}
|
||||
else
|
||||
{
|
||||
vCurPos = m_pHost.m_MoveCtrl.GroundMove(GPDataTypeHelper.g_vOrigin, 0.0f, fDeltaTime, m_pHost.m_fVertSpeed);
|
||||
m_pHost.SetPos(EC_Utility.ToVector3(vCurPos));
|
||||
|
||||
if (m_pHost.m_MoveCtrl.MoveBlocked() >= 3)
|
||||
{
|
||||
m_pHost.ResetJump();
|
||||
Finish();
|
||||
m_pHost.m_MoveCtrl.SendStopMoveCmd(EC_Utility.ToVector3(vCurPos), fSpeed, iMoveMode);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pHost.m_MoveCtrl.SendMoveCmd(
|
||||
vCurPos,
|
||||
0,
|
||||
m_vMoveDest,
|
||||
EC_Utility.ToA3DVECTOR3(cdr.vAbsVelocity),
|
||||
iMoveMode);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (m_iDestType == DestTypes.DEST_PUSH)
|
||||
{
|
||||
A3DVECTOR3 vMoveDir = GPDataTypeHelper.g_vOrigin;
|
||||
bool bFinish = false;
|
||||
|
||||
/*if (m_pHost.GetPushDir(vMoveDir, MOVE_DIR.MD_FORWARD | MOVE_DIR.MD_BACK | MOVE_DIR.MD_LEFT | MOVE_DIR.MD_RIGHT, fDeltaTime))
|
||||
{
|
||||
if (!vMoveDir.IsZero())
|
||||
{
|
||||
//m_pHost.StartModelMove(vMoveDir, GPDataTypeHelper.g_vAxisY, 0);
|
||||
}
|
||||
|
||||
vCurPos = m_pHost.m_MoveCtrl.GroundMove(vMoveDir, fSpeed, fDeltaTime, m_pHost.m_fVertSpeed);
|
||||
m_pHost.SetPos(EC_Utility.ToVector3(vCurPos));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!m_bUseAutoMoveDialog)
|
||||
bFinish = true;
|
||||
else
|
||||
m_iDestType = DestTypes.DEST_2D;
|
||||
}*/
|
||||
|
||||
if (bFinish || m_pHost.m_MoveCtrl.MoveBlocked() >= 3)
|
||||
{
|
||||
if (m_pHost.m_MoveCtrl.MoveBlocked() >= 3)
|
||||
cdr.fYVel = 0.0f;
|
||||
|
||||
Finish();
|
||||
m_pHost.m_vVelocity.Clear();
|
||||
m_pHost.m_MoveCtrl.SendStopMoveCmd(EC_Utility.ToVector3(vCurPos), fSpeed, iMoveMode);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pHost.m_vVelocity = vMoveDir * fSpeed;
|
||||
m_pHost.m_MoveCtrl.SendMoveCmd(
|
||||
vCurPos,
|
||||
2,
|
||||
GPDataTypeHelper.g_vOrigin,
|
||||
m_pHost.m_vVelocity,
|
||||
iMoveMode);
|
||||
}
|
||||
}
|
||||
else if (m_iDestType == DestTypes.DEST_PUSH)
|
||||
{
|
||||
m_iDestType = DestTypes.DEST_2D;
|
||||
}
|
||||
#if ENABLE_CEC_INTELLIGENT_ROUTE
|
||||
else if (IsAutoPF())
|
||||
{
|
||||
float fDist = 0.0f;
|
||||
A3DVECTOR3 vCurDest = CECIntelligentRoute.Instance().GetCurDest();
|
||||
if (m_pHost.m_GndInfo.bOnGround)
|
||||
{
|
||||
m_vCurDir = vCurDest - vCurPos;
|
||||
m_vCurDir.y = 0.0f;
|
||||
fDist = m_vCurDir.Normalize();
|
||||
}
|
||||
else
|
||||
{
|
||||
fDist = (vCurDest - vCurPos).MagnitudeH();
|
||||
}
|
||||
|
||||
vCurPos = m_pHost.m_MoveCtrl.GroundMove(m_vCurDir, fSpeed, fDeltaTime, m_pHost.m_fVertSpeed);
|
||||
if (!m_vCurDir.IsZero())
|
||||
{
|
||||
//m_pHost.StartModelMove(m_vCurDir, GPDataTypeHelper.g_vAxisY, 100);
|
||||
//m_pHost.ChangeModelTargetDirAndUp(m_vCurDir, GPDataTypeHelper.g_vAxisY);
|
||||
UpdateFacingFromDelta(vCurPos);
|
||||
}
|
||||
|
||||
if (m_pHost.m_MoveCtrl.MoveBlocked() >= 3)
|
||||
{
|
||||
cdr.fYVel = 0.0f;
|
||||
Finish();
|
||||
m_pHost.m_MoveCtrl.SendStopMoveCmd(EC_Utility.ToVector3(vCurPos), fSpeed, iMoveMode);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pHost.SetPos(EC_Utility.ToVector3(vCurPos));
|
||||
CECIntelligentRoute.Instance().OnPlayerPosChange(vCurPos);
|
||||
if (CECIntelligentRoute.Instance().IsPathFinished())
|
||||
{
|
||||
Finish();
|
||||
m_pHost.m_MoveCtrl.SendStopMoveCmd(EC_Utility.ToVector3(vCurPos), fSpeed, iMoveMode);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pHost.m_MoveCtrl.SendMoveCmd(
|
||||
vCurPos,
|
||||
1,
|
||||
vCurDest,
|
||||
EC_Utility.ToA3DVECTOR3(cdr.vAbsVelocity),
|
||||
iMoveMode);
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
else if (IsAutoPF())
|
||||
{
|
||||
m_bSwitchTo2D = true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pHost.m_MoveCtrl.SendStopMoveCmd(EC_Utility.ToVector3(vCurPos), m_pHost.GetGroundSpeed(), (int)GPMoveMode.GP_MOVE_SLIDE);
|
||||
Finish();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Tick routine of flying or swimming
|
||||
protected bool Tick_FlySwim(float fDeltaTime)
|
||||
{
|
||||
@@ -390,5 +719,30 @@ namespace BrewMonster.Scripts
|
||||
// ClearResetUseAutoPF();
|
||||
}
|
||||
|
||||
protected virtual uint GetMoveRelDirMask()
|
||||
{
|
||||
// TODO: hook up CECHostPlayer move-direction flags when available.
|
||||
return 0;
|
||||
}
|
||||
|
||||
private void UpdateFacingFromDelta(A3DVECTOR3 nextPos)
|
||||
{
|
||||
A3DVECTOR3 prevPos = m_pHost.GetPos();
|
||||
Vector3 delta = EC_Utility.ToVector3(nextPos - prevPos);
|
||||
delta.y = 0.0f;
|
||||
if (delta.sqrMagnitude > 1e-6f)
|
||||
{
|
||||
delta.Normalize();
|
||||
m_pHost.SetDirAndUp(delta, Vector3.up);
|
||||
}
|
||||
}
|
||||
|
||||
private A3DVECTOR3 GetCurrentModelDir()
|
||||
{
|
||||
Vector3 forward = m_pHost != null ? m_pHost.transform.forward : Vector3.forward;
|
||||
return new A3DVECTOR3(forward.x, forward.y, forward.z);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ namespace BrewMonster.Scripts
|
||||
var pWork = (CECHPWorkMove)m_pWorkMan.CreateWork(Host_work_ID.WORK_MOVETOPOS);
|
||||
if (pWork != null)
|
||||
{
|
||||
pWork.SetDestination(CECHPWorkMove.Types.DEST_STANDJUMP, GPDataTypeHelper.g_vOrigin);
|
||||
//pWork.SetDestination(CECHPWorkMove.Types.DEST_STANDJUMP, GPDataTypeHelper.g_vOrigin);
|
||||
m_pWorkMan.SetPostTickCommand(new CECHPWorkPostTickRunWorkCommand(
|
||||
pWork, false, CECHPWorkMan.Work_priority.PRIORITY_1, true, (uint)dwDeltaTime));
|
||||
}
|
||||
|
||||
@@ -193,15 +193,15 @@ public class CECTracedNPC : CECTracedObject
|
||||
{
|
||||
bRet = true;
|
||||
}
|
||||
//else if (m_iReason == CECHPWorkTrace.Trace_reason.TRACE_SPELL)
|
||||
//{
|
||||
// CECSkill pSkill = m_pHost.m_pPrepSkill;
|
||||
// if (pSkill == null || pSkill.GetTargetType() != 2)
|
||||
// {
|
||||
// bRet = true;
|
||||
// m_pHost.m_pPrepSkill = null;
|
||||
// }
|
||||
//}
|
||||
else if (m_iReason == CECHPWorkTrace.Trace_reason.TRACE_SPELL)
|
||||
{
|
||||
CECSkill pSkill = m_pHost.m_pPrepSkill;
|
||||
if (pSkill == null || pSkill.GetTargetType() != 2)
|
||||
{
|
||||
bRet = true;
|
||||
m_pHost.m_pPrepSkill = null;
|
||||
}
|
||||
}
|
||||
return bRet;
|
||||
}
|
||||
|
||||
@@ -220,6 +220,7 @@ public class CECTracedNPC : CECTracedObject
|
||||
|
||||
if (m_iReason == CECHPWorkTrace.Trace_reason.TRACE_TALK)
|
||||
{
|
||||
//TODO: Visite other's booth, send hello message to him
|
||||
if ((!m_pHost.IsInBattle() || m_pHost.InSameBattleCamp(pNPC)) /*&&
|
||||
!g_pGame.GetGameRun().GetUIManager().GetInGameUIMan().GetDialog("Win_SkillAction").IsShow()*/)
|
||||
{
|
||||
@@ -295,15 +296,15 @@ public class CECTracedPlayer : CECTracedObject
|
||||
{
|
||||
bRet = true;
|
||||
}
|
||||
//else if (m_iReason == CECHPWorkTrace.Trace_reason.TRACE_SPELL)
|
||||
//{
|
||||
// CECSkill pSkill = m_pHost.m_pPrepSkill;
|
||||
// if (pSkill == null || pSkill.GetTargetType() != 2)
|
||||
// {
|
||||
// bRet = true;
|
||||
// m_pHost.m_pPrepSkill = null;
|
||||
// }
|
||||
//}
|
||||
else if (m_iReason == CECHPWorkTrace.Trace_reason.TRACE_SPELL)
|
||||
{
|
||||
CECSkill pSkill = m_pHost.m_pPrepSkill;
|
||||
if (pSkill == null || pSkill.GetTargetType() != 2)
|
||||
{
|
||||
bRet = true;
|
||||
m_pHost.m_pPrepSkill = null;
|
||||
}
|
||||
}
|
||||
return bRet;
|
||||
}
|
||||
|
||||
@@ -328,17 +329,15 @@ public class CECTracedPlayer : CECTracedObject
|
||||
if (m_iObjectId == 0 || m_iObjectId == m_pHost.GetCharacterID())
|
||||
{
|
||||
// Handle special case
|
||||
//ASSERT(m_iReason == CECHPWorkTrace::TRACE_SPELL);
|
||||
//if (!m_pHost.CannotAttack())
|
||||
//{
|
||||
// if (m_pHost.CastSkill(m_iObjectId, m_bForceAttack, null))
|
||||
// bActionDone = true;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// m_pHost.m_pPrepSkill = null;
|
||||
//}
|
||||
//a_LogOutput(1, "[NormalATK]- CECTracedPlayer- OnTouched- special case- TRACE_SPELL");
|
||||
if (!m_pHost.CannotAttack())
|
||||
{
|
||||
if (m_pHost.CastSkill(m_iObjectId, m_bForceAttack, null))
|
||||
bActionDone = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pHost.m_pPrepSkill = null;
|
||||
}
|
||||
return bActionDone;
|
||||
}
|
||||
if (m_iReason == CECHPWorkTrace.Trace_reason.TRACE_ATTACK)
|
||||
@@ -353,18 +352,18 @@ public class CECTracedPlayer : CECTracedObject
|
||||
//a_LogOutput(1, "[NormalATK]- CECTracedPlayer- OnTouched- TRACE_ATTACK");
|
||||
}
|
||||
}
|
||||
//else if (m_iReason == CECHPWorkTrace.Trace_reason.TRACE_SPELL)
|
||||
//{
|
||||
// //a_LogOutput(1, "[NormalATK]- CECTracedPlayer- OnTouched- TRACE_SPELL");
|
||||
// if (!m_pHost.CastSkill(m_iObjectId, m_bForceAttack, GetTargetObject()))
|
||||
// {
|
||||
// m_pHost.m_pPrepSkill = null;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// bActionDone = true;
|
||||
// }
|
||||
//}
|
||||
else if (m_iReason == CECHPWorkTrace.Trace_reason.TRACE_SPELL)
|
||||
{
|
||||
//a_LogOutput(1, "[NormalATK]- CECTracedPlayer- OnTouched- TRACE_SPELL");
|
||||
if (!m_pHost.CastSkill(m_iObjectId, m_bForceAttack, GetTargetObject()))
|
||||
{
|
||||
m_pHost.m_pPrepSkill = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
bActionDone = true;
|
||||
}
|
||||
}
|
||||
else if (m_iReason == CECHPWorkTrace.Trace_reason.TRACE_TALK)
|
||||
{
|
||||
// Visite other's booth, send hello message to him
|
||||
@@ -392,14 +391,14 @@ public class CECTracedPlayer : CECTracedObject
|
||||
{
|
||||
if (pPlayer.IsDead())
|
||||
{
|
||||
//if (m_iReason == CECHPWorkTrace.Trace_reason.TRACE_SPELL)
|
||||
//{
|
||||
// CECSkill pSkill = m_pHost.m_pPrepSkill;
|
||||
// if (pSkill && pSkill.GetTargetType() == 2)
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//}
|
||||
if (m_iReason == CECHPWorkTrace.Trace_reason.TRACE_SPELL)
|
||||
{
|
||||
CECSkill pSkill = m_pHost.m_pPrepSkill;
|
||||
if (pSkill != null && pSkill.GetTargetType() == 2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -666,14 +665,15 @@ public class CECHPWorkTrace : CECHPWork
|
||||
// Work is cancel
|
||||
public override void Cancel()
|
||||
{
|
||||
//if (m_pHost.m_pPrepSkill && m_pTraceObject.GetTraceReason() == Trace_reason.TRACE_SPELL)
|
||||
// m_pHost.m_pPrepSkill = null;
|
||||
if (m_pHost.m_pPrepSkill != null && m_pTraceObject.GetTraceReason() == Trace_reason.TRACE_SPELL)
|
||||
m_pHost.m_pPrepSkill = null;
|
||||
|
||||
ClearResetUseAutoPF();
|
||||
if (GetUseAutoPF())
|
||||
{
|
||||
SetUseAutoPF(false);
|
||||
}
|
||||
//TODO: m_pHost.StopModelMove(); uncomment and add logic
|
||||
//m_pHost.StopModelMove();
|
||||
base.Cancel();
|
||||
|
||||
@@ -714,8 +714,8 @@ public class CECHPWorkTrace : CECHPWork
|
||||
public void PressCancel()
|
||||
{
|
||||
m_bReadyCancel = true;
|
||||
//if (m_pTraceObject.GetTraceReason() == TRACE_SPELL)
|
||||
// m_pHost.m_pPrepSkill = NULL;
|
||||
if (m_pTraceObject.GetTraceReason() == Trace_reason.TRACE_SPELL)
|
||||
m_pHost.m_pPrepSkill = null;
|
||||
}
|
||||
// Set move close flag
|
||||
public void SetMoveCloseFlag(bool bMoveClose) { m_pTraceObject.SetMoveCloseFlag(bMoveClose); }
|
||||
@@ -757,10 +757,10 @@ public class CECHPWorkTrace : CECHPWork
|
||||
{
|
||||
m_pTraceObject.OnTargetMissing();
|
||||
}
|
||||
//else if (m_pTraceObject.GetTraceReason() == Trace_reason.TRACE_SPELL)
|
||||
//{
|
||||
// m_pHost.m_pPrepSkill = null;
|
||||
//}
|
||||
else if (m_pTraceObject.GetTraceReason() == Trace_reason.TRACE_SPELL)
|
||||
{
|
||||
m_pHost.m_pPrepSkill = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnTouchTarget()
|
||||
|
||||
@@ -39,7 +39,7 @@ public abstract partial class CECPlayer : CECObject
|
||||
[SerializeField] internal int m_idCurHover; // ID of object under cursor
|
||||
protected int m_iShape; // Ñ¡ÖÐÄ¿±êµÄID
|
||||
protected uint m_dwStates; // Player's basic states
|
||||
|
||||
|
||||
// 当前攻击方式 // Action type for attack animation
|
||||
protected uint m_uAttackType;
|
||||
protected int[] m_aEquips;
|
||||
@@ -214,12 +214,12 @@ public abstract partial class CECPlayer : CECObject
|
||||
public static async Task<bool> LoadPlayerSkin(GameObject aSkins, int index, string szFile)
|
||||
{
|
||||
// these are LOD suffix
|
||||
string[] suffix1 = {"一�?", "二级", "三级"};
|
||||
string[] suffix2 = {"", "二级", "三级"};
|
||||
|
||||
string[] suffix1 = { "一�?", "二级", "三级" };
|
||||
string[] suffix2 = { "", "二级", "三级" };
|
||||
|
||||
string szSkinFile = "";
|
||||
|
||||
if( index == EC_Player_Skin_Const.SKIN_BODY_INDEX || index == EC_Player_Skin_Const.SKIN_HEAD_INDEX )
|
||||
if (index == EC_Player_Skin_Const.SKIN_BODY_INDEX || index == EC_Player_Skin_Const.SKIN_HEAD_INDEX)
|
||||
szSkinFile = $"{szFile}{suffix2[0]}";
|
||||
else
|
||||
szSkinFile = $"{szFile}{suffix1[0]}";
|
||||
@@ -658,16 +658,16 @@ public abstract partial class CECPlayer : CECObject
|
||||
}
|
||||
if (ElementSkill.IsGoblinSkill((uint)idSkill) &&
|
||||
ElementSkill.GetType((uint)idSkill) == 2)
|
||||
{
|
||||
pAttack = CECAttacksMan.Instance.AddSkillAttack(
|
||||
GetPlayerInfo().cid, GetPlayerInfo().cid, idTarget, GetWeaponID(), idSkill, skillLevel, dwModifier, nDamage);
|
||||
}
|
||||
else
|
||||
{
|
||||
// begin a skill attack
|
||||
pAttack = CECAttacksMan.Instance.AddSkillAttack(
|
||||
GetPlayerInfo().cid, m_idCurSkillTarget, idTarget, GetWeaponID(), idSkill, skillLevel, dwModifier, nDamage);
|
||||
}
|
||||
{
|
||||
pAttack = CECAttacksMan.Instance.AddSkillAttack(
|
||||
GetPlayerInfo().cid, GetPlayerInfo().cid, idTarget, GetWeaponID(), idSkill, skillLevel, dwModifier, nDamage);
|
||||
}
|
||||
else
|
||||
{
|
||||
// begin a skill attack
|
||||
pAttack = CECAttacksMan.Instance.AddSkillAttack(
|
||||
GetPlayerInfo().cid, m_idCurSkillTarget, idTarget, GetWeaponID(), idSkill, skillLevel, dwModifier, nDamage);
|
||||
}
|
||||
|
||||
if (pAttack != null)
|
||||
{
|
||||
@@ -675,7 +675,7 @@ public abstract partial class CECPlayer : CECObject
|
||||
pAttack.SetSkillSection(nSection);
|
||||
if (!IsDead() && (dwModifier & (uint)MOD.MOD_RETORT) == 0
|
||||
&& (dwModifier & (uint)MOD.MOD_ATTACK_AURA) == 0
|
||||
&& PlaySkillAttackAction(idSkill, nAttackSpeed,ref unusedInt, nSection, pAttack)
|
||||
&& PlaySkillAttackAction(idSkill, nAttackSpeed, ref unusedInt, nSection, pAttack)
|
||||
&& (dwModifier & (uint)MOD.MOD_BEAT_BACK) == 0)
|
||||
{
|
||||
}
|
||||
@@ -735,7 +735,7 @@ public abstract partial class CECPlayer : CECObject
|
||||
// ==============================
|
||||
if (GetMoveEnv() == (int)MoveEnvironment.MOVEENV_GROUND)
|
||||
{
|
||||
|
||||
|
||||
// “起�? 动作(挥起)
|
||||
szAct = EC_Utility.BuildActionName(action, weapon_type, "起");
|
||||
EventBus.PublishChannel(m_PlayerInfo.cid, new PlayActionEvent(szAct));
|
||||
@@ -1131,7 +1131,10 @@ public abstract partial class CECPlayer : CECObject
|
||||
|
||||
return iAction;
|
||||
}
|
||||
|
||||
public A3DVECTOR3 GetModelMoveDir()
|
||||
{ // ÒÆ¶¯Ê±¡¢·µ»ØÒƶ¯³¯Ïò£¬¾²Ö¹Ê±¡¢·µ»ØÄ£Ðͳ¯Ïò
|
||||
return EC_Utility.ToA3DVECTOR3(transform.forward);
|
||||
}
|
||||
public void Damaged(int nDamage, uint dwModifier = 0, int skill = 0)
|
||||
{
|
||||
if (nDamage == -2)
|
||||
@@ -1174,8 +1177,8 @@ public abstract partial class CECPlayer : CECObject
|
||||
if (!OnDamaged(skill))
|
||||
// PlayAction((int)PLAYER_ACTION_TYPE.ACT_WOUNDED);
|
||||
|
||||
DamageTextManager.Instance.ShowDamageText(
|
||||
transform.position, nDamage, Color.yellow, 1.0f);
|
||||
DamageTextManager.Instance.ShowDamageText(
|
||||
transform.position, nDamage, Color.yellow, 1.0f);
|
||||
/* if (dwModifier & CECAttackEvent::MOD_IMMUNE)
|
||||
BubbleText(BUBBLE_IMMUNE, 0);
|
||||
else if (dwModifier & CECAttackEvent::MOD_REBOUND)
|
||||
@@ -1270,7 +1273,7 @@ public abstract partial class CECPlayer : CECObject
|
||||
|
||||
int weapon_type = GetShowingWeaponType();
|
||||
|
||||
if (!_default_skill_actions.TryGetValue((uint)idSkill, out PLAYER_ACTION_INFO_CONFIG data) ||
|
||||
if (!_default_skill_actions.TryGetValue((uint)idSkill, out PLAYER_ACTION_INFO_CONFIG data) ||
|
||||
data.action_prefix == null || data.action_prefix.Length == 0 || data.action_prefix[0] == 0)
|
||||
{
|
||||
// Check if it's a target item skill / 检查是否为目标道具技能
|
||||
@@ -1295,7 +1298,7 @@ public abstract partial class CECPlayer : CECObject
|
||||
{
|
||||
szAct = EC_Utility.BuildActionName(data, weapon_type, "_施放起_");
|
||||
GetSkillSectionActionName(ref szAct, idSkill, nSection);
|
||||
|
||||
|
||||
if (!PlaySkillAttackActionWithName(idSkill, szAct, bHideFX, attackEvent))
|
||||
{
|
||||
return false;
|
||||
@@ -1319,10 +1322,10 @@ public abstract partial class CECPlayer : CECObject
|
||||
{
|
||||
// 空中动作 / Air action
|
||||
string szActionMiddleName = null;
|
||||
if ((m_wingType == enumWingType.WINGTYPE_WING && IsFlying()) ||
|
||||
(m_iProfession == PROFESSION.PROF_ANGEL) ||
|
||||
(m_iProfession == PROFESSION.PROF_ARCHOR) ||
|
||||
(m_iProfession == PROFESSION.PROF_MONK) ||
|
||||
if ((m_wingType == enumWingType.WINGTYPE_WING && IsFlying()) ||
|
||||
(m_iProfession == PROFESSION.PROF_ANGEL) ||
|
||||
(m_iProfession == PROFESSION.PROF_ARCHOR) ||
|
||||
(m_iProfession == PROFESSION.PROF_MONK) ||
|
||||
(m_iProfession == PROFESSION.PROF_GHOST))
|
||||
{
|
||||
szActionMiddleName = "_空中翅膀"; // Air with wings / 空中翅膀
|
||||
@@ -1335,7 +1338,7 @@ public abstract partial class CECPlayer : CECObject
|
||||
szActionMiddleName += "_施放起_";
|
||||
szAct = EC_Utility.BuildActionName(data, weapon_type, szActionMiddleName);
|
||||
GetSkillSectionActionName(ref szAct, idSkill, nSection);
|
||||
|
||||
|
||||
if (!PlaySkillAttackActionWithName(idSkill, szAct, bHideFX, attackEvent))
|
||||
{
|
||||
return false;
|
||||
@@ -1466,9 +1469,9 @@ public abstract partial class CECPlayer : CECObject
|
||||
return (m_dwResFlags & (uint)PlayerResourcesReadyFlag.RESFG_ALL) == (uint)PlayerResourcesReadyFlag.RESFG_ALL;
|
||||
}
|
||||
// Get character ID
|
||||
|
||||
|
||||
// Play Gfx on Models
|
||||
protected bool PlayGfx(string szPath, string szHook, float fScale /*1.0f*/, uint iShapeTypeMask /*(1<<PLAYERMODEL_MAJOR)*/, bool bForceNoRecord =false)
|
||||
protected bool PlayGfx(string szPath, string szHook, float fScale /*1.0f*/, uint iShapeTypeMask /*(1<<PLAYERMODEL_MAJOR)*/, bool bForceNoRecord = false)
|
||||
{
|
||||
// bool bPlayed(false);
|
||||
// bool bSkipRecord = (iShapeTypeMask != PLAYERMODEL_TYPEALL) || bForceNoRecord;
|
||||
@@ -1501,16 +1504,16 @@ public abstract partial class CECPlayer : CECObject
|
||||
{
|
||||
// Usage: Load the prefab asynchronously using AddressableManager
|
||||
GameObject prefab = await AddressableManager.Instance.LoadPrefabAsync(path);
|
||||
if(prefab != null)
|
||||
if (prefab != null)
|
||||
{
|
||||
if (_levelUpVfx != null)
|
||||
{
|
||||
if(_levelUpVfx.IsPlaying())
|
||||
if (_levelUpVfx.IsPlaying())
|
||||
return;
|
||||
_levelUpVfx.Play();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Instantiate at player's current position and rotation
|
||||
_levelUpVfx = Instantiate(prefab, transform).GetComponent<BaseVfxObject>();
|
||||
_levelUpVfx.Play();
|
||||
|
||||
@@ -236,7 +236,7 @@ namespace BrewMonster.Scripts.Skills
|
||||
public virtual int GetRequiredGenius(int idSkill) { return 0; }
|
||||
|
||||
// Ч���ļ���
|
||||
public virtual byte[] GetEffect() { return null; }
|
||||
public virtual string GetEffect() { return null; }
|
||||
public static string GetEffect(uint id)
|
||||
{
|
||||
SkillStub stub = SkillStub.GetStub(id);
|
||||
|
||||
@@ -62,6 +62,30 @@ namespace BrewMonster.Scripts.Skills
|
||||
return stub.GetIcon();
|
||||
}
|
||||
public override string GetName() { return stub.GetName(); }
|
||||
public override float GetPrayRange(float range, float prayplus)
|
||||
{
|
||||
player.SetRange(range);
|
||||
player.SetPrayrangeplus(prayplus);
|
||||
if (stub.type == (int)skill_type.TYPE_ATTACK || stub.type == (int)skill_type.TYPE_CURSE)
|
||||
{
|
||||
if (stub.auto_attack)
|
||||
{
|
||||
float r = 0.3f * stub.GetPraydistance(this);
|
||||
if (r >= 1.0)
|
||||
return stub.GetPraydistance(this) - 1.0f;
|
||||
else
|
||||
return (float)0.7 * stub.GetPraydistance(this);
|
||||
}
|
||||
else
|
||||
return stub.GetPraydistance(this);
|
||||
}
|
||||
if (stub.type == (int)skill_type.TYPE_JUMP)
|
||||
return stub.GetPraydistance(this);
|
||||
if (stub.GetRange().NoTarget())
|
||||
return -1;
|
||||
else
|
||||
return stub.GetPraydistance(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f8e7f880d49b36a46b4db77d90dced72
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,348 @@
|
||||
using Animancer;
|
||||
using BrewMonster;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace BrewMonster.Scripts.UI.Inventory
|
||||
{
|
||||
/// <summary>
|
||||
/// Clones the current host-player visual model into a dedicated preview rig for the inventory UI.
|
||||
/// </summary>
|
||||
[DisallowMultipleComponent]
|
||||
public class InventoryCharacterPreview : MonoBehaviour
|
||||
{
|
||||
[Header("Player Binding")]
|
||||
[SerializeField] private CECHostPlayer hostPlayer;
|
||||
[Tooltip("Auto locate the active host player if none is assigned.")]
|
||||
[SerializeField] private bool autoBindHostPlayer = true;
|
||||
[Tooltip("Optional manual override for the visual root. Leave empty to auto detect the PlayerVisual/host root.")]
|
||||
[SerializeField] private Transform sourceModelRoot;
|
||||
[Tooltip("Clone the entire CECHostPlayer hierarchy instead of just the PlayerVisual child.")]
|
||||
[SerializeField] private bool cloneWholeHostHierarchy = true;
|
||||
[Tooltip("Remove gameplay scripts/colliders from the preview clone when duplicating the full hierarchy.")]
|
||||
[SerializeField] private bool stripRuntimeComponents = true;
|
||||
|
||||
[Header("Preview Rig")]
|
||||
[SerializeField] private Transform previewRoot;
|
||||
[SerializeField] private Vector3 previewLocalPosition = Vector3.zero;
|
||||
[SerializeField] private Vector3 previewLocalEuler;
|
||||
[SerializeField] private Vector3 previewLocalScale = Vector3.one;
|
||||
[Tooltip("Copy the preview root layer onto the cloned hierarchy so the preview camera can isolate it.")]
|
||||
[SerializeField] private bool inheritPreviewLayer = true;
|
||||
|
||||
[Header("Camera Output")]
|
||||
[SerializeField] private Camera previewCamera;
|
||||
[SerializeField] private RawImage previewFrame;
|
||||
[SerializeField] private RenderTexture previewRenderTexture;
|
||||
[SerializeField] private bool autoFocusCamera = true;
|
||||
[SerializeField] private Vector3 cameraFocusOffset = new Vector3(0f, 1.5f, 0f);
|
||||
|
||||
[Header("Behaviour")]
|
||||
[Tooltip("Disable PlayerVisual/Animancer components on the clone so it stays in a frozen idle pose.")]
|
||||
[SerializeField] private bool freezeAnimation = true;
|
||||
|
||||
private GameObject _previewInstance;
|
||||
private bool _refreshQueued;
|
||||
private int _lastOriginModelChildCount;
|
||||
private Transform _lastOriginModelRoot;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (previewRoot == null)
|
||||
{
|
||||
previewRoot = transform;
|
||||
}
|
||||
|
||||
TryBindHostPlayer();
|
||||
EnsureCameraBindings();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
QueueRefresh();
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
DestroyPreviewInstance();
|
||||
}
|
||||
|
||||
private void LateUpdate()
|
||||
{
|
||||
TryBindHostPlayer();
|
||||
|
||||
// Check if origin model structure has changed (equipment models are child objects)
|
||||
// This detects equipment changes in realtime since all equipment is attached as children
|
||||
var currentOriginRoot = ResolveSourceModelRoot();
|
||||
if (currentOriginRoot != null)
|
||||
{
|
||||
int currentChildCount = CountAllChildren(currentOriginRoot);
|
||||
|
||||
// Refresh if origin model changed or child count changed (equipment added/removed)
|
||||
if (_lastOriginModelRoot != currentOriginRoot || _lastOriginModelChildCount != currentChildCount)
|
||||
{
|
||||
_lastOriginModelRoot = currentOriginRoot;
|
||||
_lastOriginModelChildCount = currentChildCount;
|
||||
QueueRefresh();
|
||||
}
|
||||
}
|
||||
|
||||
if (_refreshQueued)
|
||||
{
|
||||
_refreshQueued = false;
|
||||
BuildPreviewModel();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Allows manual binding from external UI scripts.</summary>
|
||||
public void BindPlayer(CECHostPlayer player)
|
||||
{
|
||||
if (player == null || player == hostPlayer)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
hostPlayer = player;
|
||||
QueueRefresh();
|
||||
}
|
||||
|
||||
/// <summary>Forces an immediate rebuild of the preview model.</summary>
|
||||
public void ForceRefreshNow()
|
||||
{
|
||||
_refreshQueued = false;
|
||||
BuildPreviewModel();
|
||||
}
|
||||
|
||||
/// <summary>Marks the clone dirty so it gets recreated next LateUpdate.</summary>
|
||||
public void QueueRefresh()
|
||||
{
|
||||
_refreshQueued = true;
|
||||
}
|
||||
|
||||
|
||||
private void TryBindHostPlayer()
|
||||
{
|
||||
if (!autoBindHostPlayer || hostPlayer != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
hostPlayer = FindFirstObjectByType<CECHostPlayer>();
|
||||
if (hostPlayer != null)
|
||||
{
|
||||
QueueRefresh();
|
||||
}
|
||||
}
|
||||
|
||||
private void EnsureCameraBindings()
|
||||
{
|
||||
if (previewCamera != null && previewRenderTexture != null)
|
||||
{
|
||||
previewCamera.targetTexture = previewRenderTexture;
|
||||
}
|
||||
|
||||
if (previewFrame != null && previewCamera != null)
|
||||
{
|
||||
previewFrame.texture = previewCamera.targetTexture;
|
||||
}
|
||||
}
|
||||
|
||||
private void BuildPreviewModel()
|
||||
{
|
||||
if (previewRoot == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var sourceRoot = ResolveSourceModelRoot();
|
||||
if (sourceRoot == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DestroyPreviewInstance();
|
||||
|
||||
_previewInstance = Instantiate(sourceRoot.gameObject, previewRoot, false);
|
||||
_previewInstance.name = $"{sourceRoot.name}_Preview";
|
||||
|
||||
var instanceTransform = _previewInstance.transform;
|
||||
instanceTransform.localPosition = previewLocalPosition;
|
||||
instanceTransform.localRotation = Quaternion.Euler(previewLocalEuler);
|
||||
instanceTransform.localScale = previewLocalScale;
|
||||
|
||||
if (inheritPreviewLayer)
|
||||
{
|
||||
ApplyLayerRecursive(instanceTransform, previewRoot.gameObject.layer);
|
||||
}
|
||||
|
||||
if (freezeAnimation)
|
||||
{
|
||||
DisableComponentInChildren<PlayerVisual>(_previewInstance);
|
||||
DisableComponentInChildren<AnimancerComponent>(_previewInstance);
|
||||
DisableComponentInChildren<Animator>(_previewInstance);
|
||||
FreezeAnimators(_previewInstance);
|
||||
}
|
||||
|
||||
if (cloneWholeHostHierarchy && stripRuntimeComponents)
|
||||
{
|
||||
StripRuntimeScripts(_previewInstance);
|
||||
}
|
||||
|
||||
EnsureCameraFocus(instanceTransform);
|
||||
}
|
||||
|
||||
private Transform ResolveSourceModelRoot()
|
||||
{
|
||||
if (sourceModelRoot != null)
|
||||
{
|
||||
return sourceModelRoot;
|
||||
}
|
||||
|
||||
if (hostPlayer == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (cloneWholeHostHierarchy)
|
||||
{
|
||||
sourceModelRoot = hostPlayer.transform;
|
||||
return sourceModelRoot;
|
||||
}
|
||||
|
||||
var playerVisual = hostPlayer.GetComponentInChildren<PlayerVisual>(true);
|
||||
sourceModelRoot = playerVisual != null ? playerVisual.transform : hostPlayer.transform;
|
||||
return sourceModelRoot;
|
||||
}
|
||||
|
||||
private void DestroyPreviewInstance()
|
||||
{
|
||||
if (_previewInstance != null)
|
||||
{
|
||||
Destroy(_previewInstance);
|
||||
_previewInstance = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static void DisableComponentInChildren<T>(GameObject root) where T : Behaviour
|
||||
{
|
||||
if (root == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var components = root.GetComponentsInChildren<T>(true);
|
||||
for (int i = 0; i < components.Length; i++)
|
||||
{
|
||||
var component = components[i];
|
||||
if (component == null)
|
||||
continue;
|
||||
|
||||
component.enabled = false;
|
||||
|
||||
if (component is PlayerVisual)
|
||||
{
|
||||
Destroy(component);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ApplyLayerRecursive(Transform root, int layer)
|
||||
{
|
||||
if (root == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
root.gameObject.layer = layer;
|
||||
for (int i = 0; i < root.childCount; i++)
|
||||
{
|
||||
ApplyLayerRecursive(root.GetChild(i), layer);
|
||||
}
|
||||
}
|
||||
|
||||
private void EnsureCameraFocus(Transform modelRoot)
|
||||
{
|
||||
if (!autoFocusCamera || previewCamera == null || modelRoot == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var focusPoint = modelRoot.TransformPoint(cameraFocusOffset);
|
||||
|
||||
}
|
||||
|
||||
private void StripRuntimeScripts(GameObject cloneRoot)
|
||||
{
|
||||
if (cloneRoot == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var monoBehaviours = cloneRoot.GetComponentsInChildren<MonoBehaviour>(true);
|
||||
for (int i = 0; i < monoBehaviours.Length; i++)
|
||||
{
|
||||
var behaviour = monoBehaviours[i];
|
||||
if (behaviour == null)
|
||||
continue;
|
||||
|
||||
Destroy(behaviour);
|
||||
}
|
||||
|
||||
var colliders = cloneRoot.GetComponentsInChildren<Collider>(true);
|
||||
for (int i = 0; i < colliders.Length; i++)
|
||||
{
|
||||
var collider = colliders[i];
|
||||
if (collider == null)
|
||||
continue;
|
||||
|
||||
Destroy(collider);
|
||||
}
|
||||
|
||||
var rigidbodies = cloneRoot.GetComponentsInChildren<Rigidbody>(true);
|
||||
for (int i = 0; i < rigidbodies.Length; i++)
|
||||
{
|
||||
var body = rigidbodies[i];
|
||||
if (body == null)
|
||||
continue;
|
||||
|
||||
Destroy(body);
|
||||
}
|
||||
}
|
||||
|
||||
private void FreezeAnimators(GameObject cloneRoot)
|
||||
{
|
||||
if (cloneRoot == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var animators = cloneRoot.GetComponentsInChildren<Animator>(true);
|
||||
for (int i = 0; i < animators.Length; i++)
|
||||
{
|
||||
var animator = animators[i];
|
||||
if (animator == null)
|
||||
continue;
|
||||
|
||||
animator.speed = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Counts all children recursively in the transform hierarchy.
|
||||
/// Used to detect when equipment (child objects) are added or removed from the origin model.
|
||||
/// </summary>
|
||||
private int CountAllChildren(Transform root)
|
||||
{
|
||||
if (root == null)
|
||||
return 0;
|
||||
|
||||
int count = root.childCount;
|
||||
for (int i = 0; i < root.childCount; i++)
|
||||
{
|
||||
count += CountAllChildren(root.GetChild(i));
|
||||
}
|
||||
return count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 693e85b6242cc8f4ea4c161aa42dfb1f
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:1734bc3bbb9d9f31e15fcc30adbcaa1f1906731462eb6f3f8866fd891c6d7bfa
|
||||
size 195024
|
||||
oid sha256:dd6a5487d45e92fbbfd38167c3c3119dac0b4d87ec25b335e62d3fa7f59ab98c
|
||||
size 215453
|
||||
|
||||
+212
-42
@@ -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
|
||||
@@ -87,6 +87,9 @@ namespace BrewMonster
|
||||
private bool m_bMelee;
|
||||
private int MAX_JUMP_COUNT = 2;
|
||||
bool m_bUsingTrashBox = false; // Whether being using trash box
|
||||
private float m_fPrayDistancePlus;
|
||||
private A3DVECTOR3 g_vOrigin = new A3DVECTOR3(0f);
|
||||
private Transform playerTransform;
|
||||
|
||||
// ====== Ground cast config ======
|
||||
[Header("Ground Cast")]
|
||||
@@ -134,6 +137,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)
|
||||
{
|
||||
@@ -161,7 +165,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);
|
||||
|
||||
@@ -174,6 +178,7 @@ namespace BrewMonster
|
||||
|
||||
m_TaskCounter.SetCounter(3000f);
|
||||
m_bTitleDataReady = false;
|
||||
playerTransform = transform;
|
||||
}
|
||||
|
||||
public bool LoadResources()
|
||||
@@ -236,7 +241,7 @@ namespace BrewMonster
|
||||
mainCam = FindFirstObjectByType<Camera>();
|
||||
}
|
||||
|
||||
_playerStateMachine.InitState(_idleState);
|
||||
// _playerStateMachine.InitState(_idleState);
|
||||
// btnJump.onClick.AddListener(HandleJump);
|
||||
|
||||
// Cache input devices for better performance
|
||||
@@ -273,7 +278,7 @@ namespace BrewMonster
|
||||
|
||||
public void StopMovement()
|
||||
{
|
||||
m_MoveCtrl.SendStopMoveCmd(transform.position, 5f, (int)GPMoveMode.GP_MOVE_WALK);
|
||||
m_MoveCtrl.SendStopMoveCmd(playerTransform.position, 5f, (int)GPMoveMode.GP_MOVE_WALK);
|
||||
}
|
||||
|
||||
public void HandleMovement()
|
||||
@@ -309,10 +314,10 @@ namespace BrewMonster
|
||||
controller.Move(finalMove * Time.deltaTime);
|
||||
transform.forward = move;
|
||||
m_MoveCtrl.GroundMove(Time.deltaTime);
|
||||
m_MoveCtrl.SendMoveCmd(transform.position, controller.velocity, (int)GPMoveMode.GP_MOVE_RUN);
|
||||
m_aabb.Center = EC_Utility.ToA3DVECTOR3(transform.position) + new A3DVECTOR3(0.0f, m_aabb.Extents.y, 0.0f);
|
||||
m_MoveCtrl.SendMoveCmd(playerTransform.position, controller.velocity, (int)GPMoveMode.GP_MOVE_RUN);
|
||||
m_aabb.Center = EC_Utility.ToA3DVECTOR3(playerTransform.position) + new A3DVECTOR3(0.0f, m_aabb.Extents.y, 0.0f);
|
||||
m_aabb.CompleteMinsMaxs();
|
||||
m_aabbServer.Center = EC_Utility.ToA3DVECTOR3(transform.position) + new A3DVECTOR3(0.0f, m_aabbServer.Extents.y, 0.0f);
|
||||
m_aabbServer.Center = EC_Utility.ToA3DVECTOR3(playerTransform.position) + new A3DVECTOR3(0.0f, m_aabbServer.Extents.y, 0.0f);
|
||||
m_aabbServer.CompleteMinsMaxs();
|
||||
}
|
||||
else
|
||||
@@ -322,7 +327,7 @@ namespace BrewMonster
|
||||
|
||||
private void JoystickRelease(JoystickRealeaseEvent joystickRealeaseEvent)
|
||||
{
|
||||
_playerStateMachine.ChangeState(_idleState);
|
||||
// _playerStateMachine.ChangeState(_idleState);
|
||||
}
|
||||
|
||||
public bool GroundCheck(out RaycastHit hit)
|
||||
@@ -591,7 +596,7 @@ namespace BrewMonster
|
||||
|
||||
EventBus.Publish(new EXPToUpLevel(GetLevelUpExp(pCmd.sLevel)));
|
||||
EventBus.Publish<cmd_self_info_00>(pCmd);
|
||||
EventBus.PublishChannel<cmd_self_info_00>(GetCharacterID(),pCmd);
|
||||
EventBus.PublishChannel<cmd_self_info_00>(GetCharacterID(), pCmd);
|
||||
// if (pCmd.State != 0 && m_bFight == false) PlayEnterBattleGfx();
|
||||
m_bFight = pCmd.State != 0 ? true : false;
|
||||
|
||||
@@ -749,6 +754,7 @@ namespace BrewMonster
|
||||
{
|
||||
ui.RefreshAll();
|
||||
}
|
||||
UpdateEquipSkins();
|
||||
}
|
||||
break;
|
||||
case CommandID.PICKUP_ITEM:
|
||||
@@ -867,6 +873,7 @@ namespace BrewMonster
|
||||
var equipInv = GetInventory(InventoryConst.IVTRTYPE_EQUIPPACK);
|
||||
var invItem = packInv?.GetItem(index_inv, true);
|
||||
var equipItem = equipInv?.GetItem(index_equip, true);
|
||||
UpdateEquipSkins();
|
||||
if (invItem != null)
|
||||
{
|
||||
invItem.Package = InventoryConst.IVTRTYPE_EQUIPPACK;
|
||||
@@ -887,7 +894,7 @@ namespace BrewMonster
|
||||
{
|
||||
ui.RefreshAll();
|
||||
}
|
||||
|
||||
UpdateEquipSkins();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1186,7 +1193,7 @@ namespace BrewMonster
|
||||
|
||||
public void SetPos(Vector3 pos)
|
||||
{
|
||||
transform.position = pos;
|
||||
playerTransform.position = pos;
|
||||
|
||||
m_aabb.Center = EC_Utility.ToA3DVECTOR3(pos) + new A3DVECTOR3(0.0f, m_aabb.Extents.y, 0.0f);
|
||||
m_aabb.CompleteMinsMaxs();
|
||||
@@ -1233,11 +1240,11 @@ namespace BrewMonster
|
||||
string roleName = Encoding.Unicode.GetString(UnityGameSession.Instance.GetRoleInfo().name.ByteArray);
|
||||
if (txtName != null) txtName.text = roleName;
|
||||
EventBus.Publish(new InfoHostPlayer(roleName));
|
||||
transform.position = pos;
|
||||
playerTransform.position = pos;
|
||||
m_dwResFlags = (uint)PlayerResourcesReadyFlag.RESFG_ALL;
|
||||
joystick = FindAnyObjectByType<Joystick>();
|
||||
EventBus.Subscribe<JoystickRealeaseEvent>(JoystickRelease);
|
||||
EventBus.Subscribe<JoystickPressEvent>(JoystickStartDrag);
|
||||
EventBus.Subscribe<JoystickPressEvent>(OnMsgHstPushMove);
|
||||
if (TryGetComponent<PlayerVisual>(out var visual))
|
||||
{
|
||||
visual.InitPlayerEventDoneHandler();
|
||||
@@ -1304,18 +1311,40 @@ namespace BrewMonster
|
||||
UnityGameSession.c2s_CmdSendEnterPKPrecinct();
|
||||
}
|
||||
|
||||
private void JoystickStartDrag(JoystickPressEvent joystickPressEvent)
|
||||
private void OnMsgHstPushMove(JoystickPressEvent joystickPressEvent)
|
||||
{
|
||||
_playerStateMachine.ChangeState(_moveState);
|
||||
//_playerStateMachine.ChangeState(_moveState);
|
||||
/* if (m_pWorkMan.IsSitting())
|
||||
{
|
||||
g_pGame.GetGameSession().c2s_CmdStandUp();
|
||||
return;
|
||||
}*/
|
||||
|
||||
if (!CanDo(ActionCanDo.CANDO_MOVETO)) return;
|
||||
|
||||
bool bPushMove = true;
|
||||
/* if (Msg.dwParam1 == 8 || Msg.dwParam1 == 9)
|
||||
{
|
||||
if (m_iMoveEnv != (int)MoveEnvironment.MOVEENV_AIR && m_iMoveEnv != (int)MoveEnvironment.MOVEENV_WATER)
|
||||
bPushMove = false;
|
||||
}*/
|
||||
|
||||
if (bPushMove /*&& !IsAboutToDie()*/ && CanDo(ActionCanDo.CANDO_MOVETO))
|
||||
{
|
||||
if (m_pWorkMan.CanStartWork(Host_work_ID.WORK_MOVETOPOS))
|
||||
{
|
||||
CECHPWorkMove pNewWork = (CECHPWorkMove)m_pWorkMan.CreateWork(Host_work_ID.WORK_MOVETOPOS);
|
||||
pNewWork.SetDestination(CECHPWorkMove.DestTypes.DEST_PUSH, g_vOrigin);
|
||||
m_pWorkMan.StartWork_p1(pNewWork);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
EventBus.Unsubscribe<JoystickRealeaseEvent>(JoystickRelease);
|
||||
EventBus.Unsubscribe<JoystickPressEvent>(JoystickStartDrag);
|
||||
EventBus.Unsubscribe<JoystickPressEvent>(OnMsgHstPushMove);
|
||||
}
|
||||
|
||||
|
||||
//TODO: Remove this function. Since it has been deprecated.
|
||||
public void InitCharacter(info_player_1 role)
|
||||
{
|
||||
@@ -1326,7 +1355,7 @@ namespace BrewMonster
|
||||
//}
|
||||
Vector3 pos = new Vector3(role.pos.x, role.pos.y, role.pos.z);
|
||||
if (txtName != null) txtName.text = roleName;
|
||||
transform.position = pos;
|
||||
playerTransform.position = pos;
|
||||
// SetPlayerModel();
|
||||
//Debug.LogError("Pos Character = " + pos);
|
||||
}
|
||||
@@ -1646,28 +1675,28 @@ namespace BrewMonster
|
||||
{
|
||||
fRange = m_ExtProps.ak.AttackRange * 0.7f;
|
||||
}
|
||||
|
||||
|
||||
if (fDist - fTargetRad <= fRange)
|
||||
return true;
|
||||
|
||||
break;
|
||||
}
|
||||
//case 2: // cast magic
|
||||
//{
|
||||
// if (m_pPrepSkill)
|
||||
// {
|
||||
// float fRange = m_pPrepSkill.GetCastRange(m_ExtProps.ak.AttackRange, GetPrayDistancePlus());
|
||||
// if (fRange > 0.0f)
|
||||
// {
|
||||
// if (fDist - fTargetRad <= fRange)
|
||||
// return true;
|
||||
// }
|
||||
// else
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// break;
|
||||
//}
|
||||
case 2: // cast magic
|
||||
{
|
||||
if (m_pPrepSkill != null)
|
||||
{
|
||||
//TODO : Check this function GetCastRange
|
||||
float fRange = m_pPrepSkill.GetCastRange(m_ExtProps.ak.AttackRange, GetPrayDistancePlus());
|
||||
if (fRange > 0.0f)
|
||||
{
|
||||
if (fDist - fTargetRad <= fRange)
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 3: // talk
|
||||
{
|
||||
if (fDist - fTargetRad <= 5.0f)
|
||||
@@ -1701,8 +1730,8 @@ namespace BrewMonster
|
||||
|
||||
public bool CanTouchTarget(A3DVECTOR3 vTargetPos, float fTargetRad, int iReason, float fMaxCut = 1.0f)
|
||||
{
|
||||
A3DVECTOR3 vector = new A3DVECTOR3(gameObject.transform.position.x, gameObject.transform.position.y,
|
||||
gameObject.transform.position.z);
|
||||
A3DVECTOR3 vector = new A3DVECTOR3(playerTransform.position.x, playerTransform.position.y,
|
||||
playerTransform.position.z);
|
||||
return CanTouchTarget(vector, vTargetPos, fTargetRad, iReason, fMaxCut);
|
||||
}
|
||||
|
||||
@@ -1723,13 +1752,17 @@ namespace BrewMonster
|
||||
{
|
||||
return m_pvp.bEnable;
|
||||
}
|
||||
public float GetPrayDistancePlus() { return m_fPrayDistancePlus; }
|
||||
|
||||
// Get faction ID
|
||||
public int GetFactionID()
|
||||
{
|
||||
return m_idFaction;
|
||||
}
|
||||
|
||||
public void SetPrayDistancePlus(float prayDistancePlus)
|
||||
{
|
||||
m_fPrayDistancePlus = prayDistancePlus;
|
||||
}
|
||||
public bool IsJumping()
|
||||
{
|
||||
return m_iJumpCount > 0;
|
||||
@@ -2199,6 +2232,7 @@ namespace BrewMonster
|
||||
{
|
||||
byte byPVPMask = glb_BuildPVPMask(bForceAttack);
|
||||
UnityGameSession.c2s_CmdCastSkill(m_pPrepSkill.GetSkillID(), byPVPMask, 1, idTarget);
|
||||
PlayAction((int)PLAYER_ACTION_TYPE.ACT_STAND, false, 300, false);
|
||||
return true;
|
||||
}
|
||||
public bool UpdateEquipSkins()
|
||||
@@ -2832,6 +2866,134 @@ namespace BrewMonster
|
||||
m_bIsInKingService = false;
|
||||
//m_pOffShopCtrl.SetNPCSevFlag(COfflineShopCtrl::NPCSEV_NULL);
|
||||
}
|
||||
public bool GetPushDir(ref Vector3 vPushDir, uint dwMask, float deltaTime)
|
||||
{
|
||||
/* // reset
|
||||
vPushDir = Vector3.zero;
|
||||
Vector3 vRight = Vector3.zero;
|
||||
bool bMove = false;
|
||||
|
||||
// Không bấm gì → không có hướng
|
||||
if (m_dwMoveRelDir == 0)
|
||||
return false;
|
||||
|
||||
// ===== LEFT =====
|
||||
if ((m_dwMoveRelDir & MD_LEFT) != 0)
|
||||
{
|
||||
// Nếu trên không → xoay camera thay vì di chuyển
|
||||
if (m_iMoveEnv == MOVEENV_AIR)
|
||||
{
|
||||
// giữ nguyên logic PW
|
||||
ECMSG msg = new ECMSG();
|
||||
msg.dwParam2 = 0;
|
||||
msg.dwParam1 = (uint)(_yaw_vel_air * deltaTime);
|
||||
|
||||
if ((m_dwMoveRelDir & MD_BACK) != 0)
|
||||
msg.dwParam1 = (uint)(-(int)msg.dwParam1);
|
||||
|
||||
OnMsgHstYaw(msg); // TODO: bạn map hàm này sang Unity
|
||||
}
|
||||
else if (m_iMoveEnv == MOVEENV_WATER)
|
||||
{
|
||||
ECMSG msg = new ECMSG();
|
||||
msg.dwParam2 = 0;
|
||||
msg.dwParam1 = (uint)(_yaw_vel * deltaTime);
|
||||
|
||||
if ((m_dwMoveRelDir & MD_BACK) != 0)
|
||||
msg.dwParam1 = (uint)(-(int)msg.dwParam1);
|
||||
|
||||
OnMsgHstYaw(msg); // TODO
|
||||
}
|
||||
else
|
||||
{
|
||||
// Mặt đất → di chuyển sang trái theo camera
|
||||
// C++: vRight = -m_CameraCoord.GetRight();
|
||||
Vector3 camRight = m_CameraCoord.GetRight(); // TODO: map sang Unity Camera?
|
||||
vRight = -camRight;
|
||||
vRight.y = 0;
|
||||
vRight.Normalize();
|
||||
|
||||
vPushDir = vRight;
|
||||
bMove = true;
|
||||
}
|
||||
}
|
||||
|
||||
// ===== RIGHT =====
|
||||
else if ((m_dwMoveRelDir & MD_RIGHT) != 0)
|
||||
{
|
||||
if (m_iMoveEnv == MOVEENV_AIR)
|
||||
{
|
||||
ECMSG msg = new ECMSG();
|
||||
msg.dwParam2 = 0;
|
||||
msg.dwParam1 = (uint)((-_yaw_vel_air) * deltaTime);
|
||||
|
||||
if ((m_dwMoveRelDir & MD_BACK) != 0)
|
||||
msg.dwParam1 = (uint)(-(int)msg.dwParam1);
|
||||
|
||||
OnMsgHstYaw(msg); // TODO
|
||||
}
|
||||
else if (m_iMoveEnv == MOVEENV_WATER)
|
||||
{
|
||||
ECMSG msg = new ECMSG();
|
||||
msg.dwParam2 = 0;
|
||||
msg.dwParam1 = (uint)((-_yaw_vel) * deltaTime);
|
||||
|
||||
if ((m_dwMoveRelDir & MD_BACK) != 0)
|
||||
msg.dwParam1 = (uint)(-(int)msg.dwParam1);
|
||||
|
||||
OnMsgHstYaw(msg); // TODO
|
||||
}
|
||||
else
|
||||
{
|
||||
// Mặt đất → di chuyển sang phải theo camera
|
||||
Vector3 camRight = m_CameraCoord.GetRight(); // TODO
|
||||
vRight = camRight;
|
||||
vRight.y = 0;
|
||||
vRight.Normalize();
|
||||
|
||||
vPushDir = vRight;
|
||||
bMove = true;
|
||||
}
|
||||
}
|
||||
|
||||
// ===== FORWARD =====
|
||||
if ((m_dwMoveRelDir & MD_FORWARD) != 0)
|
||||
{
|
||||
Vector3 forward = m_CameraCoord.GetDir(); // TODO
|
||||
forward.y = 0;
|
||||
forward.Normalize();
|
||||
|
||||
vPushDir = forward;
|
||||
|
||||
if (bMove)
|
||||
{
|
||||
vPushDir += vRight;
|
||||
vPushDir.Normalize();
|
||||
}
|
||||
}
|
||||
// ===== BACK =====
|
||||
else if ((m_dwMoveRelDir & MD_BACK) != 0)
|
||||
{
|
||||
Vector3 back = -m_CameraCoord.GetDir(); // TODO
|
||||
back.y = 0;
|
||||
back.Normalize();
|
||||
|
||||
vPushDir = back;
|
||||
|
||||
if (bMove)
|
||||
{
|
||||
vPushDir += vRight;
|
||||
vPushDir.Normalize();
|
||||
}
|
||||
}
|
||||
// ===== ABS UP (nếu mask cho phép) =====
|
||||
else if (((m_dwMoveRelDir & MD_ABSUP) != 0) && ((dwMask & MD_ABSUP) != 0))
|
||||
{
|
||||
vPushDir = Vector3.up;
|
||||
}*/
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void UpdateGFXs(float dwDeltaTime)
|
||||
{
|
||||
@@ -3112,9 +3274,6 @@ namespace BrewMonster
|
||||
}
|
||||
|
||||
bool IsSitting() { return (m_dwStates & PlayerNPCState.GP_STATE_SITDOWN) != 0 ? true : false; }
|
||||
// Is host in melee state ?
|
||||
bool IsMeleeing() { return m_bMelee; }
|
||||
|
||||
// Is host player open trash box ?
|
||||
bool IsUsingTrashBox() { return m_bUsingTrashBox; }
|
||||
// Is host player talking with NPC ?
|
||||
@@ -3226,6 +3385,17 @@ namespace BrewMonster
|
||||
NeededExp = neededExp;
|
||||
}
|
||||
}
|
||||
enum MOVE_DIR
|
||||
|
||||
{
|
||||
MD_FORWARD = 0x01,
|
||||
MD_RIGHT = 0x02,
|
||||
MD_BACK = 0x04,
|
||||
MD_LEFT = 0x08,
|
||||
MD_ABSUP = 0x10,
|
||||
MD_ABSDOWN = 0x20,
|
||||
MD_ALL = 0x3f,
|
||||
};
|
||||
public struct NPCINFO
|
||||
{
|
||||
public string Name; // Movement properties
|
||||
|
||||
@@ -115,6 +115,16 @@ public partial class CECPlayer
|
||||
// We use this to setup the bones for the equipment skinned mesh renderers
|
||||
private SkeletonBuilder _skeletonBuilder;
|
||||
private PlayerDefaultEquipments _playerDefaultEquipments;
|
||||
|
||||
// Track instantiated armor objects for each slot
|
||||
private GameObject _currentUpperArmor;
|
||||
private GameObject _currentLowerArmor;
|
||||
private GameObject _currentWristArmor;
|
||||
private GameObject _currentFootArmor;
|
||||
|
||||
// Track instantiated weapon objects
|
||||
private GameObject _currentRightHandWeapon;
|
||||
private GameObject _currentLeftHandWeapon;
|
||||
private PlayerDefaultEquipments PlayerDefaultEquipments
|
||||
{
|
||||
get
|
||||
@@ -211,6 +221,21 @@ public partial class CECPlayer
|
||||
string fileModelRight = AFile.NormalizePath(weaponData.FileModelRight, true).ToLower();
|
||||
string fileModelLeft = AFile.NormalizePath(weaponData.FileModelLeft, true).ToLower();
|
||||
// BMLogger.Log($"ShowEquipments():: Weapon Essence: {fileModelRight} -- {fileModelLeft}");
|
||||
|
||||
// Destroy existing right hand weapon before creating new one
|
||||
if (_currentRightHandWeapon != null)
|
||||
{
|
||||
Destroy(_currentRightHandWeapon);
|
||||
_currentRightHandWeapon = null;
|
||||
}
|
||||
|
||||
// Destroy existing left hand weapon before creating new one
|
||||
if (_currentLeftHandWeapon != null)
|
||||
{
|
||||
Destroy(_currentLeftHandWeapon);
|
||||
_currentLeftHandWeapon = null;
|
||||
}
|
||||
|
||||
GameObject weaponPrefab = null;
|
||||
if (!string.IsNullOrEmpty(fileModelRight))
|
||||
{
|
||||
@@ -223,6 +248,7 @@ public partial class CECPlayer
|
||||
weaponObject.transform.localRotation = weaponPrefab.transform.localRotation;
|
||||
weaponObject.transform.localScale = Vector3.one;
|
||||
weaponObject.SetActive(true);
|
||||
_currentRightHandWeapon = weaponObject;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -237,6 +263,7 @@ public partial class CECPlayer
|
||||
weaponObject.transform.localRotation = weaponPrefab.transform.localRotation;
|
||||
weaponObject.transform.localScale = Vector3.one;
|
||||
weaponObject.SetActive(true);
|
||||
_currentLeftHandWeapon = weaponObject;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -253,6 +280,39 @@ public partial class CECPlayer
|
||||
var armorPrefab = await AddressableManager.Instance.LoadPrefabAsync(armorSkinPath);
|
||||
if (armorPrefab != null)
|
||||
{
|
||||
// Destroy existing armor for this slot before creating new one
|
||||
switch (nLocation)
|
||||
{
|
||||
case (uint)SkinIndex.SKIN_UPPER_BODY_INDEX:
|
||||
if (_currentUpperArmor != null)
|
||||
{
|
||||
Destroy(_currentUpperArmor);
|
||||
_currentUpperArmor = null;
|
||||
}
|
||||
break;
|
||||
case (uint)SkinIndex.SKIN_LOWER_INDEX:
|
||||
if (_currentLowerArmor != null)
|
||||
{
|
||||
Destroy(_currentLowerArmor);
|
||||
_currentLowerArmor = null;
|
||||
}
|
||||
break;
|
||||
case (uint)SkinIndex.SKIN_WRIST_INDEX:
|
||||
if (_currentWristArmor != null)
|
||||
{
|
||||
Destroy(_currentWristArmor);
|
||||
_currentWristArmor = null;
|
||||
}
|
||||
break;
|
||||
case (uint)SkinIndex.SKIN_FOOT_INDEX:
|
||||
if (_currentFootArmor != null)
|
||||
{
|
||||
Destroy(_currentFootArmor);
|
||||
_currentFootArmor = null;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
var armorObject = Instantiate(armorPrefab);
|
||||
armorObject.transform.SetParent(GetSkeletonBuilder()?.transform);
|
||||
armorObject.transform.localPosition = Vector3.zero;
|
||||
@@ -270,19 +330,23 @@ public partial class CECPlayer
|
||||
}
|
||||
}
|
||||
|
||||
// disable/enable the default equipment
|
||||
// Store the armor object for this slot
|
||||
switch (nLocation)
|
||||
{
|
||||
case (uint)SkinIndex.SKIN_UPPER_BODY_INDEX:
|
||||
_currentUpperArmor = armorObject;
|
||||
useDefaultUpper = false;
|
||||
break;
|
||||
case (uint)SkinIndex.SKIN_LOWER_INDEX:
|
||||
_currentLowerArmor = armorObject;
|
||||
useDefaultLower = false;
|
||||
break;
|
||||
case (uint)SkinIndex.SKIN_WRIST_INDEX:
|
||||
_currentWristArmor = armorObject;
|
||||
useDefaultWrist = false;
|
||||
break;
|
||||
case (uint)SkinIndex.SKIN_FOOT_INDEX:
|
||||
_currentFootArmor = armorObject;
|
||||
useDefaultFoot = false;
|
||||
break;
|
||||
}
|
||||
@@ -319,6 +383,19 @@ public partial class CECPlayer
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case InventoryConst.EQUIPIVTR_WEAPON:
|
||||
// Destroy weapons when weapon slot is empty
|
||||
if (_currentRightHandWeapon != null)
|
||||
{
|
||||
Destroy(_currentRightHandWeapon);
|
||||
_currentRightHandWeapon = null;
|
||||
}
|
||||
if (_currentLeftHandWeapon != null)
|
||||
{
|
||||
Destroy(_currentLeftHandWeapon);
|
||||
_currentLeftHandWeapon = null;
|
||||
}
|
||||
break;
|
||||
case InventoryConst.EQUIPIVTR_BODY:
|
||||
useDefaultUpper = true;
|
||||
break;
|
||||
@@ -336,9 +413,45 @@ public partial class CECPlayer
|
||||
}
|
||||
|
||||
// enable/disable the default equipment
|
||||
// If using default, destroy non-default equipment if it exists
|
||||
if (useDefaultUpper)
|
||||
{
|
||||
if (_currentUpperArmor != null)
|
||||
{
|
||||
Destroy(_currentUpperArmor);
|
||||
_currentUpperArmor = null;
|
||||
}
|
||||
}
|
||||
PlayerDefaultEquipments.DefaultUpper.SetActive(useDefaultUpper);
|
||||
|
||||
if (useDefaultLower)
|
||||
{
|
||||
if (_currentLowerArmor != null)
|
||||
{
|
||||
Destroy(_currentLowerArmor);
|
||||
_currentLowerArmor = null;
|
||||
}
|
||||
}
|
||||
PlayerDefaultEquipments.DefaultLower.SetActive(useDefaultLower);
|
||||
|
||||
if (useDefaultWrist)
|
||||
{
|
||||
if (_currentWristArmor != null)
|
||||
{
|
||||
Destroy(_currentWristArmor);
|
||||
_currentWristArmor = null;
|
||||
}
|
||||
}
|
||||
PlayerDefaultEquipments.DefaultWirst.SetActive(useDefaultWrist);
|
||||
|
||||
if (useDefaultFoot)
|
||||
{
|
||||
if (_currentFootArmor != null)
|
||||
{
|
||||
Destroy(_currentFootArmor);
|
||||
_currentFootArmor = null;
|
||||
}
|
||||
}
|
||||
PlayerDefaultEquipments.DefaultFoot.SetActive(useDefaultFoot);
|
||||
}
|
||||
|
||||
@@ -376,4 +489,4 @@ public partial class CECPlayer
|
||||
{
|
||||
return string.Format(_equipment_skin[nProfession * NUM_GENDER + nGender], szSkinName, szSkinName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace BrewMonster.Scripts.Player
|
||||
}
|
||||
public void UpdateState()
|
||||
{
|
||||
_state.Update();
|
||||
// _state.Update();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+9
-583
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user