private IInjectable Inject(MonoBehaviour behaviour, InjectableId injectableId, Entity entity, FieldInfo field)
        {
            var injectable = injectableFactory.CreateInjectable(injectableId, entity);

            field.SetValue(behaviour, injectable);
            return(injectable);
        }
Пример #2
0
        internal IInjectable CreateInjectable(InjectableId injectableId, Entity entity)
        {
            if (!injectableIdToReaderWriterCreator.ContainsKey(injectableId))
            {
                logger.HandleLog(LogType.Error, new LogEvent(NoReaderWriterCreatorFoundForInjectableIdError)
                                 .WithField(LoggingUtils.LoggerName, GetType())
                                 .WithField("ComponentId", injectableId));
                return(null);
            }

            return(injectableIdToReaderWriterCreator[injectableId].CreateInjectable(entity, entityManager, logger));
        }
Пример #3
0
 public InjectableIdAttribute(InjectableType type, uint componentId)
 {
     Id = new InjectableId(type, componentId);
 }
Пример #4
0
 public bool TryGetInjectablesForComponent(InjectableId injectableId, out HashSet <IInjectable> injectables)
 {
     return(injectablesForIds.TryGetValue(injectableId, out injectables));
 }