war and murder
This commit is contained in:
23
Scripts/FireAtPlayer.cs
Normal file
23
Scripts/FireAtPlayer.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user