public static ArrowProjectile Create(Vector3 position, Enemy.Enemy enemy) { Transform pfArrowProjectile = Resources.Load <Transform>("pfArrowProjectile"); Transform arrowTransform = Instantiate(pfArrowProjectile, position, Quaternion.identity); ArrowProjectile arrowProjectile = arrowTransform.GetComponent <ArrowProjectile>(); arrowProjectile.SetTarget(enemy); return(arrowProjectile); }
void HandleShooting() { _shootTimer -= Time.deltaTime; if (_shootTimer <= 0f) { _shootTimer += shootTimerMax; if (_targetEnemy != null) { ArrowProjectile.Create(_projectileSpawnPosition, _targetEnemy); } } }