示例#1
0
 public void Update()
 {
     if (this.first_time)
     {
         this.first_time = false;
     }
     checked
     {
         if (unchecked (Time.get_time() - this.allPinsTime) >= this.allPinsTimer)
         {
             if (!this.Awake)
             {
                 this.basePinwheelSpeed = 0.2f;
             }
             this.allPinsTimer = Random.Range(this.allPinsTimerMin, this.allPinsTimerMax);
             for (int i = 0; i < Extensions.get_length(this.pinwheels); i++)
             {
                 float[] expr_68 = this.pinwheelRunTimer;
                 expr_68[RuntimeServices.NormalizeArrayIndex(expr_68, i)] = Random.Range(unchecked (this.allPinsTimer - (float)3), this.allPinsTimer);
             }
             this.allPinsTime = Time.get_time();
         }
         for (int i = 0; i < Extensions.get_length(this.pinwheels); i++)
         {
             this.PinwheelControl(i);
         }
     }
 }
    public void Start()
    {
        float num = 0f;

        this.actionRateFloat = new float[Extensions.get_length(this.IdleActions)];
        this.lastTimeRun     = new float[Extensions.get_length(this.IdleActions)];
        if (IdleLogic.firstTime)
        {
            IdleLogic.actionIndex = 0;
            checked
            {
                for (int i = 0; i < Extensions.get_length(this.IdleActions); i++)
                {
                    float[]    expr_53  = this.actionRateFloat;
                    int        arg_96_1 = RuntimeServices.NormalizeArrayIndex(expr_53, i);
                    Animation  arg_73_0 = this.get_animation();
                    AnimInfo[] expr_66  = this.IdleActions;
                    float      arg_95_0 = arg_73_0.get_Item(expr_66[RuntimeServices.NormalizeArrayIndex(expr_66, i)].anim).get_clip().get_length();
                    AnimInfo[] expr_88  = this.IdleActions;
                    unchecked
                    {
                        expr_53[arg_96_1] = arg_95_0 * expr_88[RuntimeServices.NormalizeArrayIndex(expr_88, i)].max_dur;
                        float[] expr_9D = this.lastTimeRun;
                        expr_9D[RuntimeServices.NormalizeArrayIndex(expr_9D, i)] = 100f * (float)-1;
                    }
                }
                IdleLogic.firstTime = false;
                this.lastTimeRun[0] = Time.get_time();
                this.num_iter       = (int)Random.Range((float)1, this.IdleActions[0].max_dur);
            }
            this.run_length = (float)this.num_iter * this.get_animation().get_Item(this.IdleActions[0].anim).get_clip().get_length();
            this.get_animation().Play(this.IdleActions[0].anim);
        }
    }
示例#3
0
    public void Start()
    {
        this.Awake            = true;
        this.first_time       = true;
        this.pin_timers       = new float[8];
        this.current_rotation = new float[8];
        this.spin_start_time  = new float[8];
        this.spinning_up      = new bool[8];
        this.pinwheelRunTimer = new float[8];
        this.allPinsTimer     = Random.Range(this.allPinsTimerMin, this.allPinsTimerMax);
        this.allPinsTime      = Time.get_time();
        this.allPinsSpeed     = (float)1;
        int i = 0;

        checked
        {
            for (i = 0; i < 8; i++)
            {
                float[] expr_89 = this.pin_timers;
                expr_89[RuntimeServices.NormalizeArrayIndex(expr_89, i)] = (float)0;
                float[] expr_99 = this.current_rotation;
                expr_99[RuntimeServices.NormalizeArrayIndex(expr_99, i)] = (float)0;
                float[] expr_A9 = this.spin_start_time;
                expr_A9[RuntimeServices.NormalizeArrayIndex(expr_A9, i)] = Time.get_time();
                bool[] expr_BC = this.spinning_up;
                expr_BC[RuntimeServices.NormalizeArrayIndex(expr_BC, i)] = true;
                float[] expr_D4 = this.pinwheelRunTimer;
                expr_D4[RuntimeServices.NormalizeArrayIndex(expr_D4, i)] = (float)10;
            }
        }
    }
