Пример #1
0
 // Use this for initialization
 void Start()
 {
     movementModule = GetComponent<MovementModule>();
     trackingModule = GetComponent<TrackingModule>();
     loadoutModule = GetComponent<AircraftLoadout>();
     fireControlModule = GetComponent<AircraftFireControl>();
 }
Пример #2
0
        public TrackingModuleFixture()
        {
            _xpTracking = new Mock <IXpTracking>();
            var module = new TrackingModule(_xpTracking.Object);

            _browser = BrowserBuilder.CreateNullBrowserForLogicTests(module);
        }
Пример #3
0
        public void Move(Orientation testOrientation, int expectedXPosition, int expectedYPosition)
        {
            const int testX        = 2;
            const int testY        = 2;
            var       testPosition = new Position(testX, testY, testOrientation);

            const int testGridSizeX      = 3;
            const int testGridSizeY      = 3;
            var       testTrackingModule = new TrackingModule
            {
                GridMaximumX = testGridSizeX,
                GridMaximumY = testGridSizeY,
                Position     = testPosition
            };

            var spyCommand  = new SpyCommand();
            var moveCommand = new MoveForwardCommand(spyCommand);

            moveCommand.Execute(testTrackingModule);

            var actualTrackingModule = spyCommand.TrackingModule;

            actualTrackingModule.Position.Y.Should().Be(expectedYPosition);
            actualTrackingModule.Position.X.Should().Be(expectedXPosition);
        }
Пример #4
0
        public void Execute(TrackingModule trackingModule)
        {
            var newPositionX = trackingModule.Position.X - 1;

            if (newPositionX >= trackingModule.GridMinimumX)
            {
                trackingModule.Position.X = newPositionX;
            }
        }
Пример #5
0
        public void Execute(TrackingModule trackingModule)
        {
            var newPositionY = trackingModule.Position.Y - 1;

            if (newPositionY >= trackingModule.GridMinimumY)
            {
                trackingModule.Position.Y = newPositionY;
            }
        }
Пример #6
0
        public void NotDecrementXAxisOfPositionWhenAtMinimumXAxis()
        {
            var testTrackingModule = new TrackingModule()
            {
                GridMaximumX = 2,
                GridMaximumY = 2,
                Position     = new Position(1, 2, Orientation.W)
            };

            var testMoveWestCommand = new MoveWestCommand();

            testMoveWestCommand.Execute(testTrackingModule);

            var position = testTrackingModule.Position;

            position.Y.Should().Be(2);
            position.X.Should().Be(1);
            position.Orientation.Should().Be(Orientation.W);
        }
Пример #7
0
        public void NotIncrementYAxisPositionWhenAtMaximumYAxis()
        {
            var testTrackingModule = new TrackingModule()
            {
                GridMaximumX = 2,
                GridMaximumY = 2,
                Position     = new Position(1, 2, Orientation.N)
            };

            var testMoveNorthCommand = new MoveNorthCommand();

            testMoveNorthCommand.Execute(testTrackingModule);

            var position = testTrackingModule.Position;

            position.Y.Should().Be(2);
            position.X.Should().Be(1);
            position.Orientation.Should().Be(Orientation.N);
        }
Пример #8
0
        public void IncrementXAxisOfPosition()
        {
            var testTrackingModule = new TrackingModule()
            {
                GridMaximumX = 2,
                GridMaximumY = 2,
                Position = new Position(1, 1, Orientation.E)
            };

            var testMoveEastCommand = new MoveEastCommand();

            testMoveEastCommand.Execute(testTrackingModule);

            var position = testTrackingModule.Position;

            position.Y.Should().Be(1);
            position.X.Should().Be(2);
            position.Orientation.Should().Be(Orientation.E);
        }
Пример #9
0
        public void DecrementYAxisOfPosition()
        {
            var testTrackingModule = new TrackingModule()
            {
                GridMaximumX = 2,
                GridMaximumY = 2,
                Position     = new Position(2, 2, Orientation.S)
            };

            var testMoveSouthCommand = new MoveSouthCommand();

            testMoveSouthCommand.Execute(testTrackingModule);

            var position = testTrackingModule.Position;

            position.Y.Should().Be(1);
            position.X.Should().Be(2);
            position.Orientation.Should().Be(Orientation.S);
        }
        public TopicSubscriberSelfDestroyingTopicWrapper(BusManager busManager,
                                                         SubscriberSettings <TMessage> subscriberSettings,
                                                         ITopicNameGetter topicNameGetter,
                                                         IMessageSerializer <TMessage> messageSerializer,
                                                         ILogger logger,
                                                         TrackingModule trackingModule)
        {
            _topicName = topicNameGetter.Get <TMessage>(subscriberSettings);

            _busSubscriber = new TopicSubscriberV2 <TMessage>(
                busManager,
                subscriberSettings,
                topicNameGetter,
                messageSerializer,
                logger,
                trackingModule);

            UsedTopics.Add(_topicName);
        }
Пример #11
0
        public void RotateToNextOrientationOnLCommand(Orientation testOrientation, Orientation expectedOrientation)
        {
            const int dummyX             = 1;
            const int dummyY             = 1;
            var       testPosition       = new Position(dummyX, dummyY, testOrientation);
            const int testGridSizeX      = 3;
            const int testGridSizeY      = 3;
            var       testTrackingModule = new TrackingModule
            {
                GridMaximumX = testGridSizeX,
                GridMaximumY = testGridSizeY,
                Position     = testPosition
            };

            var spyCommand    = new SpyCommand();
            var rotateCommand = new RotateRightCommand(spyCommand);

            rotateCommand.Execute(testTrackingModule);

            var actualTrackingModule = spyCommand.TrackingModule;

            actualTrackingModule.Position.Orientation.Should().Be(expectedOrientation);
        }
Пример #12
0
        private static void MoveForward(TrackingModule trackingModule)
        {
            var command = MoveForwardCommandFactory.Create(trackingModule.Position.Orientation);

            command.Execute(trackingModule);
        }
Пример #13
0
 public void Execute(TrackingModule trackingModule)
 {
     TrackingModule = trackingModule;
 }
Пример #14
0
 public void Execute(TrackingModule trackingModule)
 {
     _command?.Execute(trackingModule);
 }
Пример #15
0
    // Use this for initialization
    void Start()
    {
        ArmSamSite();

        trackingModule = GetComponent<TrackingModule>();
    }
Пример #16
0
 // Use this for initialization
 void Start()
 {
     movementModule = GetComponent<MovementModule>();
     trackingModule = GetComponent<TrackingModule>();
 }
Пример #17
0
        public void Execute(TrackingModule trackingModule)
        {
            MoveForward(trackingModule);

            _nextCommandInChain?.Execute(trackingModule);
        }