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,37 @@
using UnityEngine;
namespace DanieleMarotta.RiversongCodeShowcase
{
[GameSystemGroup(typeof(DefaultAgentsSystemGroup))]
public class UnlockCrittersSystem : GameSystem, IUpdatable
{
[InjectService]
private IEntityCache _entityCache;
[InjectService]
private IEntityCollection _entityCollection;
[InjectService]
private IIntentLogicExecutor _intentLogicExecutor;
public UnlockCrittersSystem(IServiceLocator serviceLocator) : base(serviceLocator)
{
}
public void Update()
{
foreach (var critter in _entityCache.GetCritterAgents())
{
ref var critterState = ref critter.GetCritterStateRW();
if (critterState.LockId == Entity.InvalidId || _entityCollection.Exists(critterState.LockId)) continue;
Debug.LogError($"Invalid lock id {critterState.LockId} on critter {critter.Id}");
critterState.LockId = Entity.InvalidId;
ref var intentQueue = ref _intentLogicExecutor.CancelRemainingIntents(critter);
IntentQueue.LoopWandering(ref intentQueue, 0);
}
}
}
}