using System.Collections; using System.Collections.Generic; using UnityEngine; public class BasicShooter : AbstractShooter { // Bullet that will be fired [SerializeField] private GameObject _bullet; private Transform _parentTransform; // Direction the bullet will be going [SerializeField] private Vector2 _direction = Vector2.right; // Offset between parent and newly created bullet [SerializeField] private Vector2 _offset = Vector2.zero; void Start() { _parentTransform = GetComponentInParent(); } protected override void InstantiateProjectiles() { Vector3 newPosition = _parentTransform.position + (Vector3)_offset; GameObject child = Instantiate(_bullet, newPosition, Quaternion.identity); child.GetComponent().Direction = _direction; } }