using ActionGameFramework.Health;
using ActionGameFramework.Projectiles;
using UnityEngine;
using Core.Utilities;
namespace TowerDefense.Towers.TowerLaunchers
{
///
/// Implementation of the tower launcher for Ballistic Projectiles
///
public class BallisticLauncher : Launcher
{
///
/// Launches a single projectile at a single enemy from a single firing point
///
///
/// The enemy to target
///
///
/// The projectile to attack
///
///
/// The point to fire from
///
public override void Launch(Targetable enemy, GameObject projectile, Transform firingPoint, int idx = 0)
{
Vector3 startPosition = firingPoint.position;
var ballisticProjectile = projectile.GetComponent();
if (ballisticProjectile == null)
{
Debug.LogError("No ballistic projectile attached to projectile");
DestroyImmediate(projectile);
return;
}
ballisticProjectile.FireAtPoint(startPosition, enemy.position);
}
}
}