Example #1
0
        public override AccessorOrMutator VisitPostfixUnaryExpression(PostfixUnaryExpressionSyntax node)
        {
            var operand = Visit(node.Operand);

            switch (node.Kind())
            {
            case SyntaxKind.PostIncrementExpression:
            case SyntaxKind.PostDecrementExpression:
            {
                var accessor = operand as Accessor;
                if (accessor != null)
                {
                    var methodSymbol = Model.GetSymbolInfo(node).Symbol as IMethodSymbol;
                    if (methodSymbol != null)
                    {
                        var value  = operand.GetMutator(this);
                        var result = Lifter.LiftInstanceNonVoidNullaryMethod(methodSymbol)(accessor.GetMutator(this));
                        accessor.AcceptAssignment(this, result.Item1);
                        return(value);        // Return the value before the assignment
                    }
                }
                break;
            }
            }
            throw new SyntaxErrorException("Unsupported syntax: " + node);
        }
Example #2
0
    void Start()
    {
        lifter = Player.transform.Find("Lifter").GetComponent <Lifter>();

        EventManager.Instance.Walk     += StartWalk;
        EventManager.Instance.Kicked   += KickPickups;
        EventManager.Instance.GameOver += GameOver;
    }
Example #3
0
        public Maxes(double deadlift, double bench, double squat, double overhead, double inclineBench, double straightDeadlift, double frontSquat, double closeGripBench, Lifter lifter)
        {
            Person = lifter;

            Deadlift         = deadlift;
            Bench            = bench;
            Squat            = squat;
            Overhead         = overhead;
            InclineBench     = inclineBench;
            StraightDeadlift = straightDeadlift;
            FrontSquat       = frontSquat;
            CloseGripBench   = closeGripBench;
        }
Example #4
0
    public override void Start()
    {
        base.Start();

        mDetector = UnityGestureIO.LoadDetector("data/ForceDetector.gd");
        mDetector.MinThreshold     = .83f;
        mDetector.GestureDetected += OnGestureDetected;
        SetReceiver(mDetector);

        mLifter = GetComponent <Lifter>();
        mLightningController = GetComponent <LightningController>();
        mGlimpse             = GetComponentInChildren <GlimpseController>();
        mGlimpse.gameObject.SetActive(false);
    }
Example #5
0
        public override AccessorOrMutator VisitPrefixUnaryExpression(PrefixUnaryExpressionSyntax node)
        {
            var operand = Visit(node.Operand);

            switch (node.Kind())
            {
            case SyntaxKind.PreIncrementExpression:
            case SyntaxKind.PreDecrementExpression:
            {
                var accessor = operand as Accessor;
                if (accessor != null)
                {
                    var methodSymbol = Model.GetSymbolInfo(node).Symbol as IMethodSymbol;
                    if (methodSymbol != null)
                    {
                        var result = Lifter.LiftInstanceNonVoidNullaryMethod(methodSymbol)(accessor.GetMutator(this));
                        accessor.AcceptAssignment(this, result.Item1);
                        return(result.Item2);
                    }
                }
                break;
            }

            case SyntaxKind.UnaryPlusExpression:
            case SyntaxKind.UnaryMinusExpression:
            case SyntaxKind.BitwiseNotExpression:
            case SyntaxKind.LogicalNotExpression:
            {
                var methodSymbol = Model.GetSymbolInfo(node).Symbol as IMethodSymbol;
                if (methodSymbol != null)
                {
                    return(Lifter.LiftStaticNonVoidUnaryMethod(methodSymbol)(operand.GetMutator(this)));
                }
                else if (node.Operand is LiteralExpressionSyntax)
                {
                    var literalExpr = operand.GetMutator(this).CreateUpdate();
                    if (literalExpr is BitVecExpr)
                    {
                        return(operand.GetMutator(this).WithValue(Ctx.MkBVNeg((BitVecExpr)literalExpr)));
                    }
                    throw new SyntaxErrorException("Unsupported literal syntax: " + node);
                }
                break;
            }
            }
            throw new SyntaxErrorException("Unsupported syntax: " + node);
        }