示例#4
0
    public void InitState(object i_state)
    {
        this.numStates      = Extensions.get_length(this.stateDur);
        this.indexAction    = RuntimeServices.UnboxInt32(i_state);
        this.stateStartTime = checked ((int)Time.get_time());
        StateDuration[] expr_30  = this.stateDur;
        float           arg_5A_0 = expr_30[RuntimeServices.NormalizeArrayIndex(expr_30, this.indexAction)].min_dur;

        StateDuration[] expr_48 = this.stateDur;
        this.stateTimeOut = Random.Range(arg_5A_0, expr_48[RuntimeServices.NormalizeArrayIndex(expr_48, this.indexAction)].max_dur);
    }
示例#5
0
 public void NextExplosion()
 {
     checked
     {
         if (this._currentExpIdx >= this.detonatorPrefabs.Length - 1)
         {
             this._currentExpIdx = 0;
         }
         else
         {
             this._currentExpIdx++;
         }
         GameObject[] expr_3E = this.detonatorPrefabs;
         this.currentDetonator = expr_3E[RuntimeServices.NormalizeArrayIndex(expr_3E, this._currentExpIdx)];
     }
 }
示例#6
0
        public override void LeaveMethodInvocationExpression(MethodInvocationExpression node)
        {
            var externalMethod = node.Target.Entity as ExternalMethod;

            if (externalMethod != null)
            {
                ParameterInfo[] parameters = externalMethod.MethodInfo.GetParameters();
                int             i          = 0;
                int             length     = parameters.Length;
                if (length < 0)
                {
                    throw new ArgumentOutOfRangeException("max");
                }
                while (i < length)
                {
                    int num = i;
                    i++;
                    ParameterInfo[] expr_55 = parameters;
                    if (expr_55[RuntimeServices.NormalizeArrayIndex(expr_55, num)].ParameterType.IsByRef)
                    {
                        ParameterInfo[] expr_72 = parameters;
                        if (expr_72[RuntimeServices.NormalizeArrayIndex(expr_72, num)].IsOut)
                        {
                            NodeCollection <Expression> arg_AC_0 = node.Arguments;
                            int arg_AC_1 = num;
                            OutputExpression outputExpression = new OutputExpression();
                            Expression       expression       = outputExpression.Expression = node.Arguments[num];
                            arg_AC_0[arg_AC_1] = outputExpression;
                        }
                        else
                        {
                            NodeCollection <Expression> arg_E1_0 = node.Arguments;
                            int             arg_E1_1             = num;
                            ByRefExpression byRefExpression      = new ByRefExpression();
                            Expression      expression2          = byRefExpression.Expression = node.Arguments[num];
                            arg_E1_0[arg_E1_1] = byRefExpression;
                        }
                    }
                }
            }
        }
示例#7
0
        private bool HandleConstructorInvocation(MethodInvocationExpression node)
        {
            int result;

            if (node.Target.Entity.EntityType != EntityType.Constructor)
            {
                result = 0;
            }
            else
            {
                this._currentStatement.Expression = new CodeObjectCreateExpression(BooCodeDomConverter.GetType(node.Target.ToCodeString()), node.Arguments.Select(this.VisitExpr).ToArray());
                IParameter[] parameters = ((IEntityWithParameters)node.Target.Entity).GetParameters();
                int          num        = 0;
                int          length     = parameters.Length;
                if (length < 0)
                {
                    throw new ArgumentOutOfRangeException("max");
                }
                while (num < length)
                {
                    int index = num;
                    num++;
                    IParameter[] array = parameters;
                    if (string.Compare(array[RuntimeServices.NormalizeArrayIndex(array, index)].Type.Name, "single", true) == 0)
                    {
                        CodeExpression codeExpression = ((CodeObjectCreateExpression)this._currentStatement.Expression).Parameters[index];
                        if (codeExpression is CodePrimitiveExpression)
                        {
                            ((CodeObjectCreateExpression)this._currentStatement.Expression).Parameters[index] = new CodeCastExpression(BooCodeDomConverter.GetType("single"), codeExpression);
                        }
                    }
                }
                result = 1;
            }
            return((byte)result != 0);
        }
