Fix capricorn projectile bug
This commit is contained in:
@@ -88,6 +88,11 @@ public partial class Character : CharacterBody3D
|
||||
projectile.Position = Position;
|
||||
GetParent().AddChild(projectile);
|
||||
var projectiles = projectile.GetChildren().OfType<Projectile>();
|
||||
foreach (var proj in projectiles)
|
||||
{
|
||||
if (proj.HasRotation)
|
||||
proj.Rotation = GetNode<Node3D>("Pivot").Rotation;
|
||||
}
|
||||
CanShoot = false;
|
||||
await ToSignal(GetTree().CreateTimer(projectiles.First().Cooldown), "timeout");
|
||||
CanShoot = true;
|
||||
|
||||
@@ -32,15 +32,18 @@ public partial class Projectile : Node3D
|
||||
{
|
||||
var pathFollow = GetNode<PathFollow3D>("PathFollow3D");
|
||||
pathFollow.Progress += Speed * (float)delta;
|
||||
if (pathFollow.ProgressRatio > 0.9f)
|
||||
if (pathFollow.ProgressRatio > 0.98f)
|
||||
QueueFree();
|
||||
}
|
||||
|
||||
public void OnProjectileHit(Node node)
|
||||
{
|
||||
SetProcess(false);
|
||||
if (node.GetParent() is BasicEnemy basicEnemy && basicEnemy.HasMethod(BasicEnemy.MethodName.OnEnemyHit))
|
||||
if (node is BasicEnemy basicEnemy && basicEnemy.HasMethod(BasicEnemy.MethodName.OnEnemyHit))
|
||||
{
|
||||
basicEnemy.Call(BasicEnemy.MethodName.OnEnemyHit, node);
|
||||
GD.Print("Hit enemy at " + basicEnemy.Position);
|
||||
}
|
||||
else
|
||||
GD.Print("Hit something other than enemy: " + node.Name);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user