public void Transform() { UnityEventListenerMock transformedListenerMock = new UnityEventListenerMock(); subject.Transformed.AddListener(transformedListenerMock.Listen); Vector3ObservableList collection = containingObject.AddComponent <Vector3ObservableList>(); subject.Collection = collection; subject.Collection.Add(Vector3.zero); subject.Collection.Add(Vector3.zero); subject.Collection.SetAt(new Vector3(3f, 4f, 5f), 0); subject.Collection.CurrentIndex = 1; Assert.AreEqual(Vector3.zero, subject.Result); Assert.IsFalse(transformedListenerMock.Received); Vector3 input = new Vector3(2f, 3f, 4f); Vector3 result = subject.Transform(input); Vector3 expectedResult = new Vector3(6f, 12f, 20f); Assert.AreEqual(expectedResult, result); Assert.AreEqual(expectedResult, subject.Result); Assert.IsTrue(transformedListenerMock.Received); }
public void Transform() { UnityEventListenerMock transformedListenerMock = new UnityEventListenerMock(); subject.Transformed.AddListener(transformedListenerMock.Listen); subject.collection = new List <Vector3>(new Vector3[2]); subject.SetElement(0, new Vector3(3f, 4f, 5f)); subject.CurrentIndex = 1; Assert.AreEqual(Vector3.zero, subject.Result); Assert.IsFalse(transformedListenerMock.Received); Vector3 input = new Vector3(2f, 3f, 4f); Vector3 result = subject.Transform(input); Vector3 expectedResult = new Vector3(6f, 12f, 20f); Assert.AreEqual(expectedResult, result); Assert.AreEqual(expectedResult, subject.Result); Assert.IsTrue(transformedListenerMock.Received); }
public void Transform() { UnityEventListenerMock transformedListenerMock = new UnityEventListenerMock(); subject.Transformed.AddListener(transformedListenerMock.Listen); subject.SetXMultiplier(3f); subject.SetYMultiplier(4f); subject.SetZMultiplier(5f); Assert.AreEqual(Vector3.zero, subject.Result); Assert.IsFalse(transformedListenerMock.Received); Vector3 input = new Vector3(2f, 3f, 4f); Vector3 result = subject.Transform(input); Vector3 expectedResult = new Vector3(6f, 12f, 20f); Assert.AreEqual(expectedResult, result); Assert.AreEqual(expectedResult, subject.Result); Assert.IsTrue(transformedListenerMock.Received); }
/// <summary> /// Emits the Converted event for the last calculated <see cref="Vector3"/>. /// </summary> public virtual void Process() { if (!isActiveAndEnabled) { return; } Vector3 axisDirection = facade.sourceOfForwardDirection != null?ApplyForwardSourceToAxis(currentAxisData) : currentAxisData; CurrentMovement = inputMask.Transform(axisDirection) * (Time.inFixedTimeStep ? Time.fixedDeltaTime : Time.deltaTime); facade.Processed?.Invoke(CurrentMovement); }
/// <summary> /// Emits the Converted event for the last calculated <see cref="Vector3"/>. /// </summary> public virtual void Process() { if (!isActiveAndEnabled) { return; } Vector3 axisDirection = facade.sourceOfForwardDirection != null?ApplyForwardSourceToAxis(currentAxisData) : currentAxisData; float multiplier = (facade.AxisUsageType == AxesToVector3Facade.AxisUsage.Incremental ? (Time.inFixedTimeStep ? Time.fixedDeltaTime : Time.deltaTime) : 1f); CurrentMovement = inputMask.Transform(axisDirection) * multiplier; facade.Processed?.Invoke(CurrentMovement); }