示例#8
0
    public void PinwheelControl(object which)
    {
        float arg_18_0 = Time.get_time();

        float[] expr_0B  = this.spin_start_time;
        float   arg_2C_0 = arg_18_0 - expr_0B[RuntimeServices.NormalizeArrayIndex(expr_0B, RuntimeServices.UnboxInt32(which))];

        float[] expr_1F = this.pinwheelRunTimer;
        if (arg_2C_0 > expr_1F[RuntimeServices.NormalizeArrayIndex(expr_1F, RuntimeServices.UnboxInt32(which))])
        {
            bool[] expr_39 = this.spinning_up;
            if (expr_39[RuntimeServices.NormalizeArrayIndex(expr_39, RuntimeServices.UnboxInt32(which))])
            {
                bool[] expr_5A = this.spinning_up;
                expr_5A[RuntimeServices.NormalizeArrayIndex(expr_5A, RuntimeServices.UnboxInt32(which))] = false;
            }
            else
            {
                bool[] expr_7C = this.spinning_up;
                if (!expr_7C[RuntimeServices.NormalizeArrayIndex(expr_7C, RuntimeServices.UnboxInt32(which))])
                {
                    bool[] expr_9D = this.spinning_up;
                    expr_9D[RuntimeServices.NormalizeArrayIndex(expr_9D, RuntimeServices.UnboxInt32(which))] = true;
                }
            }
            float[] expr_BA = this.spin_start_time;
            expr_BA[RuntimeServices.NormalizeArrayIndex(expr_BA, RuntimeServices.UnboxInt32(which))] = Time.get_time();
        }
        PinwheelInfo[] expr_D4  = this.pinwheels;
        Transform      pinwheel = expr_D4[RuntimeServices.NormalizeArrayIndex(expr_D4, RuntimeServices.UnboxInt32(which))].pinwheel;

        if (pinwheel)
        {
            Vector3 vector   = default(Vector3);
            float[] expr_100 = this.current_rotation;
            vector = new Vector3(expr_100[RuntimeServices.NormalizeArrayIndex(expr_100, RuntimeServices.UnboxInt32(which))] * Time.get_deltaTime(), (float)0, (float)0);
            pinwheel.Rotate(vector);
            bool[] expr_12A = this.spinning_up;
            if (expr_12A[RuntimeServices.NormalizeArrayIndex(expr_12A, RuntimeServices.UnboxInt32(which))])
            {
                float[]        expr_14B  = this.current_rotation;
                float          arg_185_0 = expr_14B[RuntimeServices.NormalizeArrayIndex(expr_14B, RuntimeServices.UnboxInt32(which))];
                float          arg_17D_0 = this.basePinwheelSpeed * this.allPinsSpeed;
                PinwheelInfo[] expr_16B  = this.pinwheels;
                if (arg_185_0 < arg_17D_0 * expr_16B[RuntimeServices.NormalizeArrayIndex(expr_16B, RuntimeServices.UnboxInt32(which))].rotationSpeed * (float)360)
                {
                    float[]        expr_192  = this.current_rotation;
                    int            arg_1CA_1 = RuntimeServices.NormalizeArrayIndex(expr_192, RuntimeServices.UnboxInt32(which));
                    float[]        expr_1A4  = this.current_rotation;
                    float          arg_1C9_0 = expr_1A4[RuntimeServices.NormalizeArrayIndex(expr_1A4, RuntimeServices.UnboxInt32(which))];
                    PinwheelInfo[] expr_1B7  = this.pinwheels;
                    expr_192[arg_1CA_1] = arg_1C9_0 + expr_1B7[RuntimeServices.NormalizeArrayIndex(expr_1B7, RuntimeServices.UnboxInt32(which))].easeInTime;
                }
            }
            else
            {
                float[] expr_1D6 = this.current_rotation;
                if (expr_1D6[RuntimeServices.NormalizeArrayIndex(expr_1D6, RuntimeServices.UnboxInt32(which))] > (float)0)
                {
                    float[]        expr_1F2  = this.current_rotation;
                    int            arg_22A_1 = RuntimeServices.NormalizeArrayIndex(expr_1F2, RuntimeServices.UnboxInt32(which));
                    float[]        expr_204  = this.current_rotation;
                    float          arg_229_0 = expr_204[RuntimeServices.NormalizeArrayIndex(expr_204, RuntimeServices.UnboxInt32(which))];
                    PinwheelInfo[] expr_217  = this.pinwheels;
                    expr_1F2[arg_22A_1] = arg_229_0 - expr_217[RuntimeServices.NormalizeArrayIndex(expr_217, RuntimeServices.UnboxInt32(which))].easeOutTime;
                }
                else
                {
                    float[] expr_236 = this.current_rotation;
                    expr_236[RuntimeServices.NormalizeArrayIndex(expr_236, RuntimeServices.UnboxInt32(which))] = (float)0;
                }
            }
        }
    }
