Exemple #1
0
        public override void LateTick()
        {
            ReckoningCore.Tick(null);
            ReckoningCore.Move();
            ReckoningCore.Quantize();

            Core.Move();
            Core.Quantize();
            Position = Core.Position;

            if (Player.Team == Team.Spectators)
            {
                Position = new Vector2(Input.TargetX, Input.TargetY);
            }

            {
                var predicted = new SnapshotCharacter();
                var current   = new SnapshotCharacter();

                ReckoningCore.Write(predicted);
                Core.Write(current);

                if (ReckoningTick + Server.TickSpeed * 3 < Server.Tick || !current.Equals(predicted))
                {
                    ReckoningTick = Server.Tick;
                    SendCore.Fill(Core);
                    ReckoningCore.Fill(Core);
                }
            }
        }
Exemple #2
0
        public override void TickDefered()
        {
            ReckoningCore.Tick(false);
            ReckoningCore.Move();
            ReckoningCore.Quantize();

            Core.Move();
            Core.Quantize();
            Position = Core.Position;

            var events = Core.TriggeredEvents;
            var mask   = GameContext.MaskAllExceptOne(Player.ClientId);

            if (events.HasFlag(CoreEvents.GROUND_JUMP))
            {
                GameContext.CreateSound(Position, Sound.PLAYER_JUMP, mask);
            }

            if (events.HasFlag(CoreEvents.HOOK_ATTACH_PLAYER))
            {
                GameContext.CreateSound(Position, Sound.HOOK_ATTACH_PLAYER, GameContext.MaskAll());
            }

            if (events.HasFlag(CoreEvents.HOOK_ATTACH_GROUND))
            {
                GameContext.CreateSound(Position, Sound.HOOK_ATTACH_GROUND, mask);
            }

            if (events.HasFlag(CoreEvents.HOOK_HIT_NOHOOK))
            {
                GameContext.CreateSound(Position, Sound.HOOK_NOATTACH, mask);
            }

            if (Player.Team == Team.SPECTATORS)
            {
                Position = new Vector2(Input.TargetX, Input.TargetY);
            }

            {
                var predicted = new SnapObj_Character();
                var current   = new SnapObj_Character();

                ReckoningCore.Write(predicted);
                Core.Write(current);

                if (ReckoningTick + Server.TickSpeed * 3 < Server.Tick || !predicted.Compare(current))
                {
                    ReckoningTick = Server.Tick;
                    Core.FillTo(SendCore);
                    Core.FillTo(ReckoningCore);
                }
            }
        }