예제 #1
0
파일: Shoot.cs 프로젝트: Mertiq/HaxBall
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Space) && canShoot)
     {
         FindTheWayToGo.FindWay(ball.transform, transform);
         ball.GetComponent <Rigidbody2D>().velocity = new Vector3(FindTheWayToGo.wayY * 5f, FindTheWayToGo.wayX * 5f, 0);
     }
 }
예제 #2
0
 private void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.transform.tag == "Ball")
     {
         FindTheWayToGo.FindWay(ball.transform, transform);
         ball.GetComponent<Rigidbody2D>().velocity = new Vector3(FindTheWayToGo.wayY * 5f, FindTheWayToGo.wayX * 5f, 0);
     }
 }