From 502a68eaffba0eafc20e55422e6fd54de2d517d3 Mon Sep 17 00:00:00 2001 From: Pascal Serrarens Date: Wed, 15 Jan 2025 14:13:51 +0100 Subject: [PATCH] Added initial Accelerometer --- CustomMsg.cs | 47 ----------------------------------------------- CustomMsg.cs.meta | 2 -- Thing.cs | 7 +++++++ 3 files changed, 7 insertions(+), 49 deletions(-) delete mode 100644 CustomMsg.cs delete mode 100644 CustomMsg.cs.meta diff --git a/CustomMsg.cs b/CustomMsg.cs deleted file mode 100644 index 48691ec..0000000 --- a/CustomMsg.cs +++ /dev/null @@ -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 Receive(Stream dataStream, Participant client, byte packetSize) { - // byte[] buffer = await Receive(dataStream, packetSize); - - // CustomMsg msg = new(buffer); - // client.messageQueue.Enqueue(msg); - // return true; - //} - } - -} -*/ \ No newline at end of file diff --git a/CustomMsg.cs.meta b/CustomMsg.cs.meta deleted file mode 100644 index cbddfe9..0000000 --- a/CustomMsg.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: b9dcd611539afab429456b08500ae152 \ No newline at end of file diff --git a/Thing.cs b/Thing.cs index a5dd1b3..09cb486 100644 --- a/Thing.cs +++ b/Thing.cs @@ -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);