コード例 #1
0
    public void BuildStation(StationData stationData, out BuildingResult result)
    {
        Tile <TileData> tile = stationData.Tile;

        GameObject newStationObject = Instantiate(stationPrefab, tile.CartesianPosition, Quaternion.identity,
                                                  builtObjectParent.transform);

        Station newStation = newStationObject.GetComponent <Station>();

        newStation.UpdateData(stationData);


        tile.Data.HasStation = true;
        tile.Data.Station    = newStation;
        newStationObject.GetComponent <Station>().SetTile(tile);

        AddTracksToTile(tile);

        worldMap.AddBuiltObject(tile.Position, newStationObject);
        List <Station> transitSystemStations = gameManager.transitSystem.Stations;

        transitSystemStations.Add(newStation);

        gameManager.transitSystem.UpdateAllStationConnections();

        result = BuildingResult.Success;
    }