Example #1
0
    /// <summary>
    /// Dashs in Game without Collision.
    /// </summary>
    /// <param name="Velocity">Sets the Velocity of Player Dashing.</param>
    /// <returns>Returns the Current Speed of Player.</returns>
    public void InfiniteDash(DashVelocity Velocity, ScreenAndCamera cam)
    {
        Action = CurrentAction.InfiniteDash;

        this.Velocity = (int)Velocity;

        this.ProgressBar.SetActive(true);
        this.ProgressBar.GetComponent <ProgressBar>().ProgressStart();

        halo.enabled = true;

        BoxCollider2D[] col = this.Blocks[0].GetComponents <BoxCollider2D>();
        for (int i = 0; i < col.Length; i++)
        {
            if (col[i].isTrigger)
            {
                col[i].size = new Vector2(20, col[i].size.y);
                continue;
            }
            else
            {
                col[i].enabled = false;
            }
        }
        col = this.Blocks[1].GetComponents <BoxCollider2D>();
        for (int i = 0; i < col.Length; i++)
        {
            if (col[i].isTrigger)
            {
                col[i].size = new Vector2(20, col[i].size.y);
                continue;
            }
            else
            {
                col[i].enabled = false;
            }
        }
        print(cam.gameObject.GetComponent <Rigidbody2D>().velocity.y);
        //cam.gameObject.GetComponent<Rigidbody2D>().velocity = new Vector2(0, cam.gameObject.GetComponent<Rigidbody2D>().velocity.y + this.Velocity);
        cam.ChangeSpeed(this.Velocity);
        print(cam.gameObject.GetComponent <Rigidbody2D>().velocity.y);
    }
Example #2
0
    /// <summary>
    /// Ends work of InfiniteDash.
    /// </summary>
    public void EndInfiniteDash(ScreenAndCamera cam)
    {
        Action = CurrentAction.Nothing;

        //cam.gameObject.GetComponent<Rigidbody2D>().velocity = new Vector2(0, cam.gameObject.GetComponent<Rigidbody2D>().velocity.y - this.Velocity);
        cam.ChangeSpeed(-this.Velocity);

        halo.enabled = false;

        BoxCollider2D[] col = this.Blocks[0].GetComponents <BoxCollider2D>();
        for (int i = 0; i < col.Length; i++)
        {
            if (col[i].isTrigger)
            {
                col[i].size = new Vector2(2.07f, col[i].size.y);
                continue;
            }
            else
            {
                col[i].enabled = true;
            }
        }
        col = this.Blocks[1].GetComponents <BoxCollider2D>();
        for (int i = 0; i < col.Length; i++)
        {
            if (col[i].isTrigger)
            {
                col[i].size = new Vector2(2.07f, col[i].size.y);
                continue;
            }
            else
            {
                col[i].enabled = true;
            }
        }
    }