/// <inheritdoc /> protected override void ProcessComponent(Component source, Component target) { GameObject sourceGameObject = (modificationType == ModificationType.ModifyTargetUsingSource ? source.TryGetGameObject() : target.TryGetGameObject()); GameObject targetGameObject = (modificationType == ModificationType.ModifyTargetUsingSource ? target.TryGetGameObject() : source.TryGetGameObject()); followModifier?.Modify(sourceGameObject, targetGameObject, followOffset); }
public void Modify() { UnityEventListenerMock premodifiedMock = new UnityEventListenerMock(); UnityEventListenerMock modifiedMock = new UnityEventListenerMock(); subject.Premodified.AddListener(premodifiedMock.Listen); subject.Modified.AddListener(modifiedMock.Listen); GameObject source = new GameObject(); GameObject target = new GameObject(); GameObject offset = new GameObject(); PropertyModifierMock positionMock = source.AddComponent <PropertyModifierMock>(); PropertyModifierMock rotationMock = source.AddComponent <PropertyModifierMock>(); PropertyModifierMock scaleMock = source.AddComponent <PropertyModifierMock>(); Assert.IsNull(subject.CachedSource); Assert.IsNull(subject.CachedTarget); Assert.IsNull(subject.CachedOffset); Assert.IsFalse(premodifiedMock.Received); Assert.IsFalse(modifiedMock.Received); Assert.IsFalse(positionMock.modified); Assert.IsFalse(rotationMock.modified); Assert.IsFalse(scaleMock.modified); subject.PositionModifier = positionMock; subject.RotationModifier = rotationMock; subject.ScaleModifier = scaleMock; subject.Modify(source, target, offset); Assert.AreEqual(source, subject.CachedSource); Assert.AreEqual(target, subject.CachedTarget); Assert.AreEqual(offset, subject.CachedOffset); Assert.IsTrue(premodifiedMock.Received); Assert.IsTrue(modifiedMock.Received); Assert.IsTrue(positionMock.modified); Assert.IsTrue(rotationMock.modified); Assert.IsTrue(scaleMock.modified); Object.DestroyImmediate(source); Object.DestroyImmediate(target); Object.DestroyImmediate(offset); }