Exemplo n.º 1
0
    public void ClearBuff()
    {
        Rigidbody2D ballRidigBody = ball.GetComponent <Rigidbody2D>();
        BallPhysics ballPhysics   = ball.GetComponent <BallPhysics>();

        ballPhysics.SetSpeedX(ballPhysics.InitalSpeedX);
        ballPhysics.SetSpeedY(ballPhysics.InitalSpeedY);
        ballRidigBody.velocity = new Vector2(ballRidigBody.velocity.x / Mathf.Pow(speedFactor, stack), ballRidigBody.velocity.y / Mathf.Pow(speedFactor, stack));
        stack    = 0;
        duration = 0;
    }
Exemplo n.º 2
0
    public void Effect()
    {
        SetStack(stack + 1);
        Rigidbody2D ballRidigBody = ball.GetComponent <Rigidbody2D>();
        BallPhysics ballPhysics   = ball.GetComponent <BallPhysics>();

        ballPhysics.SetSpeedX(ballPhysics.speedX * speedFactor);
        ballPhysics.SetSpeedY(ballPhysics.speedY * speedFactor);
        SetDuration(30);
        ballRidigBody.velocity = new Vector2(ballRidigBody.velocity.x * speedFactor, ballRidigBody.velocity.y * speedFactor);
    }
Exemplo n.º 3
0
    public void ResetBallSpeedBuff()
    {
        isSlowDown = false;
        Rigidbody2D ballRidigBody = ball.GetComponent <Rigidbody2D>();
        BallPhysics ballPhysics   = ball.GetComponent <BallPhysics>();

        ballPhysics.SetSpeedX(ballPhysics.InitalSpeedX);
        ballPhysics.SetSpeedY(ballPhysics.InitalSpeedY);
        ballRidigBody.velocity    = new Vector2(ballRidigBody.velocity.x / Mathf.Pow(decreaseBallSpeedFactor, DecreaseBallSpeedStack), ballRidigBody.velocity.y / Mathf.Pow(decreaseBallSpeedFactor, DecreaseBallSpeedStack));
        DecreaseBallSpeedStack    = 0;
        decreaseBallSpeedDuration = 0;
    }
Exemplo n.º 4
0
    public void DecreaseBallSpeedEffect(float time)
    {
        isSlowDown = true;
        SetDecreaseBallSpeed(DecreaseBallSpeedStack + 1);
        Rigidbody2D ballRidigBody = ball.GetComponent <Rigidbody2D>();
        BallPhysics ballPhysics   = ball.GetComponent <BallPhysics>();

        ballPhysics.SetSpeedX(ballPhysics.speedX * decreaseBallSpeedFactor);
        ballPhysics.SetSpeedY(ballPhysics.speedY * decreaseBallSpeedFactor);
        decreaseBallSpeedDuration = time;
        ballRidigBody.velocity    = new Vector2(ballRidigBody.velocity.x * decreaseBallSpeedFactor, ballRidigBody.velocity.y * decreaseBallSpeedFactor);
    }