Esempio n. 1
0
 private void Pocketing()
 {
     transform.position   = Vector2.MoveTowards(transform.position, _target.position, 4f * Time.deltaTime);
     transform.localScale = new Vector2(_pocketingTime, _pocketingTime);
     _pocketingTime      -= Time.deltaTime * 10;
     if (_pocketingTime < 0.3f)
     {
         if (Type == BallType.cue)
         {
             _pocketingTime       = 3.2f;
             _state               = BallState.free;
             transform.localScale = new Vector2(3.2f, 3.2f);
             GetComponent <Rigidbody2D>().constraints = RigidbodyConstraints2D.FreezeRotation;
         }
         else
         {
             _state = BallState.pocketed;
             _scoreBoard.AddBall(this);
         }
     }
 }