コード例 #1
0
        public void End_NewPawnRequestsLocomotion()
        {
            var characterObject = new GameObject();

            characterObject.AddComponent <MockActionStateMachineComponent>();
            characterObject.AddComponent <MockInputBinderComponent>();

            var characterComponent = characterObject.AddComponent <TestCharacterComponent>();

            characterComponent.TestStart();
            characterComponent.ActiveController = new GameObject().AddComponent <TestControllerComponent>();
            characterComponent.ActiveController.SetPawn(characterObject);

            var actionState = new TransformingActionState(new TransformingActionStateInfo(characterObject, _character.gameObject));

            actionState.Start();
            actionState.End();

            var actionStateMachine = characterComponent.ActiveController.PawnInstance
                                     .GetComponent <MockActionStateMachineComponent>();

            Assert.AreEqual(EActionStateMachineTrack.Locomotion, actionStateMachine.RequestedTrack);
            Assert.AreEqual(EActionStateId.Locomotion, actionStateMachine.RequestedId);
            Assert.AreSame(characterComponent.ActiveController.PawnInstance, actionStateMachine.RequestedInfo.Owner);
        }
コード例 #2
0
        public void Start_DropsHeldItem()
        {
            _character.ActiveController = new GameObject().AddComponent <TestControllerComponent>();

            var actionState = new TransformingActionState(new TransformingActionStateInfo(_character.gameObject, _character.gameObject));

            actionState.Start();

            Assert.IsTrue(_heldItem.DropHoldableCalled);
        }
コード例 #3
0
        public void Start_CreatesAndAddsNewPawnToController()
        {
            var characterObject = new GameObject();

            characterObject.AddComponent <MockActionStateMachineComponent>();
            characterObject.AddComponent <MockInputBinderComponent>();

            var characterComponent = characterObject.AddComponent <TestCharacterComponent>();

            characterComponent.TestStart();
            characterComponent.ActiveController = new GameObject().AddComponent <TestControllerComponent>();
            characterComponent.ActiveController.SetPawn(characterObject);

            var actionState = new TransformingActionState(new TransformingActionStateInfo(characterObject, _character.gameObject));

            actionState.Start();

            Assert.AreNotSame(characterObject, characterComponent.ActiveController.PawnInstance);
        }
コード例 #4
0
        public void Created_HasTransformingActionStateId()
        {
            var actionState = new TransformingActionState(new TransformingActionStateInfo());

            Assert.AreEqual(EActionStateId.Transforming, actionState.ActionStateId);
        }