示例#1
0
    protected override void InitializeNonSerializedData()
    {
        bool flag;
        bool flag1;
        int  num;

        this.x          = new BobPunchEffect.CurveInfo(this._x);
        this.y          = new BobPunchEffect.CurveInfo(this._y);
        this.z          = new BobPunchEffect.CurveInfo(this._z);
        this.yaw        = new BobPunchEffect.CurveInfo(this._yaw);
        this.pitch      = new BobPunchEffect.CurveInfo(this._pitch);
        this.roll       = new BobPunchEffect.CurveInfo(this._roll);
        flag            = (this.x.valid || this.y.valid || this.z.valid || this.yaw.valid || this.pitch.valid ? true : this.roll.valid);
        this.glob.valid = flag;
        if (!this.glob.valid)
        {
            flag1 = false;
        }
        else
        {
            if ((!this.x.valid || this.x.constant) && (!this.y.valid || this.y.constant) && (!this.z.valid || this.z.constant) && (!this.yaw.valid || this.yaw.constant) && (!this.pitch.valid || this.pitch.constant))
            {
                num = (!this.roll.valid ? 0 : (int)(!this.roll.constant));
            }
            else
            {
                num = 1;
            }
            flag1 = num == 0;
        }
        this.glob.constant = flag1;
        if (!this.glob.constant)
        {
            this.glob.startTime = Single.PositiveInfinity;
            this.glob.endTime   = Single.NegativeInfinity;
            if (this.x.valid && !this.x.constant)
            {
                if (this.x.startTime < this.glob.startTime)
                {
                    this.glob.startTime = this.x.startTime;
                }
                if (this.x.endTime > this.glob.endTime)
                {
                    this.glob.endTime = this.x.endTime;
                }
            }
            if (this.z.valid && !this.z.constant)
            {
                if (this.z.startTime < this.glob.startTime)
                {
                    this.glob.startTime = this.z.startTime;
                }
                if (this.z.endTime > this.glob.endTime)
                {
                    this.glob.endTime = this.z.endTime;
                }
            }
            if (this.yaw.valid && !this.yaw.constant)
            {
                if (this.yaw.startTime < this.glob.startTime)
                {
                    this.glob.startTime = this.yaw.startTime;
                }
                if (this.yaw.endTime > this.glob.endTime)
                {
                    this.glob.endTime = this.yaw.endTime;
                }
            }
            if (this.pitch.valid && !this.pitch.constant)
            {
                if (this.pitch.startTime < this.glob.startTime)
                {
                    this.glob.startTime = this.pitch.startTime;
                }
                if (this.pitch.endTime > this.glob.endTime)
                {
                    this.glob.endTime = this.pitch.endTime;
                }
            }
            if (this.roll.valid && !this.roll.constant)
            {
                if (this.roll.startTime < this.glob.startTime)
                {
                    this.glob.startTime = this.roll.startTime;
                }
                if (this.roll.endTime > this.glob.endTime)
                {
                    this.glob.endTime = this.roll.endTime;
                }
            }
            if (this.roll.valid && !this.roll.constant)
            {
                if (this.roll.startTime < this.glob.startTime)
                {
                    this.glob.startTime = this.roll.startTime;
                }
                if (this.roll.endTime > this.glob.endTime)
                {
                    this.glob.endTime = this.roll.endTime;
                }
            }
            if (this.glob.startTime != Single.PositiveInfinity)
            {
                this.glob.duration = this.glob.endTime - this.glob.startTime;
            }
            else
            {
                this.glob.startTime = 0f;
                this.glob.endTime   = 0f;
                this.glob.duration  = 0f;
                this.glob.valid     = false;
            }
        }
        else
        {
            this.glob.valid     = false;
            this.glob.startTime = 0f;
            this.glob.endTime   = 0f;
            this.glob.duration  = 0f;
        }
    }