Example #6
0
        public override AccessorOrMutator VisitAssignmentExpression(AssignmentExpressionSyntax node)
        {
            // C# evaluates subexpressions from left to right and so do we
            var left  = Visit(node.Left);
            var right = Visit(node.Right);

            switch (node.Kind())
            {
            case SyntaxKind.SimpleAssignmentExpression:
            {
                var leftAccessor = left as Accessor;
                if (leftAccessor != null)
                {
                    return(leftAccessor.AcceptAssignment(this, right.GetMutator(this)));
                }
                break;
            }

            case SyntaxKind.AddAssignmentExpression:
            case SyntaxKind.SubtractAssignmentExpression:
            case SyntaxKind.MultiplyAssignmentExpression:
            case SyntaxKind.DivideAssignmentExpression:
            case SyntaxKind.ModuloAssignmentExpression:
            case SyntaxKind.AndAssignmentExpression:
            case SyntaxKind.OrAssignmentExpression:
            {
                var leftAccessor = left as Accessor;
                if (leftAccessor != null)
                {
                    var methodSymbol = Model.GetSymbolInfo(node).Symbol as IMethodSymbol;
                    if (methodSymbol != null)
                    {
                        // The method symbols seem to always be the same as in the non-assignment case
                        var result = Lifter.LiftStaticNonVoidBinaryMethod(methodSymbol)(left.GetMutator(this), right.GetMutator(this));
                        return(leftAccessor.AcceptAssignment(this, result));
                    }
                }
                break;
            }
            }
            throw new SyntaxErrorException("Unsupported syntax: " + node);
        }
Example #7
0
        public override AccessorOrMutator VisitBinaryExpression(BinaryExpressionSyntax node)
        {
            // C# evaluates subexpressions from left to right and so do we
            var left  = Visit(node.Left);
            var right = Visit(node.Right);

            switch (node.Kind())
            {
            case SyntaxKind.AddExpression:
            case SyntaxKind.SubtractExpression:
            case SyntaxKind.MultiplyExpression:
            case SyntaxKind.DivideExpression:
            case SyntaxKind.ModuloExpression:
            case SyntaxKind.BitwiseAndExpression:
            case SyntaxKind.BitwiseOrExpression:
            case SyntaxKind.ExclusiveOrExpression:
            case SyntaxKind.EqualsExpression:
            case SyntaxKind.NotEqualsExpression:
            case SyntaxKind.GreaterThanExpression:
            case SyntaxKind.LessThanExpression:
            case SyntaxKind.GreaterThanOrEqualExpression:
            case SyntaxKind.LessThanOrEqualExpression:
            case SyntaxKind.LeftShiftExpression:
            case SyntaxKind.RightShiftExpression:
            {
                var methodSymbol = Model.GetSymbolInfo(node).Symbol as IMethodSymbol;
                if (methodSymbol != null)
                {
                    return(Lifter.LiftStaticNonVoidBinaryMethod(methodSymbol)(left.GetMutator(this), right.GetMutator(this)));
                }
                break;
            }

            case SyntaxKind.LogicalAndExpression:
            case SyntaxKind.LogicalOrExpression:
                // TODO: Implement short cirquiting. This should probably be done as a transformation on
                // the CFG which makes sure that short cirquiting operations never end up here.
                throw new SymbolicExplorationException("Short circuiting logical operators are not supported");
            }
            throw new SyntaxErrorException("Unsupported syntax: " + node);
        }
Example #8
0
    void Awake()
    {
        //get the components
        animator       = GetComponent <Animator> ();
        boxCollider    = GetComponent <BoxCollider2D> ();
        durability     = GetComponent <Durability> ();
        lifter         = GetComponent <Lifter> ();
        rigidBody      = GetComponent <Rigidbody2D> ();
        spriteRenderer = GetComponent <SpriteRenderer> ();

        //get the sword
        swordDamager = transform.GetChild(0).gameObject;

        //set up the internals
        speed = 0.79f;
        durability.maxHealthPoints  = 12;
        durability.healthPoints     = 12;
        durability.invincibleWindow = 0.5f;

        //set callbacks
        Durability.callback onDmg = durability.onDamaged;
        durability.onDamaged = (int diff) => {
            if (onDmg != null)
            {
                onDmg(diff);
            }
            FlashColor(1, 0, 0, 0.1f);
        };

        Durability.callback onHld = durability.onHealed;
        durability.onHealed = (int diff) => {
            if (onHld != null)
            {
                onHld(diff);
            }
            FlashColor(0, 1, 0, 0.1f);
        };
    }
