public void InstallTile(RoadTile.Type type, Vector3 position, Vector3 direction) { RoadTile installedTile = roadTilePool.GetFromPool(type); installedTile.transform.position = position; installedTile.transform.rotation = Quaternion.LookRotation(direction); Vector2 mapPosition = standingTilePosition + lastOutDirection; activeTileMap.Add(mapPosition, installedTile); lastWorldPoint = position; if (type != RoadTile.Type.Straight) { Rotator rotator; RotatorLink rotatorLink = installedTile.GetComponent <RotatorLink>(); if (roadTilePool[roadTilePool.InstantiatedCount - 2].TileType != type) { rotator = rotatorPool.GetFromPool(); float clockwiseValue; if (installedTile.TileType == RoadTile.Type.Left) { clockwiseValue = -1; } else { clockwiseValue = 1; } rotator.ApplyInstallProcess(clockwiseValue); rotatorLink.InstallRotator(rotator); } else { rotatorLink.Rotator = roadTilePool[roadTilePool.InstantiatedCount - 2].GetComponent <RotatorLink>().Rotator; } } installedTile.ApplyInstallProcess(direction, position, mapPosition); }
public void InstallTile(Vector3 position) { BallPlatformTile installedTile = tilePool.GetFromPool(tileTypeIteration, (t) => t.InitializeAsPoolItem(false)); installedTile.transform.position = position; lastWorldPoint = position; tileTypeIteration += 1; totalTileCount += 1; if (tileTypeIteration >= tilePool.TypeCount) { tileTypeIteration = 0; } installedTile.ApplyInstallProcess(); }