Support Destroy
This commit is contained in:
parent
9b44918eaf
commit
ae6f9fa395
22
Messages.cs
22
Messages.cs
@ -16,7 +16,7 @@ namespace Passer.Control
|
||||
public virtual byte Serialize(ref byte[] buffer) { return 0; }
|
||||
public virtual void Deserialize(byte[] buffer) { }
|
||||
|
||||
public bool Send(Participant client) {
|
||||
public bool SendTo(Participant client) {
|
||||
Serialize(ref client.buffer);
|
||||
return client.SendBuffer();
|
||||
}
|
||||
@ -188,10 +188,10 @@ namespace Passer.Control
|
||||
this.thingId = buffer[ix++];
|
||||
}
|
||||
|
||||
public static bool Send(Participant client, CoreThing thing) {
|
||||
InvestigateMsg msg = new(thing.networkId, thing.id);
|
||||
return SendMsg(client, msg);
|
||||
}
|
||||
//public static bool Send(Participant client, CoreThing thing) {
|
||||
// InvestigateMsg msg = new(thing.networkId, thing.id);
|
||||
// return SendMsg(client, msg);
|
||||
//}
|
||||
public static async Task<bool> Receive(Stream dataStream, Participant client, byte packetSize)
|
||||
{
|
||||
if (packetSize != length)
|
||||
@ -423,9 +423,13 @@ namespace Passer.Control
|
||||
public byte poseType;
|
||||
public const byte Pose_Position = 0x01;
|
||||
public const byte Pose_Orientation = 0x02;
|
||||
public const byte Pose_LinearVelocity = 0x04;
|
||||
public const byte Pose_AngularVelocity = 0x08;
|
||||
|
||||
public Spherical position;
|
||||
public Quat32 orientation;
|
||||
public Spherical linearVelocity;
|
||||
public Spherical angularVelocity;
|
||||
|
||||
public PoseMsg(byte networkId, byte thingId, Spherical position, Quat32 orientation)
|
||||
{
|
||||
@ -466,8 +470,12 @@ namespace Passer.Control
|
||||
|
||||
//if ((poseType & Pose_Position) != 0)
|
||||
this.position = LowLevelMessages.ReceiveSpherical(buffer, ref ix);
|
||||
//if ((poseType & Pose_Orientation) != 0) {
|
||||
//if ((poseType & Pose_Orientation) != 0)
|
||||
this.orientation = LowLevelMessages.ReceiveQuat32(buffer, ref ix);
|
||||
if ((poseType & Pose_LinearVelocity) != 0) {
|
||||
this.linearVelocity = LowLevelMessages.ReceiveSpherical(buffer, ref ix);
|
||||
UnityEngine.Debug.Log($"Received linear velocity: {this.linearVelocity}");
|
||||
}
|
||||
}
|
||||
|
||||
public static bool Send(Participant client, byte thingId, Spherical position, Quat32 orientation)
|
||||
@ -576,7 +584,7 @@ namespace Passer.Control
|
||||
public class DestroyMsg : IMessage
|
||||
{
|
||||
public const byte Id = 0x20;
|
||||
public const byte length = 2;
|
||||
public const byte length = 3;
|
||||
public byte networkId;
|
||||
public byte thingId;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user