private void Awake() { BulletMono = BulletPrefab.GetComponent <BulletMono>(); if (BulletMono == null) { Debug.LogError("No BulletMono on bullet prefab"); } }
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; } }