riversong code showcase

This commit is contained in:
Daniele Marotta
2026-05-21 15:52:18 +02:00
commit 4c9eea1c02
462 changed files with 23406 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
using Cysharp.Threading.Tasks;
namespace DanieleMarotta.RiversongCodeShowcase
{
public class HarvestResourceIntentExecutionLogic : IntentExecutionLogic
{
private World _world;
private ISignalBus _signalBus;
public override UniTask InitializeAsync(IServiceLocator serviceLocator)
{
_world = serviceLocator.GetService<World>();
_signalBus = serviceLocator.GetService<ISignalBus>();
return UniTask.CompletedTask;
}
public override IntentExecutionResult Execute(Agent agent, in AgentIntent intent)
{
ref var jobState = ref agent.GetJobStateRW();
var resourceNodeId = jobState.Harvester.ResourceNodeId;
if (!_world.RawResources.Exists(resourceNodeId)) return IntentExecutionResult.Failure;
_signalBus.Raise(new RawResourceHarvestedSignal(resourceNodeId));
return IntentExecutionResult.Success;
}
}
}