示例#2
0
        public CurveInfo(AnimationCurve curve)
        {
            if (curve == null)
            {
                this = new BobPunchEffect.CurveInfo();
            }
            else
            {
                this.curve = curve;
            }
            this.length = curve.length;
            switch (this.length)
            {
            case 0:
                this.endTime    = 0f;
                this.startTime  = 0f;
                this.duration   = 0f;
                this.min        = 0f;
                this.max        = 0f;
                this.range      = 0f;
                this.startValue = 0f;
                this.endValue   = 0f;
                this.valid      = false;
                this.constant   = false;
                return;

            case 1:
            {
                Keyframe keyframe = curve[0];
                this.startTime = keyframe.time;
                this.endTime   = this.startTime;
                this.duration  = 0f;
                Keyframe keyframe2 = curve[0];
                this.min        = keyframe2.value;
                this.max        = this.min;
                this.startValue = this.min;
                this.endValue   = this.min;
                this.range      = 0f;
                this.valid      = true;
                this.constant   = true;
                return;
            }

            case 2:
            {
                Keyframe keyframe3 = curve[0];
                this.startTime = keyframe3.time;
                Keyframe keyframe4 = curve[1];
                this.endTime  = keyframe4.time;
                this.duration = this.endTime - this.startTime;
                Keyframe keyframe5 = curve[0];
                this.startValue = keyframe5.value;
                Keyframe keyframe6 = curve[1];
                this.endValue = keyframe6.value;
                if (this.endValue >= this.startValue)
                {
                    this.range = this.endValue - this.startValue;
                    this.min   = this.startValue;
                    this.max   = this.endValue;
                    break;
                }
                this.range = this.startValue - this.endValue;
                this.min   = this.endValue;
                this.max   = this.startValue;
                break;
            }

            default:
            {
                Keyframe keyframe7 = curve[0];
                this.startTime = keyframe7.time;
                Keyframe keyframe8 = curve[this.length - 1];
                this.endTime  = keyframe8.time;
                this.duration = this.endTime - this.startTime;
                Keyframe keyframe9 = curve[0];
                this.min      = this.startValue = keyframe9.value;
                this.max      = this.min;
                this.endValue = this.startValue;
                for (int i = 1; i < this.length; i++)
                {
                    Keyframe keyframe10 = curve[i];
                    this.endValue = keyframe10.value;
                    if (this.endValue > this.max)
                    {
                        this.max = this.endValue;
                    }
                    if (this.endValue < this.min)
                    {
                        this.min = this.endValue;
                    }
                }
                this.range    = this.max - this.min;
                this.valid    = true;
                this.constant = this.range == 0f;
                return;
            }
            }
            this.valid    = true;
            this.constant = this.range == 0f;
        }
示例#3
0
        public CurveInfo(AnimationCurve curve)
        {
            if (curve != null)
            {
                this.curve = curve;
            }
            else
            {
                this = new BobPunchEffect.CurveInfo();
            }
            this.length = curve.length;
            switch (this.length)
            {
            case 0:
            {
                this.endTime    = 0f;
                this.startTime  = 0f;
                this.duration   = 0f;
                this.min        = 0f;
                this.max        = 0f;
                this.range      = 0f;
                this.startValue = 0f;
                this.endValue   = 0f;
                this.valid      = false;
                this.constant   = false;
                break;
            }

            case 1:
            {
                this.startTime  = curve[0].time;
                this.endTime    = this.startTime;
                this.duration   = 0f;
                this.min        = curve[0].@value;
                this.max        = this.min;
                this.startValue = this.min;
                this.endValue   = this.min;
                this.range      = 0f;
                this.valid      = true;
                this.constant   = true;
                break;
            }

            case 2:
            {
                this.startTime  = curve[0].time;
                this.endTime    = curve[1].time;
                this.duration   = this.endTime - this.startTime;
                this.startValue = curve[0].@value;
                this.endValue   = curve[1].@value;
                if (this.endValue >= this.startValue)
                {
                    this.range = this.endValue - this.startValue;
                    this.min   = this.startValue;
                    this.max   = this.endValue;
                }
                else
                {
                    this.range = this.startValue - this.endValue;
                    this.min   = this.endValue;
                    this.max   = this.startValue;
                }
                this.valid    = true;
                this.constant = this.range == 0f;
                break;
            }

            default:
            {
                this.startTime = curve[0].time;
                Keyframe item = curve[this.length - 1];
                this.endTime  = item.time;
                this.duration = this.endTime - this.startTime;
                float single  = curve[0].@value;
                float single1 = single;
                this.startValue = single;
                this.min        = single1;
                this.max        = this.min;
                this.endValue   = this.startValue;
                for (int i = 1; i < this.length; i++)
                {
                    this.endValue = curve[i].@value;
                    if (this.endValue > this.max)
                    {
                        this.max = this.endValue;
                    }
                    if (this.endValue < this.min)
                    {
                        this.min = this.endValue;
                    }
                }
                this.range    = this.max - this.min;
                this.valid    = true;
                this.constant = this.range == 0f;
                break;
            }
            }
        }