.
This commit is contained in:
@@ -5,6 +5,7 @@ using GodotHostTest.AetherBind;
|
||||
using GodotHostTest.Game.Target;
|
||||
using GodotHostTest.Interfaces;
|
||||
using OwofGames.AetherBind;
|
||||
using OwofGames.GodotHost.Observability;
|
||||
using OwofGames.GodotLume;
|
||||
using ServiceSource = GodotHostTest.AetherBind.ServiceSource;
|
||||
|
||||
@@ -12,6 +13,7 @@ namespace GodotHostTest.Game.Level;
|
||||
|
||||
public partial class LevelServiceSource : ServiceSource
|
||||
{
|
||||
private Activity? _activityValue;
|
||||
[Export] private TargetSpawner _targetSpawner = null!;
|
||||
|
||||
protected override void OnScopeCreated(IProvider serviceProvider)
|
||||
@@ -21,14 +23,21 @@ public partial class LevelServiceSource : ServiceSource
|
||||
|
||||
[WithProvider]
|
||||
private void OnScopeCreated(IValueSetter<ITargetCollector> targetCollector,
|
||||
IValueSetter<ITargetSpawner> targetSpawner, ActivitySource activitySource, IValueSetter<Activity> activity)
|
||||
IValueSetter<ITargetSpawner> targetSpawner, IActivitySourceFactory activitySourceFactory,
|
||||
IValueSetter<Activity> activity)
|
||||
{
|
||||
// ReSharper disable once ExplicitCallerInfoArgument - the caller name is not significant in this case
|
||||
var activityValue = activitySource.StartActivity("Level") ??
|
||||
_activityValue = activitySourceFactory.ActivitySource.StartActivity("Level") ??
|
||||
throw new InvalidOperationException(
|
||||
"No listeners for the activity - is OpenTelemetry running?");
|
||||
activity.Set(activityValue);
|
||||
activity.Set(_activityValue);
|
||||
targetCollector.Set(_targetSpawner);
|
||||
targetSpawner.Set(_targetSpawner);
|
||||
}
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
// after 3 seconds, dispose the activity for simulation purposes
|
||||
GetTree().CreateTimer(3).Timeout += _activityValue!.Dispose;
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ using GodotHostTest.Game.Score;
|
||||
using GodotHostTest.Game.Target;
|
||||
using GodotHostTest.Interfaces;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using OwofGames.AetherBind.Observability;
|
||||
using OwofGames.GodotHost.Observability;
|
||||
using OwofGames.GodotLume;
|
||||
using RootServiceSource = GodotHostTest.AetherBind.RootServiceSource;
|
||||
|
||||
@@ -24,6 +24,6 @@ public partial class GameServiceSource : RootServiceSource
|
||||
|
||||
protected override void ConfigureServices(IServiceCollection serviceCollection)
|
||||
{
|
||||
serviceCollection.AddObservability();
|
||||
serviceCollection.AddObservability(builder => builder.AddGrpcExporter("http://localhost:4317"));
|
||||
}
|
||||
}
|
||||
+3
-10
@@ -8,13 +8,14 @@ namespace GodotHostTest.Game.Turret;
|
||||
public partial class Turret : Sprite2D
|
||||
{
|
||||
[Export] private Node2D _launcher = null!;
|
||||
|
||||
[Inject] private ILogger<Turret> _logger = null!;
|
||||
[Export] private PackedScene _projectilePackedScene = null!;
|
||||
|
||||
private double _rotationDirection;
|
||||
[Export] private double _rotationSpeed = 6;
|
||||
|
||||
[Inject] private ISceneInstantiator _sceneInstantiator = null!;
|
||||
[Export] private double _slowDownFactor = 0.3;
|
||||
|
||||
private void OnTimerTimeout()
|
||||
{
|
||||
@@ -24,20 +25,12 @@ public partial class Turret : Sprite2D
|
||||
_logger.LogInformation("Projectile launched.");
|
||||
}
|
||||
|
||||
public override void _Input(InputEvent @event)
|
||||
{
|
||||
_rotationDirection = 0;
|
||||
if (@event.IsActionPressed("rotate_clockwise")) _rotationDirection = 1;
|
||||
|
||||
if (@event.IsActionPressed("rotate_counterclockwise")) _rotationDirection = -1;
|
||||
}
|
||||
|
||||
public override void _PhysicsProcess(double delta)
|
||||
{
|
||||
_rotationDirection = 0;
|
||||
if (Input.IsActionPressed("rotate_clockwise")) _rotationDirection = 1;
|
||||
|
||||
if (Input.IsActionPressed("rotate_counterclockwise")) _rotationDirection = -1;
|
||||
if (Input.IsActionPressed("slow_down")) _rotationDirection *= _slowDownFactor;
|
||||
|
||||
_launcher.Rotation += (float)(_rotationSpeed * delta * _rotationDirection);
|
||||
base._PhysicsProcess(delta);
|
||||
|
||||
@@ -12,8 +12,10 @@ point_count = 2
|
||||
[node name="Turret" type="Sprite2D" unique_id=682995021 node_paths=PackedStringArray("_launcher")]
|
||||
texture = ExtResource("1_fa2t6")
|
||||
script = ExtResource("2_tkk1n")
|
||||
_projectilePackedScene = ExtResource("3_eoix6")
|
||||
_launcher = NodePath("Launcher")
|
||||
_projectilePackedScene = ExtResource("3_eoix6")
|
||||
_rotationSpeed = 4.0
|
||||
_slowDownFactor = 0.5
|
||||
|
||||
[node name="Launcher" type="Sprite2D" parent="." unique_id=1492355681]
|
||||
texture = ExtResource("4_q6l7p")
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
{
|
||||
"Logging": {
|
||||
"Godot": {
|
||||
"LogLevel": {
|
||||
"OwofGames.GodotHost.Observability": "Trace"
|
||||
}
|
||||
},
|
||||
"OpenTelemetry": {
|
||||
"LogLevel": {
|
||||
"Default": "Trace"
|
||||
|
||||
@@ -13,12 +13,12 @@
|
||||
<PackageReference Include="R3" Version="1.3.1"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="OwofGames.AetherBind.Observability">
|
||||
<HintPath>..\OwofGames.Godot\OwofGames.AetherBind.Observability\bin\Debug\net8.0\OwofGames.AetherBind.Observability.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OwofGames.GodotHost">
|
||||
<HintPath>..\OwofGames.Godot\OwofGames.GodotHost\bin\Debug\net8.0\OwofGames.GodotHost.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OwofGames.GodotHost.Observability">
|
||||
<HintPath>..\OwofGames.Godot\OwofGames.GodotHost.Observability\bin\Debug\net8.0\OwofGames.GodotHost.Observability.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OwofGames.GodotLogger">
|
||||
<HintPath>..\OwofGames.Godot\OwofGames.GodotHost\bin\Debug\net8.0\OwofGames.GodotLogger.dll</HintPath>
|
||||
</Reference>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=_002Fhome_002Fredglow_002Fsources_002FOwofGames_002EGodot_002FOwofGames_002EAetherBind_002EObservability_002Fbin_002FDebug_002Fnet8_002E0_002FOwofGames_002EAetherBind_002EObservability_002Edll/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=_002Fhome_002Fredglow_002Fsources_002FOwofGames_002EGodot_002FOwofGames_002EAetherBind_002ESourceGenerators_002Fbin_002FDebug_002Fnetstandard2_002E0_002FOwofGames_002EAetherBind_002ESourceGenerators_002Edll/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=_002Fhome_002Fredglow_002Fsources_002FOwofGames_002EGodot_002FOwofGames_002EAetherBind_002Fbin_002FDebug_002Fnet8_002E0_002FOwofGames_002EAetherBind_002Edll/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=_002Fhome_002Fredglow_002Fsources_002FOwofGames_002EGodot_002FOwofGames_002EGodotHost_002EObservability_002Fbin_002FDebug_002Fnet8_002E0_002FOwofGames_002EGodotHost_002EObservability_002Edll/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=_002Fhome_002Fredglow_002Fsources_002FOwofGames_002EGodot_002FOwofGames_002EGodotHost_002Fbin_002FDebug_002Fnet8_002E0_002FOwofGames_002EGodotHost_002Edll/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=_002Fhome_002Fredglow_002Fsources_002FOwofGames_002EGodot_002FOwofGames_002EGodotHost_002Fbin_002FDebug_002Fnet8_002E0_002FOwofGames_002EGodotLogger_002Edll/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=_002Fhome_002Fredglow_002Fsources_002FOwofGames_002EGodot_002FOwofGames_002EGodotLume_002EMicrosoft_002EDependencyInjection_002Fbin_002FDebug_002Fnet8_002E0_002FOwofGames_002EGodotLume_002EMicrosoft_002EDependencyInjection_002Edll/@EntryIndexedValue">True</s:Boolean>
|
||||
@@ -11,6 +12,7 @@
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ABaseProcessor_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2026_002E2_003Fresharper_002Dhost_003FSourcesCache_003F7362ec394dcd754cb9c2dcdd91cf4d4adc82ad22d9863946e18dd8e1e257c7_003FBaseProcessor_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ABatchExportProcessor_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2026_002E2_003Fresharper_002Dhost_003FSourcesCache_003Fc8dd41e266838cc76bfa11d9dfab1ac2b969fe1ca445be5736143f97e378c_003FBatchExportProcessor_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AEnumerable_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2026_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F71c28e8d0d254cb69b7b78690e099f6183800_003Fa8_003F2e82b19d_003FEnumerable_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AGodotHostTest_002EGame_002ELevel_002ELevelServiceSource_002EOnScopeCreated_002EWithProvider_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2026_002E2_003Fresharper_002Dhost_003FSourcesCache_003F7e88428147db393265e1cfcb5461548dc57aaf3_003FGodotHostTest_002EGame_002ELevel_002ELevelServiceSource_002EOnScopeCreated_002EWithProvider_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AGodotHostTest_002EGame_002ELevel_002ELevelServiceSource_002EOnScopeCreated_002EWithProvider_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2026_002E2_003Fresharper_002Dhost_003FSourcesCache_003Ff67e9a43d7ceeaa29fd4ff907a3ed16718c33f2_003FGodotHostTest_002EGame_002ELevel_002ELevelServiceSource_002EOnScopeCreated_002EWithProvider_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AGodotObject_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2026_002E2_003Fresharper_002Dhost_003FSourcesCache_003F4b3cf0d6385fc1f8b61f68a3e1df5132e355f1c63b49372b4c670e76f3_003FGodotObject_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AHttpClient_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2026_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F817267d4eb7342ab80e0efd5613f1765199200_003F52_003F81ac2983_003FHttpClient_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
@@ -26,6 +28,7 @@
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AThrowHelpers_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2026_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F6cc9b871557b441baa469ce23b255f41dbb200_003F8e_003Fc3f51c26_003FThrowHelpers_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AThrowHelper_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2026_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F6cc9b871557b441baa469ce23b255f41dbb200_003F71_003F4ef26ee8_003FThrowHelper_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AThrowHelper_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2026_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F71c28e8d0d254cb69b7b78690e099f6183800_003F72_003F2da75270_003FThrowHelper_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ATracerProviderSdk_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2026_002E2_003Fresharper_002Dhost_003FSourcesCache_003Fcaafa02e3d88c337ab20dce7c21f1db259cd1cae52395b6888f68313fd50e6_003FTracerProviderSdk_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/Environment/AssemblyExplorer/XmlDocument/@EntryValue"><AssemblyExplorer>
|
||||
<Assembly Path="/home/redglow/sources/OwofGames.Godot/OwofGames.AetherBind.Observability/bin/Debug/net8.0/OwofGames.AetherBind.Observability.dll" />
|
||||
</AssemblyExplorer></s:String>
|
||||
|
||||
@@ -40,6 +40,11 @@ rotate_counterclockwise={
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
slow_down={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194325,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[layer_names]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user