13 changed files with 115 additions and 29 deletions
@ -0,0 +1,34 @@ |
|||
using CoreGame.Shared; |
|||
using Entitas; |
|||
using Sog; |
|||
|
|||
namespace CoreGame.Logic |
|||
{ |
|||
public class MovePosDesc : ICommandLogicDesc |
|||
{ |
|||
public void OnExecute(ref BaseCommand command, LogicContext context, in EntityHandle<LogicEntity> entityHandle) |
|||
{ |
|||
var moveDirectionCommand = (MovePosCmd)command; |
|||
if (entityHandle == false) |
|||
{ |
|||
LLog.LogInfo($"MoveDirectionDesc entityHandle is null {entityHandle}"); |
|||
return; |
|||
} |
|||
//TODO : GUO
|
|||
Fixed64Vector2 dt = new Fixed64Vector2(moveDirectionCommand.x, moveDirectionCommand.y); |
|||
dt *= Fixed64.EN4; |
|||
var logicTransform = entityHandle.value.logicTransform; |
|||
var pos = logicTransform.position + dt; |
|||
var size = context.WorldExtendSize; |
|||
size -= Fixed64Vector2.one * Fixed64._0_50; |
|||
|
|||
// if (pos.x < -size.x || pos.x > size.x || pos.y < -size.y || pos.y > size.y)
|
|||
// {
|
|||
//
|
|||
// }
|
|||
pos = FixedMath.Clamp(pos, -size, size); |
|||
logicTransform.SetPosition(pos); |
|||
// entityHandle.value.ReplaceMoveDirection(moveDirectionCommand.Degree, moveDirectionCommand.nSeq);
|
|||
} |
|||
} |
|||
} |
@ -0,0 +1,3 @@ |
|||
fileFormatVersion: 2 |
|||
guid: 07a3da7eb5184569aaf0561f8efb6f67 |
|||
timeCreated: 1753458825 |
@ -0,0 +1,36 @@ |
|||
using AOT; |
|||
using ProtoCSClass; |
|||
|
|||
namespace CoreGame.Shared |
|||
{ |
|||
[FrameCommandClass(FrameCmdDef.MovePoint)] |
|||
public class MovePosCmd : BaseCommand, ISptPool |
|||
{ |
|||
public int x; |
|||
public int y; |
|||
|
|||
public static BaseCommand Creator(ref CSPlayerOpInfo msg) |
|||
{ |
|||
MovePosCmd frameCmd = null; |
|||
SptPool<MovePosCmd>.Malloc(ref frameCmd); |
|||
frameCmd.x = msg.MovePoint.X; |
|||
frameCmd.y = msg.MovePoint.Y; |
|||
return frameCmd; |
|||
} |
|||
protected override void ToProtocol2(ref CSPlayerOpInfo msg) |
|||
{ |
|||
msg.MovePoint.X = x; |
|||
msg.MovePoint.Y = y; |
|||
} |
|||
|
|||
public void Reset() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public override string ToString() |
|||
{ |
|||
return $"{base.ToString()}: x:{x}, y:{y}"; |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,3 @@ |
|||
fileFormatVersion: 2 |
|||
guid: 2d30ec0409634a83a4c4f04d2accc710 |
|||
timeCreated: 1753458572 |
@ -1,3 +0,0 @@ |
|||
fileFormatVersion: 2 |
|||
guid: 640393e0062d48ef9b4114d1703419cb |
|||
timeCreated: 1729759069 |
Loading…
Reference in new issue