void Shoot() { GameObject bulletGo = (GameObject)Instantiate(bulletPrefab, firePoint.position, firePoint.rotation); TurretProjectile bullet = bulletGo.GetComponent <TurretProjectile>(); if (bullet != null) { bullet.Seek(target, damage); } }
void PewPew() { GameObject newProjectile = Instantiate(projectile, firePoint.position, transform.rotation); newProjectile.GetComponent <TurretProjectile>().damage = damage; newProjectile.GetComponent <TurretProjectile>().speed = shotSpeed; TurretProjectile projectileScript = newProjectile.GetComponent <TurretProjectile>(); if (projectileScript != null) { projectileScript.Seek(target); } }