Ejemplo n.º 1
0
        public TIView FromPrefab <TIView>(Object prefab, Transform parent, bool instantiateInWorldSpace, IAgent agent) where TIView : class, IViewBase
        {
            Assert.IsNotNull(prefab);
            var view = Object.Instantiate(prefab, parent, instantiateInWorldSpace) as TIView;

            Assert.IsNotNull(view);

            view.SetAgent(agent);

            view = Prepare(Inject(typeof(TIView), view)) as TIView;
            view.AddSubscriptions();
            agent.AddSubscriptions();
            agent.BaseModel.AddSubscriptions();
            return(view);
        }