Esempio n. 1
0
    private void InstantiateBall()
    {
        BallPrefab newBall  = Instantiate(ballPrefab, this.gameObject.transform);
        Ball       ballData = GetRandomBallData();

        newBall.SetBall(ballData);
        newBall.Shoot(GetDirectionFromRotation());
    }
Esempio n. 2
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetMouseButtonDown(0))
     {
         BallPrefab ball = Instantiate <BallPrefab>(ballprefab);
         ball.transform.localPosition = transform.position;
         ball.GetComponent <Rigidbody>().AddForce(Camera.main.transform.forward * Random.Range(500, 750));
     }
 }
Esempio n. 3
0
 public BallModel
 (
     Transform BallSpawnPoint,
     BallPrefab BallSize,
     int BallInitialDirection
 )
 {
     this.BallSpawnPoint       = BallSpawnPoint;
     this.BallSize             = BallSize;
     this.BallInitialDirection = BallInitialDirection;
 }