public void Setup() { snowmanMoveComponent = Substitute.For<ISnowmanMoveComponent>(); snowmanFactory = Substitute.For<ISnowmanFactory>(); snowmanController = new SnowmanController(snowmanFactory, snowmanMoveComponent); }
public void Initialize() { GameObject prefabTemplate = (GameObject)unityResources.Load(SNOWMAN_ASSET_PATH, typeof(GameObject)); gameObject = (GameObject)unityResources.Instantiate(prefabTemplate); moveComponent = gameObject.GetComponent<ISnowmanMoveComponent>(); gameObject.name = prefabTemplate.name; gameObject.SetActive(false); }
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 SnowmanController(ISnowmanFactory snowmanFactory, ISnowmanMoveComponent moveComponent) { this.snowmanFactory = snowmanFactory; this.moveComponent = moveComponent; }