示例#9
0
 private void VisitMethod(Method node, CodeMemberMethod result)
 {
     result.Name = node.Name;
     this.VisitParameters(node.Parameters, result.Parameters);
     if (node.ReturnType != null)
     {
         result.ReturnType = BooCodeDomConverter.GetType(node.ReturnType.ToCodeString());
     }
     this.OnTypeMember(node, result);
     if (node.Name == "InitializeComponent")
     {
         CodeStatementCollection currentBlock = this._currentBlock;
         this._currentBlock = result.Statements;
         this.Visit(node.Body);
         if (node.ImplementationFlags != 0)
         {
             throw new AssertionFailedException("node.ImplementationFlags == MethodImplementationFlags.None");
         }
         if (node.ExplicitInfo != null)
         {
             throw new AssertionFailedException("node.ExplicitInfo is null");
         }
         this._currentBlock = currentBlock;
     }
     else
     {
         string[] array = node.Body.ToCodeString().Split(new string[3]
         {
             "\r\n",
             "\r",
             "\n"
         }, StringSplitOptions.None);
         int  num   = 1;
         Node node2 = node;
         while (node2.ParentNode != null && RuntimeServices.op_Member(node2.ParentNode.NodeType, new NodeType[2]
         {
             NodeType.ClassDefinition,
             NodeType.StructDefinition
         }))
         {
             num   = checked (num + 1);
             node2 = node2.ParentNode;
         }
         int num2   = 0;
         int length = array.Length;
         if (length < 0)
         {
             throw new ArgumentOutOfRangeException("max");
         }
         while (num2 < length)
         {
             int index = num2;
             num2++;
             string[] array2 = array;
             int      num3   = RuntimeServices.NormalizeArrayIndex(array2, index);
             string   lhs    = new string('\t', num);
             string[] array3 = array;
             array2[num3] = lhs + array3[RuntimeServices.NormalizeArrayIndex(array3, index)];
         }
         string value = string.Join("\r\n", array);
         result.Statements.Add(new CodeSnippetStatement(value));
     }
     this._currentType.Members.Add(result);
 }