Example #9
0
        private void InitDataProcessors()
        {
            try
            {
                var featParams = Loader.Properties;
                SelectedDataProcessors = new List <IDataProcessor>();

                double lowFreq   = double.Parse(featParams["-lowerf"], CultureInfo.InvariantCulture.NumberFormat);
                double hiFreq    = double.Parse(featParams["-upperf"], CultureInfo.InvariantCulture.NumberFormat);
                int    numFilter = int.Parse(featParams["-nfilt"], CultureInfo.InvariantCulture.NumberFormat);

                // TODO: should not be there, but for now me must preserve
                // backward compatibility with the legacy code.
                if (Loader is KaldiLoader)
                {
                    FilterBank = new MelFrequencyFilterBank2(lowFreq, hiFreq, numFilter);
                }
                else
                {
                    FilterBank = new MelFrequencyFilterBank(lowFreq, hiFreq, numFilter);
                }

                SelectedDataProcessors.Add(FilterBank);

                if ((featParams.get("-remove_noise") == null) || (featParams.get("-remove_noise").Equals("yes")))
                {
                    Denoise = new Denoise(
                        typeof(Denoise).GetField <S4Double>("LambdaPower").DefaultValue,
                        typeof(Denoise).GetField <S4Double>("LambdaA").DefaultValue,
                        typeof(Denoise).GetField <S4Double>("LambdaB").DefaultValue,
                        typeof(Denoise).GetField <S4Double>("LambdaT").DefaultValue,
                        typeof(Denoise).GetField <S4Double>("MuT").DefaultValue,
                        typeof(Denoise).GetField <S4Double>("MaxGain").DefaultValue,
                        typeof(Denoise).GetField <S4Integer>("SmoothWindow").DefaultValue);

                    // denoise.newProperties();
                    Denoise.Predecessor = SelectedDataProcessors[SelectedDataProcessors.Count - 1];
                    SelectedDataProcessors.Add(Denoise);
                }

                if ((featParams.get("-transform") != null) &&
                    (featParams.get("-transform").Equals("dct")))
                {
                    Dct = new DiscreteCosineTransform2(
                        numFilter,
                        typeof(DiscreteCosineTransform).GetField <S4Integer>("PropCepstrumLength").DefaultValue);
                }
                else if ((featParams.get("-transform") != null) &&
                         (featParams.get("-transform").Equals("kaldi")))
                {
                    Dct = new KaldiDiscreteCosineTransform(numFilter, typeof(DiscreteCosineTransform).GetField <S4Integer>("PropCepstrumLength").DefaultValue);
                }
                else
                {
                    Dct = new DiscreteCosineTransform(numFilter, typeof(DiscreteCosineTransform).GetField <S4Integer>("PropCepstrumLength").DefaultValue);
                }
                Dct.Predecessor = SelectedDataProcessors[SelectedDataProcessors.Count - 1];
                SelectedDataProcessors.Add(Dct);

                if (featParams.get("-lifter") != null)
                {
                    Lifter             = new Lifter(int.Parse(featParams.get("-lifter"), CultureInfo.InvariantCulture.NumberFormat));
                    Lifter.Predecessor = SelectedDataProcessors[SelectedDataProcessors.Count - 1];
                    SelectedDataProcessors.Add(Lifter);
                }


                this.LogInfo("Cepstrum component auto-configured as follows: " + ToString());
            }
            catch (Exception ex)
            {
                throw new RuntimeException(ex);
            }
        }
Example #10
0
 public void SetLifter(Lifter lifterToSet)
 {
     lifter = lifterToSet;
 }
Example #11
0
 // Start is called before the first frame update
 void Start()
 {
     LuzLifter_script = LuzLifter.GetComponent <Lifter>();
     message          = "Lift Activated";
 }