Exemplo n.º 1
0
        public void Start_RequestLocomotion()
        {
            var spawning = new SpawningActionState(new ActionStateInfo(_inputBinder.gameObject), new SpawningActionStateParams());

            spawning.Start();

            Assert.AreEqual(EActionStateMachineTrack.Locomotion, _actionStateMachine.RequestedTrack);
            Assert.AreEqual(EActionStateId.Locomotion, _actionStateMachine.RequestedId);
            Assert.AreSame(_inputBinder.gameObject, _actionStateMachine.RequestedInfo.Owner);
        }
Exemplo n.º 2
0
        public void Start_SetsCameraPositionBasedOnParams()
        {
            var spawningParams = new SpawningActionStateParams {
                InitialCameraLocation = new Vector3(10.0f, 11.0f, 30.0f), InitialCameraRotation = new Vector3(1.0f, 0.5f, 2.0f), InitialOrthographicSize = 3.0f
            };
            var spawning = new SpawningActionState(new ActionStateInfo(_inputBinder.gameObject), spawningParams);

            spawning.Start();

            ExtendedAssertions.AssertVectorsNearlyEqual(spawningParams.InitialCameraLocation, _playerCamera.SetLocation.Value);
            ExtendedAssertions.AssertVectorsNearlyEqual(spawningParams.InitialCameraRotation, _playerCamera.SetRotation.Value);

            Assert.AreEqual(spawningParams.InitialOrthographicSize, _playerCamera.SetOrthographicSize);
        }
Exemplo n.º 3
0
        public void Start_EnterSpawningActionStateMessageSent()
        {
            var spawning = new SpawningActionState(new ActionStateInfo(_inputBinder.gameObject), new SpawningActionStateParams());

            var messageSpy = new UnityTestMessageHandleResponseObject <EnterSpawningActionStateMessage>();

            var handle =
                UnityMessageEventFunctions.RegisterActionWithDispatcher <EnterSpawningActionStateMessage>(
                    _inputBinder.gameObject, messageSpy.OnResponse);

            spawning.Start();

            Assert.IsTrue(messageSpy.ActionCalled);

            UnityMessageEventFunctions.UnregisterActionWithDispatcher(_inputBinder.gameObject, handle);
        }