public void Setup() { // TODO: Remove this as it won't be needed when game object wrapper exists! prefabTemplate = new GameObject("Snowman", typeof (SnowmanMoveComponent)); poolContainer = new GameObject(); unityResources = Substitute.For<IUnityResources>(); unityResources.CreateEmptyGameObject(SnowmanFactory.SNOWMAN_POOL_CONTAINER_NAME).Returns(poolContainer); unityResources.Load(SnowmanFactory.SNOWMAN_ASSET_PATH, typeof (GameObject)).Returns(prefabTemplate); unityResources.Instantiate(prefabTemplate).Returns(prefabTemplate); //TODO: End Remove snowmanFactory = new SnowmanFactory(unityResources); }
public void Setup() { // TODO: Remove this as it won't be needed when game object wrapper exists! prefabTemplate = new GameObject("Snowman", typeof (SnowmanMoveComponent)); poolContainer = new GameObject(); unityResources = Substitute.For<IUnityResources>(); snowmanControllerProvider = Substitute.For<IProvider<ISnowmanController>>(); unityResources.CreateEmptyGameObject(SnowmanPoolManager.SNOWMAN_POOL_CONTAINER_NAME).Returns(poolContainer); unityResources.Load(SnowmanController.SNOWMAN_ASSET_PATH, typeof(GameObject)).Returns(prefabTemplate); unityResources.Instantiate(prefabTemplate).Returns(prefabTemplate); snowmanControllerProvider.Provide().Returns(Substitute.For<ISnowmanController>()); snowmanPoolManager = new SnowmanPoolManager(unityResources, snowmanControllerProvider); }
public void Setup() { prefabTemplate = new GameObject("Snowman"); unityResources = Substitute.For<IUnityResources>(); snowmanPoolManager = Substitute.For<ISnowmanPoolManager>(); snowmanMoveComponent = Substitute.For<ISnowmanMoveComponent>(); unityResources.Load(SnowmanController.SNOWMAN_ASSET_PATH, typeof(GameObject)).Returns(prefabTemplate); unityResources.Instantiate(prefabTemplate).Returns(prefabTemplate); snowmanController = new SnowmanController(snowmanPoolManager, unityResources); snowmanController.Initialize(); var prop = snowmanController.GetType().GetField("moveComponent", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); prop.SetValue(snowmanController, snowmanMoveComponent); }
public SnowmanPoolManager(IUnityResources unityResources, IProvider<ISnowmanController> snowmanControllerProvider) { this.unityResources = unityResources; this.snowmanControllerProvider = snowmanControllerProvider; }
public SnowmanController(ISnowmanPoolManager snowmanPoolManager, IUnityResources unityResources) { this.snowmanPoolManager = snowmanPoolManager; this.unityResources = unityResources; }
public UnityModule(IUnityResources resources) { Resources = resources ?? throw new ArgumentNullException(nameof(resources)); }