.
This commit is contained in:
@@ -1,21 +1,13 @@
|
||||
using Godot;
|
||||
using GodotHostTest.Helpers;
|
||||
using GodotHostTest.Interfaces;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using OwofGames.AetherBind;
|
||||
using R3;
|
||||
|
||||
namespace GodotHostTest.Game.Projectile;
|
||||
|
||||
public partial class Projectile : Node2D
|
||||
{
|
||||
[Inject] private ILogger<Projectile> _logger = null!;
|
||||
[Inject] private ITargetSpawner _targetSpawner = null!;
|
||||
[Export] private float _speed = 100;
|
||||
|
||||
// Called when the node enters the scene tree for the first time.
|
||||
public override void _Ready()
|
||||
public override void _PhysicsProcess(double delta)
|
||||
{
|
||||
_targetSpawner.TargetSpawned
|
||||
.Subscribe(_ => _logger.LogInformation("Projectile got informed of target spawning")).AddTo(this);
|
||||
Position += (float)delta * _speed * Vector2.Up.Rotated(Rotation);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user