Beispiel #1
0
        /// <summary>
        /// Adds context to the list.
        /// IPhysicsContext will be always after all usual IStubbContext.
        /// </summary>
        /// <param name="context"></param>
        public static void AddContext(IStubbContext context)
        {
            var index = _contexts.Count;

            if (_contexts.Count > 0 && !(context is IPhysicsContext))
            {
                index = _contexts.FindIndex(stubbContext => stubbContext is IPhysicsContext);
                index = index == -1 ? _contexts.Count : index;
            }

            _contexts.Insert(index, context);
        }
Beispiel #2
0
        private void Awake()
        {
            log.AddAppender(UnityLogAppender.LogDelegate);

            _debug          = CreateDebug();
            _context        = CreateContext();
            _physicsContext = CreatePhysicsContext();

            _MapServices();
            Construct(_context);

            if (!enableUiEmitter)
            {
                return;
            }

            var emitter = gameObject.GetComponent <EcsUiEmitter>();

            if (emitter != null)
            {
                _context.MainFeature.InternalSystems.InjectUi(emitter);
            }
        }
Beispiel #3
0
 /// <summary>
 /// It is called in the Start phase after context and all systems were initialized and share data injected,
 /// but before the first update invocation.
 /// </summary>
 protected virtual void PostInitialize(IStubbContext context)
 {
 }
Beispiel #4
0
 /// <summary>
 /// Have to be overriden by user for main feature or for all (Head, Main, Tail).
 /// It is called in the Awake phase before context and systems were initialized.
 /// </summary>
 protected virtual void Construct(IStubbContext context)
 {
 }
Beispiel #5
0
 protected override void Construct(IStubbContext context)
 {
     base.Construct(context);
     context.MainFeature = new MainFeature();
 }