示例#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);
     }
 }