Release Candidate v0.1
This commit is contained in:
@@ -4,8 +4,6 @@ public partial class GodCircuit : Node3D
|
||||
{
|
||||
[Export]
|
||||
private AnimationPlayer _animationPlayer;
|
||||
[Export]
|
||||
private Timer _attackTimer;
|
||||
|
||||
[Signal]
|
||||
public delegate void OnEnemyBossHitEventHandler(long damage);
|
||||
@@ -18,45 +16,46 @@ public partial class GodCircuit : Node3D
|
||||
|
||||
private void OnHit(Node3D node)
|
||||
{
|
||||
if (node is Character character && character.HasMethod(Character.MethodName.OnHit))
|
||||
{
|
||||
GD.Print("Player hit: " + character.Name);
|
||||
character.Call(Character.MethodName.OnHit, node);
|
||||
}
|
||||
else
|
||||
{
|
||||
var hpComponent = GetNode<HealthPoints>("HP Component");
|
||||
if (hpComponent.CurrentHP > 0)
|
||||
{
|
||||
GD.Print("Hit");
|
||||
_animationPlayer.Play("OnHit");
|
||||
hpComponent.TakeDamage(800000);
|
||||
EmitSignal(SignalName.OnEnemyBossHit, hpComponent.CurrentHP);
|
||||
if (node is Character character && character.HasMethod(Character.MethodName.OnHit))
|
||||
{
|
||||
GD.Print("Player hit: " + character.Name);
|
||||
character.Call(Character.MethodName.OnHit, node);
|
||||
}
|
||||
else
|
||||
{
|
||||
var hpComponent = GetNode<HealthPoints>("HP Component");
|
||||
if (hpComponent.CurrentHP > 0)
|
||||
{
|
||||
GD.Print("Hit");
|
||||
_animationPlayer.Play("OnHit");
|
||||
hpComponent.TakeDamage(1);
|
||||
EmitSignal(SignalName.OnEnemyBossHit, hpComponent.CurrentHP);
|
||||
|
||||
if (hpComponent.CurrentHP <= 0)
|
||||
{
|
||||
EmitSignal(SignalName.DestroyRemainingOrbs);
|
||||
_animationPlayer.Play("OnDeath");
|
||||
_animationPlayer.AnimationFinished += OnGameFinished;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (hpComponent.CurrentHP <= 0)
|
||||
{
|
||||
EmitSignal(SignalName.DestroyRemainingOrbs);
|
||||
_animationPlayer.Play("OnDeath");
|
||||
_animationPlayer.AnimationFinished += OnGameFinished;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnBossOrbDestroyed()
|
||||
{
|
||||
var hpComponent = GetNode<HealthPoints>("HP Component");
|
||||
_animationPlayer.Play("OnHit");
|
||||
hpComponent.TakeDamage(30000000);
|
||||
EmitSignal(SignalName.OnEnemyBossHit, hpComponent.CurrentHP);
|
||||
var hpComponent = GetNode<HealthPoints>("HP Component");
|
||||
_animationPlayer.Play("OnHit");
|
||||
hpComponent.TakeDamage(60);
|
||||
EmitSignal(SignalName.OnEnemyBossHit, hpComponent.CurrentHP);
|
||||
|
||||
if (hpComponent.CurrentHP <= 0)
|
||||
hpComponent.CurrentHP = 1;
|
||||
if (hpComponent.CurrentHP <= 0)
|
||||
hpComponent.CurrentHP = 1;
|
||||
}
|
||||
|
||||
private void OnGameFinished(StringName animationName)
|
||||
{
|
||||
QueueFree();
|
||||
EmitSignal(SignalName.OnGameEnding);
|
||||
GD.Print("On game ending");
|
||||
EmitSignal(SignalName.OnGameEnding);
|
||||
QueueFree();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,11 +11,10 @@ public partial class MeleeEnemy : BasicEnemy
|
||||
|
||||
public override void _PhysicsProcess(double delta)
|
||||
{
|
||||
var players = GetTree().GetNodesInGroup("Player");
|
||||
var players = GetTree().GetNodesInGroup("Player").Cast<Character>();
|
||||
if (players.Any())
|
||||
{
|
||||
var convertedPlayers = players.Select(x => (Node3D)x);
|
||||
var target = convertedPlayers.OrderBy(x => Position.DistanceTo(x.Position)).FirstOrDefault();
|
||||
var target = players.OrderBy(x => Position.DistanceTo(x.Position)).FirstOrDefault();
|
||||
if (_targetingPlayer || Position.DistanceTo(target.Position) < _distanceToPlayer)
|
||||
{
|
||||
Position = Position.MoveToward(target.Position, _speed * (float)delta);
|
||||
|
||||
Reference in New Issue
Block a user