Bot DeserializeBot(JToken token) { Bot bot = null; if (token.Count<object>() != 0) { bot = new Bot(); bot.Id = (int)token[0]; bot.Movement.Position.X = (float)token[1]; bot.Movement.Position.Y = (float)token[2]; bot.Movement.Velocity.X = (float)token[3]; bot.Movement.Velocity.Y = (float)token[4]; bot.Movement.Acceleration.X = (float)token[5]; bot.Movement.Acceleration.Y = (float)token[6]; } return bot; }
object[] Serialize(Bot bot) { object[] serializedBot = new object[7]; serializedBot[0] = bot.Id; serializedBot[1] = bot.Movement.Position.X; serializedBot[2] = bot.Movement.Position.Y; serializedBot[3] = bot.Movement.Velocity.X; serializedBot[4] = bot.Movement.Velocity.Y; serializedBot[5] = bot.Movement.Acceleration.X; serializedBot[6] = bot.Movement.Acceleration.Y; return serializedBot; }