change type time
This commit is contained in:
Binary file not shown.
@@ -13,14 +13,16 @@ namespace PerfectWorld.Scripts.Managers
|
||||
{
|
||||
namespace BrewMonster.Managers
|
||||
{
|
||||
[Serializable]
|
||||
public class EC_ManPlayer : IMsgHandler
|
||||
{
|
||||
public int HandlerId => (int)MANAGER_INDEX.MAN_PLAYER;
|
||||
public bool ProcessMessage(ECMSG Msg)
|
||||
{
|
||||
Debug.LogWarning("ProcessMessage");
|
||||
Debug.LogWarning("HoangDev : EC_ManPlayerProcessMessage");
|
||||
if (Msg.iSubID == 0)
|
||||
{
|
||||
Debug.LogWarning("HoangDev : EC_ManPlayerEC_ManPlayerEC_ManPlayer");
|
||||
GameController.Instance.GetHostPlayer().ProcessMessage(Msg);
|
||||
}
|
||||
else if (Msg.iSubID < 0)
|
||||
|
||||
@@ -5,9 +5,10 @@ using PerfectWorld.Scripts.Managers.BrewMonster.Managers;
|
||||
|
||||
namespace BrewMonster
|
||||
{
|
||||
[Serializable]
|
||||
public class EC_ManMessageMono : MonoBehaviour
|
||||
{
|
||||
EC_ManPlayer EC_ManPlayer;
|
||||
public EC_ManPlayer EC_ManPlayer;
|
||||
private void Awake()
|
||||
{
|
||||
//TODO: Remove later
|
||||
|
||||
@@ -85,7 +85,7 @@ public class CECHostPlayer : MonoBehaviour
|
||||
|
||||
private void Update()
|
||||
{
|
||||
m_MoveCtrl.Tick((ulong)Time.deltaTime);
|
||||
m_MoveCtrl.Tick(Time.deltaTime);
|
||||
// Nếu có thay đổi runtime, có thể lấy lại mỗi vài giây/Start nếu bạn thích:
|
||||
// ccRadius = controller.radius; ccSkin = controller.skinWidth;
|
||||
|
||||
@@ -124,7 +124,7 @@ public class CECHostPlayer : MonoBehaviour
|
||||
{
|
||||
transform.forward = move;
|
||||
Debug.LogWarning("HoangDev :HandleMovement");
|
||||
|
||||
m_MoveCtrl.GroundMove(Time.deltaTime);
|
||||
m_MoveCtrl.SendMoveCmd(transform.position, controller.velocity, (int)MoveMode.GP_MOVE_WALK);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
public class CECCounter
|
||||
{
|
||||
// Thuộc tính
|
||||
protected ulong m_dwCounter; // Counter
|
||||
protected ulong m_dwPeriod; // Count period
|
||||
protected float m_dwCounter; // Counter
|
||||
protected float m_dwPeriod; // Count period
|
||||
|
||||
// Constructor
|
||||
public CECCounter()
|
||||
@@ -14,12 +14,12 @@ public class CECCounter
|
||||
}
|
||||
|
||||
// Set / Get period
|
||||
public void SetPeriod(ulong dwPeriod) { m_dwPeriod = dwPeriod; }
|
||||
public ulong GetPeriod() { return m_dwPeriod; }
|
||||
public void SetPeriod(float dwPeriod) { m_dwPeriod = dwPeriod; }
|
||||
public float GetPeriod() { return m_dwPeriod; }
|
||||
|
||||
// Set / Get counter
|
||||
public void SetCounter(ulong dwCounter) { m_dwCounter = dwCounter; }
|
||||
public ulong GetCounter() { return m_dwCounter; }
|
||||
public void SetCounter(float dwCounter) { m_dwCounter = dwCounter; }
|
||||
public float GetCounter() { return m_dwCounter; }
|
||||
|
||||
// Has counter reached period ?
|
||||
public bool IsFull()
|
||||
@@ -35,14 +35,14 @@ public class CECCounter
|
||||
}
|
||||
|
||||
// Increase counter
|
||||
public bool IncCounter(ulong dwCounter)
|
||||
public bool IncCounter(float dwCounter)
|
||||
{
|
||||
m_dwCounter += dwCounter;
|
||||
return (m_dwCounter >= m_dwPeriod);
|
||||
}
|
||||
|
||||
// Decrease counter
|
||||
public void DecCounter(ulong dwCounter)
|
||||
public void DecCounter(float dwCounter)
|
||||
{
|
||||
if (m_dwCounter <= dwCounter)
|
||||
m_dwCounter = 0;
|
||||
|
||||
@@ -16,7 +16,7 @@ public class CECHostMove
|
||||
CECHostPlayer m_pHost;
|
||||
CECCounter m_CmdTimeCnt;
|
||||
bool m_bStop;
|
||||
const int MOVECMD_INTERVAL = 500;
|
||||
const float MOVECMD_INTERVAL = .5f;
|
||||
Vector3 m_vLastSevPos;
|
||||
|
||||
public CECHostMove(CECHostPlayer pHost)
|
||||
@@ -28,7 +28,7 @@ public class CECHostMove
|
||||
m_CmdTimeCnt = new CECCounter();
|
||||
m_CmdTimeCnt.SetPeriod(MOVECMD_INTERVAL);
|
||||
}
|
||||
public void Tick(ulong dwDeltaTime)
|
||||
public void Tick(float dwDeltaTime)
|
||||
{
|
||||
m_CmdTimeCnt.IncCounter(dwDeltaTime);
|
||||
}
|
||||
@@ -37,7 +37,6 @@ public class CECHostMove
|
||||
Vector3 vMoveDir = vVel;
|
||||
float fSpeed = vMoveDir.magnitude;
|
||||
SendMoveCmd(vCurPos, fSpeed, iMoveMode, bForceSend);
|
||||
Debug.LogWarning("HoangDev :SendMoveCmd 111");
|
||||
}
|
||||
void SendMoveCmd(in Vector3 vCurPos,
|
||||
float fSpeed, int iMoveMode, bool bForceSend)
|
||||
@@ -45,14 +44,12 @@ public class CECHostMove
|
||||
if (m_bStop)
|
||||
{
|
||||
// m_CmdTimeCnt.Reset();
|
||||
m_CmdTimeCnt.SetCounter((ulong)(m_fMoveTime * 1000));
|
||||
m_CmdTimeCnt.SetCounter((m_fMoveTime * 1000));
|
||||
m_bStop = false;
|
||||
}
|
||||
Debug.LogWarning("HoangDev :SendMoveCmd 2222");
|
||||
|
||||
if (!bForceSend && !m_CmdTimeCnt.IsFull())
|
||||
return;
|
||||
Debug.LogWarning("HoangDev :SendMoveCmd 3333");
|
||||
|
||||
int iTime = (int)(m_fMoveTime * 1000);
|
||||
|
||||
@@ -61,11 +58,10 @@ public class CECHostMove
|
||||
if (iTime == 0 || !bForceSend)
|
||||
{
|
||||
// if time is too little, wait again
|
||||
m_CmdTimeCnt.SetCounter((ulong)iTime);
|
||||
m_CmdTimeCnt.SetCounter(iTime);
|
||||
return;
|
||||
}
|
||||
}
|
||||
Debug.LogWarning("HoangDev :SendMoveCmd 4444");
|
||||
|
||||
m_CmdTimeCnt.Reset();
|
||||
|
||||
@@ -83,9 +79,10 @@ public class CECHostMove
|
||||
gamedatasend gamedatasend = new gamedatasend();
|
||||
|
||||
//TODO: tim cach convert vector 3 unity sang System.Numerics.Vector3
|
||||
Debug.LogWarning("vCurPos " + vCurPos);
|
||||
gamedatasend.Data = C2SCommandFactory.CreatePlayerMove(ToSysVec3(vCurPos), ToSysVec3(vDest), (ushort)iTime, (short)fSpeed, (byte)iMoveMode, wStamp);
|
||||
UnityGameSession.SendProtocol(gamedatasend);
|
||||
Debug.Log("HoangDev : SendProtocolSendProtocolSendProtocol");
|
||||
Debug.LogWarning("HoangDev : SendProtocolSendProtocolSendProtocol");
|
||||
}
|
||||
public void GroundMove(float ftime)
|
||||
{
|
||||
|
||||
+9
-36
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user