.
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
using GodotHostTest.Helpers;
|
||||
using GodotHostTest.Interfaces;
|
||||
using R3;
|
||||
|
||||
namespace GodotHostTest.Game.Target;
|
||||
|
||||
public class TargetEventBus : ITargetEventBus
|
||||
{
|
||||
private readonly Pipe<Unit> _hitOutPipe = new();
|
||||
private readonly Pipe<Unit> _timedOutPipe = new();
|
||||
|
||||
public Observable<Unit> TimedOut => _timedOutPipe.Observable;
|
||||
public Observable<Unit> Hit => _hitOutPipe.Observable;
|
||||
|
||||
public void NewTargetSpawner(ITargetSpawner targetSpawner)
|
||||
{
|
||||
_timedOutPipe.PipeIn(targetSpawner.TargetSpawned.SelectMany(target => target.TimedOut));
|
||||
_hitOutPipe.PipeIn(targetSpawner.TargetSpawned.SelectMany(target => target.Hit));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://clr4u1sedssqu
|
||||
@@ -15,6 +15,7 @@ public partial class TargetSpawner : Node2D, ITargetCollector, ITargetSpawner
|
||||
[Export] public required Timer Timer;
|
||||
|
||||
[Inject] private ILevel _level = null!;
|
||||
[Inject] private ITargetEventBus _targetEventBus = null!;
|
||||
|
||||
public void NewTarget(ITarget target)
|
||||
{
|
||||
@@ -26,6 +27,7 @@ public partial class TargetSpawner : Node2D, ITargetCollector, ITargetSpawner
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_targetEventBus.NewTargetSpawner(this);
|
||||
Spawn();
|
||||
Timer.Start(_level.TimeBetweenSpawns.TotalSeconds);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
[gd_scene format=3 uid="uid://3v8kq1rfwhmr"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bv2hat41dyxiv" path="res://Game/Target/Target.cs" id="1_ouani"]
|
||||
[ext_resource type="Texture2D" uid="uid://m4pvy8kkw7k4" path="res://Game/Target/towerDefense_tile136.png" id="2_olsqn"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_uqpd1"]
|
||||
radius = 60.033325
|
||||
|
||||
[node name="Target" type="Node2D" unique_id=2101558052 node_paths=PackedStringArray("CollisionArea", "Image", "TimeOutTimer")]
|
||||
script = ExtResource("1_ouani")
|
||||
CollisionArea = NodePath("CollisionArea")
|
||||
Image = NodePath("Sprite2D")
|
||||
TimeOutDurationInSeconds = 7.0
|
||||
TimeOutTimer = NodePath("TimeOutTimer")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=31059524]
|
||||
visible = false
|
||||
position = Vector2(3.8146973e-06, 3.8146973e-06)
|
||||
scale = Vector2(1.9687501, 1.9687501)
|
||||
texture = ExtResource("2_olsqn")
|
||||
|
||||
[node name="CollisionArea" type="Area2D" parent="." unique_id=116681968]
|
||||
collision_layer = 2
|
||||
monitoring = false
|
||||
monitorable = false
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="CollisionArea" unique_id=1558252366]
|
||||
shape = SubResource("CircleShape2D_uqpd1")
|
||||
|
||||
[node name="TimeOutTimer" type="Timer" parent="." unique_id=1079777109]
|
||||
one_shot = true
|
||||
|
||||
[connection signal="timeout" from="TimeOutTimer" to="." method="OnTimeout"]
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://m4pvy8kkw7k4"
|
||||
path="res://.godot/imported/towerDefense_tile136.png-16575e41e8dd7b30e746b25e42404084.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Game/Target/towerDefense_tile136.png"
|
||||
dest_files=["res://.godot/imported/towerDefense_tile136.png-16575e41e8dd7b30e746b25e42404084.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
Reference in New Issue
Block a user