using ColdMint.scripts.debug;
using ColdMint.scripts.inventory;
using Godot;
namespace ColdMint.scripts.weapon;
///
/// Projectile weapons
/// 抛射体武器
///
///
///These weapons can fire projectiles to attack the enemy.For example: guns and scepters.Generate a bullet to attack the enemy.
///这类武器可发射抛射体,攻击敌人。例如:枪支和法杖。生成一个子弹攻击敌人。
///
public partial class ProjectileWeapon : WeaponTemplate
{
///
/// The formation position of the projectile
/// 抛射体的生成位置
///
private Marker2D? _marker2D;
private int _projectileIndex;
///
/// Number of slots for ranged weapons
/// 远程武器的槽位数量
///
[Export] public int NumberSlots { get; set; }
public override int ItemType
{
get => Config.ItemType.ProjectileWeapon;
}
public override void _Ready()
{
base._Ready();
_marker2D = GetNode("Marker2D");
SelfItemContainer = new UniversalItemContainer(NumberSlots);
SelfItemContainer.AllowAddingItemByType(Config.ItemType.Magic);
}
protected override void DoFire(Node2D? owner, Vector2 enemyGlobalPosition)
{
if (owner == null)
{
LogCat.LogError("owner_is_null");
return;
}
if (_marker2D == null)
{
LogCat.LogError("marker2d_is_null");
return;
}
if (GameSceneDepend.ProjectileContainer == null)
{
LogCat.LogError("projectile_container_is_null");
return;
}
}
}