24 lines
488 B
C#
24 lines
488 B
C#
using Godot;
|
|
|
|
public partial class FireAtPlayer : Timer
|
|
{
|
|
[Export]
|
|
private Node3D _enemy;
|
|
[Export]
|
|
private PackedScene _fireProjectile;
|
|
|
|
public void OnFireAtPlayer()
|
|
{
|
|
GD.Print("Fire at player");
|
|
var projectile = _fireProjectile.Instantiate<Projectile>() as EnemyBullet;
|
|
projectile.Rotation = _enemy.Rotation;
|
|
projectile.Position = _enemy.Position;
|
|
GetParent().AddChild(projectile);
|
|
}
|
|
|
|
private void OnDied()
|
|
{
|
|
Stop();
|
|
}
|
|
}
|