예제 #1
0
        public void PlayerCantMoveToNegativeSpace()
        {
            _localPlayer.Value.Position = new Point(0, 0);

            var keyCode = 65;

            PlayerInput.ProcessPlayerKeyboardInput(keyCode, true);

            HeartBeat.PhysicsLoop();

            CharacterFactory.GetLocalPlayerCharacter().Destination.X.Should().Be(0);
        }
예제 #2
0
        public void PressingWMovesLocalPlayerUp()
        {
            _localPlayer.Value.Position = new Point(0, 10);

            var keyCode = 87;

            PlayerInput.ProcessPlayerKeyboardInput(keyCode, true);

            HeartBeat.PhysicsLoop();

            CharacterFactory.GetLocalPlayerCharacter().Destination.Y.Should().Be(11);
        }
예제 #3
0
        public void WillStopWhenReachingDestination()
        {
            _localPlayer.Value.Position = new Point(17, 17);

            _localPlayer.Value.Destination = new Point(17, 17);

            HeartBeat.PhysicsLoop();

            _localPlayer.Value.Position.X.Should().Be(17);

            _localPlayer.Value.Position.Y.Should().Be(17);
        }
예제 #4
0
        public void EntityWithDestinationMovesTowardIt()
        {
            _localPlayer.Value.Speed = 1;

            _localPlayer.Value.Position = new Point(0, 0);

            _localPlayer.Value.Destination = new Point(1, 0);

            HeartBeat.PhysicsLoop();

            _localPlayer.Value.Position.X.Should().Be(1);
        }
예제 #5
0
        public void EntityDoesNotMoveIfDestinationIsPosition()
        {
            _localPlayer.Value.Speed = 200;

            _localPlayer.Value.Position = new Point(13, 12);

            _localPlayer.Value.Destination = new Point(13, 12);

            HeartBeat.PhysicsLoop();

            _localPlayer.Value.Position.X.Should().Be(13);
            _localPlayer.Value.Position.Y.Should().Be(12);
        }
예제 #6
0
        public void EntityMovesToDestinationOnTwoDifferentAxes()
        {
            _localPlayer.Value.Speed = 4;

            _localPlayer.Value.Position = new Point(5, 4);

            _localPlayer.Value.Destination = new Point(7, 0);

            HeartBeat.PhysicsLoop();

            _localPlayer.Value.Position.X.Should().Be(6);
            _localPlayer.Value.Position.Y.Should().Be(1);
        }
예제 #7
0
        public void EntityMovesTowardDestinationBehind()
        {
            _localPlayer.Value.Speed = 3;

            _localPlayer.Value.Position = new Point(10, 3);

            _localPlayer.Value.Destination = new Point(1, 3);

            HeartBeat.PhysicsLoop();

            _localPlayer.Value.Position.X.Should().Be(7);
            _localPlayer.Value.Position.Y.Should().Be(3);
        }
예제 #8
0
        public void PlayerMovesFromZeroPosition()
        {
            _localPlayer.Value.Position = new Point(0, 0);

            var keyCode = 68;

            PlayerInput.ProcessPlayerKeyboardInput(keyCode, true);

            HeartBeat.PhysicsLoop();

            HeartBeat.PhysicsLoop();

            CharacterFactory.GetLocalPlayerCharacter().Destination.X.Should().Be(2);
        }
예제 #9
0
        public void KeepingAPressedContinuesMovingPlayerLeft()
        {
            _localPlayer.Value.Position = new Point(5, 0);

            var keyCode = 65;

            PlayerInput.ProcessPlayerKeyboardInput(keyCode, true);

            HeartBeat.PhysicsLoop();

            HeartBeat.PhysicsLoop();

            CharacterFactory.GetLocalPlayerCharacter().Destination.X.Should().Be(3);
        }
예제 #10
0
        public void ReleasingSStopsMovingDown()
        {
            _localPlayer.Value.Position = new Point(5, 10);

            var keyCode = 83;

            PlayerInput.ProcessPlayerKeyboardInput(keyCode, true);

            HeartBeat.PhysicsLoop();

            PlayerInput.ProcessPlayerKeyboardInput(keyCode, false);

            HeartBeat.PhysicsLoop();

            CharacterFactory.GetLocalPlayerCharacter().Destination.Y.Should().Be(9);
        }