Exemplo n.º 1
0
    void CheckForTricks()
    {
        float trickRotation = mRB.rotation;
        float deltaAngle    = 0;

        deltaAngle += initRotation - trickRotation;

        // front flip detection
        if (deltaAngle > 330f)
        {
            int reward = 50;
            gb.UpdateTrickText("Trick: Frontflip");
            if (isOnGround)
            {
                gb.UpdateScore(50);
                gb.UpdateTrickText("Trick: Frontflip +" + reward.ToString());
            }
        }
        if (deltaAngle < -330f)
        {
            int reward = 50;
            gb.UpdateTrickText("Trick: Backflip");
            if (isOnGround)
            {
                gb.UpdateScore(50);
                gb.UpdateTrickText("Trick: Backflip +" + reward.ToString());
            }
        }
        //Debug.Log(deltaAngle);
    }
Exemplo n.º 2
0
    void CheckForTricks()
    {
        int   reward           = 50;
        float trickRotation    = mRB.rotation;
        float deltaAngle       = 0;
        bool  oneFlipCompleted = false;

        deltaAngle += initRotation - trickRotation;

        if (oneFlipCompleted)
        {
            tricksInARow++;
            oneFlipCompleted = false;
        }

        // front flip detection
        if (deltaAngle > 330f)
        {
            oneFlipCompleted = true;
            gb.UpdateTrickText("Trick: Frontflip");
            if (isOnGround)
            {
                trickComplete = true;
                gb.UpdateScore(reward);
                gb.UpdateTrickText("Trick: Backflip +" + reward);
                tricksInARow = 1;
            }
        }

        // back flip detection
        if (deltaAngle < -330f)
        {
            oneFlipCompleted = true;
            gb.UpdateTrickText("Trick: Backflip");
            if (isOnGround)
            {
                trickComplete = true;
                gb.UpdateScore(reward);
                gb.UpdateTrickText("Trick: Backflip +" + reward);
                tricksInARow = 1;
            }
        }

        if (isOnGround && tricksInARow > 1)
        {
            trickComplete = true;
            gb.UpdateScore(reward * tricksInARow);
            gb.UpdateTrickText("Trick: Combo +" + reward + " X " + tricksInARow);
            tricksInARow = 1;
        }
    }
Exemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        mRB = GetComponent <Rigidbody2D>();

        gm = GameObject.Find("Game Manager");

        gb = gm.GetComponent <GlobalBehavior>();

        rayCastLeft  = GameObject.Find("ray_cast_left").GetComponent <raycastUp>();
        rayCastRight = GameObject.Find("ray_cast_right").GetComponent <raycastUp>();

        speedMultiplier = 1;

        gb.UpdateLandingText("Landing: In Air");

        gb.UpdateTrickText("Trick: ");
    }