/// <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); }
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); } }
/// <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) { }
/// <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) { }
protected override void Construct(IStubbContext context) { base.Construct(context); context.MainFeature = new MainFeature(); }