Exemplo n.º 1
0
        protected SukiSchema()
        {
            name       = "";
            resolution = InputResolution.Trigger;
            data       = SukiData.Instance;

            CalculationFunction   = null;
            ReductionFunction     = null;
            ConditionFunction     = null;
            FloatBoundsFunction   = null;
            Vector2BoundsFunction = null;
            Vector3BoundsFunction = null;
        }
Exemplo n.º 2
0
        protected virtual void SetReductionFunction(Reduction reductionOperation, Vector3 reductionOperand = default(Vector3))
        {
            if (resolution != InputResolution.Trigger && resolution != InputResolution.Signal && resolution != InputResolution.Range)
            {
                throw new System.Exception("Only Trigger, Signal, and Range resolution schemas can have Reductions.");
            }
            Reduction op      = reductionOperation;
            Vector3   operand = reductionOperand;

            ReductionFunction = (Vector3 value) => {
                float ret = 0f;

                switch (op)
                {
                case Reduction.Magnitude:
                    ret = value.magnitude;
                    break;

                case Reduction.DotProduct:
                    ret = Vector3.Dot(value, operand);
                    break;

                case Reduction.XValue:
                    ret = value.x;
                    break;

                case Reduction.YValue:
                    ret = value.y;
                    break;

                case Reduction.ZValue:
                    ret = value.z;
                    break;

                default:
                    throw new System.Exception("Reduction not recognized");
                }

                return(ret);
            };
        }