Added initial Accelerometer

This commit is contained in:
Pascal Serrarens 2025-01-15 14:13:51 +01:00
parent 958cbbd2ed
commit 502a68eaff
3 changed files with 7 additions and 49 deletions

View File

@ -1,47 +0,0 @@
/*
namespace Passer.Control.Core {
public class CustomMsg : IMessage {
public const byte Id = 0xB1;
public byte networkId;
public byte thingId;
public byte[] bytes;
public CustomMsg(byte[] buffer) {
byte ix = 1;
this.networkId = buffer[ix++];
this.thingId = buffer[ix++];
byte length = (byte)(buffer.Length - ix);
this.bytes = new byte[length];
for (uint bytesIx = 0; bytesIx < length; bytesIx++)
this.bytes[bytesIx] = buffer[ix++];
}
public CustomMsg(byte networkId, byte thingId, byte[] bytes) : base() {
this.networkId = networkId;
this.thingId = thingId;
this.bytes = bytes;
}
public override byte Serialize(ref byte[] buffer) {
byte ix = 0;
buffer[ix++] = CustomMsg.Id;
buffer[ix++] = this.networkId;
buffer[ix++] = this.thingId;
//buffer[ix++] = (byte)bytes.Length;
foreach (byte b in bytes)
buffer[ix++] = b;
return ix;
}
//public static async Task<bool> Receive(Stream dataStream, Participant client, byte packetSize) {
// byte[] buffer = await Receive(dataStream, packetSize);
// CustomMsg msg = new(buffer);
// client.messageQueue.Enqueue(msg);
// return true;
//}
}
}
*/

View File

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: b9dcd611539afab429456b08500ae152

View File

@ -151,10 +151,17 @@ namespace Passer.Control.Core {
#region Update
#if UNITY_5_3_OR_NEWER
public void Update() {
Update(UnityEngine.Time.time * 1000);
}
#endif
public virtual void Update(float currentTime) {
// should recurse over children...
}
public virtual void SendBytes(byte[] bytes) { }
public virtual void ProcessBytes(byte[] bytes) {
//if (sensor != null)
// sensor.ProcessBytes(bytes);