Exemplo n.º 1
0
 private void Awake()
 {
     BulletMono = BulletPrefab.GetComponent <BulletMono>();
     if (BulletMono == null)
     {
         Debug.LogError("No BulletMono on bullet prefab");
     }
 }
Exemplo n.º 2
0
    protected virtual void Shoot()
    {
        GameObject bullet;

        if (ShootTransform)
        {
            bullet = GameObject.Instantiate(bulletPrefab, ShootTransform.position, Quaternion.identity);
        }
        else
        {
            bullet = GameObject.Instantiate(bulletPrefab, transform.position, Quaternion.identity);
        }

        BulletMono bMono = bullet.GetComponent <BulletMono>();

        bMono.ChangeShotDir(shotDir);

        onShootEvent?.Invoke();

        if (IsFirstShot)
        {
            IsFirstShot = false;
        }
    }