Example #1
0
    private void LaunchBall(BallIdentifier ball)
    {
        ball.rigidbody.velocity = tempVelocity * GameManager.Instance.gameInfo.ballConstantSpeed;

        if (ball.rigidbody.velocity == Vector2.zero)
        {
            Debug.Log("uwudjnd");
            GameManager.Instance.AllBallsLanded();
            return;
        }
    }
    private void GetAndFireBall()
    {
        Debug.Log("Get And Fire Ball");
        BallIdentifier ball = GameManager.Instance.pooledExtraBalls.GetPooledObject();

        if (ball != null)
        {
            //set ball position at the main ball launch position
            ball.Me.transform.position = new Vector2(GameManager.Instance.ballPositionX, GameManager.Instance.gameInfo.ballRestPositionY);
            //set ball active
            ball.Me.SetActive(true);
            GameManager.Instance.launchFunctionality.Launch(ball);
        }
        ballWaitTimeSecondsTicker = ballWaitTimeBeforeFiring;
        numberOfExtraBallsRemainingToFire--;
    }
Example #3
0
    public void Launch(BallIdentifier ball)
    {
        if (!hasLaunchedMainBallInCurrentTurn)
        {
            ballVelocityX = mouseStartPosition.x - mouseEndPosition.x;
            ballVelocityY = mouseStartPosition.y - mouseEndPosition.y;

            tempVelocity = new Vector2(ballVelocityX, ballVelocityY).normalized;

            LaunchBall(ball);

            hasLaunchedMainBallInCurrentTurn = true;
        }
        else
        {
            LaunchBall(ball);
        }
    }
 private void DropBall(BallIdentifier ball)
 {
     ball.DropBall();
     BallLandedOnGround(0);
 }
    public BallIdentifier GetExtraBall()
    {
        BallIdentifier ballIdentifier = pooledExtraBalls.GetPooledObject();

        return(ballIdentifier);
    }
 void Awake()
 {
     rBody  = GetComponent <Rigidbody2D>();
     ballID = GetComponent <BallIdentifier>();
 }