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>()); }
private Platform GetObject(TypePlatformEnum typePlatform) { var index = platformsListPrefabs.FindIndex(pl => pl.TypePlatform == typePlatform); return(index != -1 ? platformsListPrefabs[index] : null); }