示例#10
0
    public void IdleAnimation()
    {
        float    num      = 0f;
        PetState petState = (PetState)this.GetComponent(typeof(PetState));
        bool     flag     = false;
        int      num2     = 0;
        int      num3     = IdleLogic.actionIndex;
        float    num4     = (float)-1;
        int      num5     = 0;

        if (Extensions.get_length(this.actionRateFloat) != 0)
        {
            float   arg_67_0 = Time.get_time();
            float[] expr_5B  = this.lastTimeRun;
            if (arg_67_0 - expr_5B[RuntimeServices.NormalizeArrayIndex(expr_5B, IdleLogic.actionIndex)] >= this.run_length - 0.15f)
            {
                int[] array  = new int[Extensions.get_length(this.IdleActions)];
                Array array2 = new Array(Extensions.get_length(this.IdleActions));
                checked
                {
                    for (int i = 0; i < Extensions.get_length(this.IdleActions); i++)
                    {
                        int[] expr_AC = array;
                        expr_AC[RuntimeServices.NormalizeArrayIndex(expr_AC, i)] = 0;
                        array2.set_Item(i, i);
                    }
                    float   arg_F8_0 = Time.get_time();
                    float[] expr_EC  = this.lastTimeRun;
                    float   num6     = unchecked (arg_F8_0 - expr_EC[RuntimeServices.NormalizeArrayIndex(expr_EC, IdleLogic.actionIndex)]);
                    while (!flag && num2 < array2.get_length())
                    {
                        int num7;
                        if (num2 < Extensions.get_length(this.IdleActions) - 1)
                        {
                            num7 = Random.Range(0, array2.get_length());
                        }
                        else
                        {
                            num7 = 0;
                        }
                        num5 = RuntimeServices.UnboxInt32(array2.get_Item(num7));
                        int[] expr_13E = array;
                        int[] expr_324;
                        unchecked
                        {
                            if (expr_13E[RuntimeServices.NormalizeArrayIndex(expr_13E, num5)] == 0)
                            {
                                float      arg_160_0 = Time.get_time();
                                float[]    expr_157  = this.lastTimeRun;
                                float      arg_175_0 = arg_160_0 - expr_157[RuntimeServices.NormalizeArrayIndex(expr_157, num5)];
                                AnimInfo[] expr_167  = this.IdleActions;
                                if (arg_175_0 > expr_167[RuntimeServices.NormalizeArrayIndex(expr_167, num5)].delta)
                                {
                                    float      num8      = 0f;
                                    bool       flag2     = true;
                                    Animation  arg_1A1_0 = this.get_animation();
                                    AnimInfo[] expr_193  = this.IdleActions;
                                    if (arg_1A1_0.get_Item(expr_193[RuntimeServices.NormalizeArrayIndex(expr_193, num5)].anim).get_wrapMode() == 2)
                                    {
                                        AnimInfo[] expr_1BE  = this.IdleActions;
                                        float      arg_1E0_0 = expr_1BE[RuntimeServices.NormalizeArrayIndex(expr_1BE, num5)].min_dur;
                                        AnimInfo[] expr_1D2  = this.IdleActions;
                                        this.num_iter = checked ((int)Random.Range(arg_1E0_0, expr_1D2[RuntimeServices.NormalizeArrayIndex(expr_1D2, num5)].max_dur));
                                    }
                                    else
                                    {
                                        this.num_iter = 1;
                                    }
                                    float      arg_228_0 = (float)this.num_iter;
                                    Animation  arg_219_0 = this.get_animation();
                                    AnimInfo[] expr_20B  = this.IdleActions;
                                    this.run_length = arg_228_0 * arg_219_0.get_Item(expr_20B[RuntimeServices.NormalizeArrayIndex(expr_20B, num5)].anim).get_clip().get_length();
                                    if (petState.useTimer)
                                    {
                                        flag2 = false;
                                        num8  = (float)petState.stateStartTime + petState.stateTimeOut - Time.get_time();
                                        while (!flag2 && num8 > (float)0 && this.run_length > (float)0)
                                        {
                                            if (this.run_length <= num8)
                                            {
                                                flag2 = true;
                                            }
                                            else
                                            {
                                                float      arg_29A_0;
                                                AnimInfo[] expr_28C;
                                                checked
                                                {
                                                    this.num_iter--;
                                                    arg_29A_0 = (float)this.num_iter;
                                                    expr_28C  = this.IdleActions;
                                                }
                                                if (arg_29A_0 > expr_28C[RuntimeServices.NormalizeArrayIndex(expr_28C, num5)].min_dur)
                                                {
                                                    float      arg_2D2_0 = (float)this.num_iter;
                                                    Animation  arg_2C3_0 = this.get_animation();
                                                    AnimInfo[] expr_2B5  = this.IdleActions;
                                                    this.run_length = arg_2D2_0 * arg_2C3_0.get_Item(expr_2B5[RuntimeServices.NormalizeArrayIndex(expr_2B5, num5)].anim).get_clip().get_length();
                                                }
                                                else
                                                {
                                                    this.run_length = (float)0;
                                                }
                                            }
                                        }
                                    }
                                    if (flag2 && this.num_iter >= 1)
                                    {
                                        flag = true;
                                        num3 = num5;
                                    }
                                }
                            }
                            expr_324 = array;
                        }
                        if (expr_324[RuntimeServices.NormalizeArrayIndex(expr_324, num5)] == 0)
                        {
                            int[] expr_334 = array;
                            expr_334[RuntimeServices.NormalizeArrayIndex(expr_334, num5)] = 1;
                            array2.RemoveAt(num7);
                            num2++;
                        }
                    }
                    if (flag)
                    {
                        IdleLogic.actionIndex = num3;
                        Animation  arg_38D_0 = this.get_animation();
                        AnimInfo[] expr_377  = this.IdleActions;
                        arg_38D_0.CrossFade(expr_377[RuntimeServices.NormalizeArrayIndex(expr_377, IdleLogic.actionIndex)].anim, 0.15f);
                        float[] expr_398 = this.lastTimeRun;
                        expr_398[RuntimeServices.NormalizeArrayIndex(expr_398, IdleLogic.actionIndex)] = Time.get_time();
                    }
                    else
                    {
                        petState.stateTimeOut = (float)-1;
                    }
                }
            }
        }
    }