예제 #1
0
 private void handleShooting()
 {
     if (Input.GetMouseButtonDown(0))//shooting
     {
         GameObject bullet  = GM.bulletPoolInstance.GetObject();
         Vector3    shotPos = (muzzle.transform.position - player.transform.position).normalized;
         bullet.transform.position = muzzle.transform.position;
         bullet.SetActive(true);
         Vector2 velocity = new Vector2(shotPos.x * 20, shotPos.y * 20) * bulletSpeedMultiplier;
         bullet.GetComponent <Rigidbody2D>().velocity = velocity;
         bullet.GetComponent <Bullet>().Deactivate(10);//TODO IMPROVE
         ClientSend.BulletSpawn(muzzle.transform.position, velocity);
     }
 }