using Chickensoft.AutoInject; using Chickensoft.Introspection; using Godot; using Zennysoft.Game.Ma; [Meta(typeof(IAutoNode))] public partial class ProjectileSystem : Node3D { public override void _Notification(int what) => this.Notify(what); [Dependency] protected IMap _map => this.DependOn(); [Export] public PackedScene ProjectileScene { get; set; } [Export] private float _projectileForce { get; set; } = 7f; public void Fire() { var instantiator = new Instantiator(GetTree()); var projectile = instantiator.LoadAndInstantiate(ProjectileScene.ResourcePath); _map.AddChild(projectile); projectile.GlobalPosition = GlobalPosition; projectile.GlobalBasis = GlobalBasis; projectile.ResetPhysicsInterpolation(); projectile.ApplyCentralImpulse(projectile.GlobalBasis.Z * _projectileForce); } }