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); }
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); }
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); }
public void Created_HasTransformingActionStateId() { var actionState = new TransformingActionState(new TransformingActionStateInfo()); Assert.AreEqual(EActionStateId.Transforming, actionState.ActionStateId); }