protected void ApplyMotion(SplineSample SplineSample, MotionModule module) { module.SplineSample = SplineSample; #if UNITY_EDITOR if (!Application.isPlaying) { if (targetTransform == null) { RefreshTargets(); } if (targetTransform == null) { return; } module.ApplyTransform(targetTransform); return; } #endif switch (physicsMode) { case PhysicsMode.Transform: if (targetTransform == null) { RefreshTargets(); } if (targetTransform == null) { return; } module.ApplyTransform(targetTransform); break; case PhysicsMode.Rigidbody: if (targetRigidbody == null) { RefreshTargets(); if (targetRigidbody == null) { throw new MissingComponentException("There is no Rigidbody attached to " + name + " but the Physics mode is set to use one."); } } module.ApplyRigidbody(targetRigidbody); break; case PhysicsMode.Rigidbody2D: if (targetRigidbody2D == null) { RefreshTargets(); if (targetRigidbody2D == null) { throw new MissingComponentException("There is no Rigidbody2D attached to " + name + " but the Physics mode is set to use one."); } } module.ApplyRigidbody2D(targetRigidbody2D); break; } }
internal void CopyFrom(MotionModule input) { enabled = input.enabled; offset = input.offset; useSplineSizes = input.useSplineSizes; rotationOffset = input.rotationOffset; baseScale = input.baseScale; SplineSample = input.SplineSample; applyPositionX = input.applyPositionX; applyPositionY = input.applyPositionY; applyPositionZ = input.applyPositionZ; applyRotationX = input.applyRotationX; applyRotationY = input.applyRotationY; applyRotationZ = input.applyRotationZ; applyScaleX = input.applyScaleX; applyScaleY = input.applyScaleY; applyScaleZ = input.applyScaleZ; }