f19cb7edda
Still working on Demon Wall boss fight overall
28 lines
859 B
C#
28 lines
859 B
C#
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<IMap>();
|
|
|
|
[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<RigidBody3D>(ProjectileScene.ResourcePath);
|
|
_map.AddChild(projectile);
|
|
projectile.GlobalPosition = GlobalPosition;
|
|
projectile.GlobalBasis = GlobalBasis;
|
|
projectile.ResetPhysicsInterpolation();
|
|
projectile.ApplyCentralImpulse(projectile.GlobalBasis.Z * _projectileForce);
|
|
}
|
|
}
|