Rework projectiles and fix some demon wall attacks
Still working on Demon Wall boss fight overall
This commit is contained in:
27
Zennysoft.Game.Ma/src/projectile/ProjectileSystem.cs
Normal file
27
Zennysoft.Game.Ma/src/projectile/ProjectileSystem.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
1
Zennysoft.Game.Ma/src/projectile/ProjectileSystem.cs.uid
Normal file
1
Zennysoft.Game.Ma/src/projectile/ProjectileSystem.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://chxka5g7yvcg
|
||||
Reference in New Issue
Block a user