Ejemplo n.º 1
0
        public override void Input(TransformValues newState)
        {
            if (history == null)
            {
                history = new TransformValues[GetHistoryLength()];
                // So there aren't null values in history, just replicate this first value to the entire thing:
                for (int i = 0; i < history.Length; i++)
                {
                    history[i] = newState;
                }
                index = 0;
            }

            if (history.Length == 0)
            {
                Output(newState);
            }

            // Because the array is a fixed size, the current cell is also the oldest cell.
            // So let's apply the change now:
            Output(history[index]);

            // Now overwrite this spot in history:
            history[index] = newState;

            // and increment the index.
            index++;
            if (index >= history.Length)
            {
                index = 0;
            }
        }
Ejemplo n.º 2
0
        protected virtual void Output(TransformValues newState)
        {
            if (target == null)
            {
                return;
            }

            newState.ApplyTo(target, useLocalSpace);
        }
        protected override void OnEnable()
        {
            base.OnEnable();

            // Configure the transform manipulator (if any)
            newTransformValue    = TransformValues.FromTransform(transform, false);
            transformManipulator = GetComponent <TransformManipulator_Abstract>();
            if (transformManipulator != null)
            {
                transformManipulator.SetTarget(transform);
            }

            ourRigidbody = GetComponentInParent <Rigidbody>();

            Application.onBeforeRender += OnBeforeRender;
        }
Ejemplo n.º 4
0
 public abstract void Input(TransformValues newState);
Ejemplo n.º 5
0
 public virtual void Input(Transform newState)
 {
     Input(TransformValues.FromTransform(newState, false));
 }