Example #1
0
        public void FromBytes(byte[] bytes)
        {
            Items = new Dictionary <string, ServerDataItem>();

            using (var reader = new BinaryDataReader(bytes))
            {
                var count = reader.ReadInt();

                for (int i = 0; i < count; i++)
                {
                    var item = new ServerDataItem
                    {
                        Session     = reader.ReadString(),
                        LookAt      = reader.ReadVector(),
                        IsMoveRight = reader.ReadBoolean(),
                        IsMoveLeft  = reader.ReadBoolean(),
                        IsJump      = reader.ReadBoolean(),
                        Position    = reader.ReadVector()
                    };

                    Items[item.Session] = item;
                }
            }
        }
Example #2
0
 private void UpdateServerDataItem(ServerDataItem item)
 {
     observable.Publish(new SetSoldierPositionCommand(item.Session, item.Position));
     observable.Publish(new AnimationCommand(item.Session, GetAnimationType(item.IsMoveRight, item.IsMoveLeft)));
     observable.Publish(new LookCommand(item.Session, item.LookAt));
 }