Exemple #1
0
        //[TestMethod]
        public void TestDeserialization()
        {
            var actual = BaseSnapshotItem.FromArray <SnapshotCharacter>(new int[]
            {
                94128,
                111,
                222,
                333,
                444,
                555,
                666,
                777,
                888,
                1,
                999,
                1111,
                2222,
                3333,
                4444,
                5555,
                6666,
                7777,
                5,
                1,
                8888,
                10,
            });

            var expected = new SnapshotCharacter()
            {
                Tick = 94128,
                X    = 111,
                Y    = 222,
                VelX = 333,
                VelY = 444,

                Angle     = 555,
                Direction = 666,

                Jumped       = 777,
                HookedPlayer = 888,
                HookState    = HookState.RetractStart,
                HookTick     = 999,

                HookX           = 1111,
                HookY           = 2222,
                HookDx          = 3333,
                HookDy          = 4444,
                Health          = 5555,
                Armor           = 6666,
                AmmoCount       = 7777,
                Weapon          = Weapon.Ninja,
                Emote           = Emote.Pain,
                AttackTick      = 8888,
                TriggeredEvents = CoreEvents.HookAttachGround | CoreEvents.AirJump,
            };
        }
Exemple #2
0
        public override void OnClientDirectInput(int clientId, int[] input)
        {
            var playerInput = BaseSnapshotItem.FromArray <SnapshotPlayerInput>(input);

            if (playerInput.IsValid())
            {
                Players[clientId].OnDirectInput(playerInput);
            }
            else
            {
                Console.Print(OutputLevel.Debug, "server", "SnapshotPlayerInput not valid");
            }
        }
Exemple #3
0
 // TODO make cached serialize
 public SnapshotItem(int id, BaseSnapshotItem item)
 {
     Key  = Snapshot.Key(id, item.Type);
     Id   = id;
     Item = item;
 }