private void shoot(Vector3 direction)
        {
            GameObject bulletObject = Instantiate(GameManager.Instance.bulletPrefab);

            bulletObject.transform.SetPositionAndRotation(transform.position, Quaternion.identity);
            Bullet bullet = bulletObject.GetComponent <Bullet>();

            bullet.SetVelocity(direction.normalized * GameManager.Instance.bulletSpeed);
        }
Esempio n. 2
0
 public void UpdateBullet(Bullet bullet)
 {
     NetworkHelper.SetServerId(bullet, ServerId);
     bullet.SetTransform(Transform);
     bullet.WorldTransform = Transform;
     bullet.SetVelocity(Velocity);
     bullet.WorldVelocity = Velocity;
     bullet.Children[0].WorldTransform = Transform;
     bullet.Children[0].WorldVelocity = Velocity;
 }