コード例 #1
0
        public void Setup()
        {
            snowmanMoveComponent = Substitute.For<ISnowmanMoveComponent>();
            snowmanFactory = Substitute.For<ISnowmanFactory>();

            snowmanController = new SnowmanController(snowmanFactory, snowmanMoveComponent);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
 public SnowmanController(ISnowmanFactory snowmanFactory, ISnowmanMoveComponent moveComponent)
 {
     this.snowmanFactory = snowmanFactory;
     this.moveComponent = moveComponent;
 }