Пример #1
0
        public IEnumerator ReleasePlatformTest()
        {
            GameObject     gameObject0    = new GameObject();
            MovingPlatform movingPlatform = gameObject0.AddComponent <MovingPlatform>();

            GameObject             gameObject1            = new GameObject();
            MovingPlatformProvider movingPlatformProvider = gameObject1.AddComponent <MovingPlatformProvider>();

            List <MovingPlatform> movingPlatformList = new List <MovingPlatform>();

            movingPlatformList.Add(movingPlatform);
            movingPlatformProvider.InjectDependencies(movingPlatformList);

            // Since there is only one platform in the list, it should return the same reference to the one added previously
            MovingPlatform randomMovingPlatform = movingPlatformProvider.GetRandomPlatform();

            movingPlatformProvider.ReleasePlatform(randomMovingPlatform); // Release it and then get another platform. Should return the same
            randomMovingPlatform = movingPlatformProvider.GetRandomPlatform();

            Assert.AreEqual(movingPlatform, randomMovingPlatform);

            yield return(null);
        }
 void ReleasePlatform(MovingPlatform platform)
 {
     _movingPlatformProvider.ReleasePlatform(platform);
     platform.gameObject.SetActive(false);
 }