riversong code showcase
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DanieleMarotta.RiversongCodeShowcase
|
||||
{
|
||||
[GameSystemGroup(typeof(EarlyGameSystemGroup))]
|
||||
[InitializeAfter(typeof(PreLoadAssetsSystem))]
|
||||
public class PoolsInitializationSystem : GameSystem, IInitializable
|
||||
{
|
||||
[InjectService]
|
||||
private IPoolingService _poolingService;
|
||||
|
||||
[InjectService]
|
||||
private IGameDatabase _gameDatabase;
|
||||
|
||||
public PoolsInitializationSystem(IServiceLocator serviceLocator) : base(serviceLocator)
|
||||
{
|
||||
}
|
||||
|
||||
public UniTask InitializeAsync()
|
||||
{
|
||||
foreach (var product in _gameDatabase.OfType<ProductDefinition>())
|
||||
{
|
||||
_poolingService.GetOrCreatePool((GameObject)product.ProductStackVisualization.Asset);
|
||||
_poolingService.GetOrCreatePool((GameObject)product.CarriedVisualization.Asset);
|
||||
}
|
||||
|
||||
return UniTask.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user