Example #1
0
 void Awake()
 {
     rigid = GetComponent <Rigidbody2D>();
     ForceButton.OnChangeForce += StopBallRotate;
     seeker = GetComponent <Seeker>();
     OnBallChangePosition.Invoke(transform.position);
 }
Example #2
0
 void Update()
 {
     if (!isMoving)
     {
         return;
     }
     OnBallChangePosition.Invoke(transform.position);
     velocity = rigid.velocity.sqrMagnitude;
     if (isOnRamp)
     {
         return;
     }
     if (velocity < 0.4f)
     {
         rigid.velocity = new Vector2(0, 0);
         isMoving       = false;
         LetBallRotate();
         OnAnyBallStop.Invoke();
         OnBallStoped.Invoke(this);
     }
 }