Пример #1
0
        private void SetVector2BoundsFunction(Vector2 lowBounds, Vector2 highBounds, bool useExtents, bool shouldReverse)
        {
            if (resolution != InputResolution.Location2D)
            {
                throw new System.Exception("Only Location2D resolution schemas can have Vector2 Bounds.");
            }
            Vector2 low  = lowBounds;
            Vector2 high = highBounds;

            Awake();
            bool extents  = ((bool)enableExtents ? useExtents : false);// useExtents;
            bool reverese = shouldReverse;

            Vector2BoundsFunction = (Vector2 value) => {
                if (extents)
                {
                    UpdateExtents(value);
                    // if schema specifies that we should use extents, override the argument values
                    low  = useExtents ? min2DExtent : low;
                    high = useExtents ? max2DExtent : high;
                }
                // only reverse x for now (most expected behavior) - can extend the schemas later if needed
                float x = NormalizeRange(value.x, low.x, high.x, shouldReverse);
                float y = NormalizeRange(value.y, low.y, high.y);
                return(new Vector2(x, y));
            };
        }
Пример #2
0
        protected SukiSchema()
        {
            name       = "";
            resolution = InputResolution.Trigger;
            data       = SukiData.Instance;

            CalculationFunction   = null;
            ReductionFunction     = null;
            ConditionFunction     = null;
            FloatBoundsFunction   = null;
            Vector2BoundsFunction = null;
            Vector3BoundsFunction = null;
        }
Пример #3
0
        private void SetVector3BoundsFunction(Vector3 lowBounds, Vector3 highBounds)
        {
            if (resolution != InputResolution.Location3D)
            {
                throw new System.Exception("Only Location3D resolution schemas can have Vector3 Bounds.");
            }
            Vector3 low  = lowBounds;
            Vector3 high = highBounds;

            Vector3BoundsFunction = (Vector3 value) => {
                float x = NormalizeRange(value.x, low.x, high.x);
                float y = NormalizeRange(value.y, low.y, high.y);
                float z = NormalizeRange(value.z, low.z, high.z);
                return(new Vector3(x, y, z));
            };
        }
Пример #4
0
        private void SetFloatBoundsFunction(float lowBounds, float highBounds, bool useExtents, bool shouldReverse)
        {
            if (resolution != InputResolution.Range)
            {
                throw new System.Exception("Only Range resolution schemas can have Float Bounds.");
            }
            float low  = lowBounds;
            float high = highBounds;

            Awake();
            bool extents = ((bool)enableExtents ? useExtents : false);// useExtents;
            bool reverse = shouldReverse;

            FloatBoundsFunction = (float value) => {
                if (extents)
                {
                    UpdateExtents(value);
                    // if schema specifies that we should use extents, override the argument values
                    low  = useExtents ? minExtent : low;
                    high = useExtents ? maxExtent : high;
                }
                return(NormalizeRange(value, low, high, reverse));
            };
        }