예제 #1
0
        public Platform UseObject(Vector3 position, Quaternion quaternion, TypePlatformEnum typePlatform)
        {
            var spawnedTile =
                _pool.InstantiateFromPool(GetObject(typePlatform).gameObject, position, quaternion, PoolType.Tile);

            if (!spawnedTile.activeSelf)
            {
                spawnedTile.SetActive(true);
            }

            return(spawnedTile.GetComponent <Platform>());
        }
예제 #2
0
        private Platform GetObject(TypePlatformEnum typePlatform)
        {
            var index = platformsListPrefabs.FindIndex(pl => pl.TypePlatform == typePlatform);

            return(index != -1 ? platformsListPrefabs[index] : null);
        }