Initial Commit
This commit is contained in:
commit
ee5c2f922d
2255 changed files with 547750 additions and 0 deletions
20
Assets/Scripts/Util/ZenjectExtensions.cs
Normal file
20
Assets/Scripts/Util/ZenjectExtensions.cs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
using Unity.Entities;
|
||||
using Zenject;
|
||||
|
||||
namespace Util
|
||||
{
|
||||
public static class ZenjectExtensions
|
||||
{
|
||||
public static IfNotBoundBinder FromEcs<TContract>(this ConcreteIdBinderGeneric<TContract> binder) where TContract : ComponentSystemBase
|
||||
{
|
||||
return binder.FromMethod(
|
||||
c =>
|
||||
{
|
||||
var contract = (TContract)c.Container.Resolve<World>().GetExistingSystem(typeof(TContract));
|
||||
c.Container.Inject(contract);
|
||||
return contract;
|
||||
})
|
||||
.NonLazy();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue