Пример #1
0
    public void SetOutgoingRiver(GridDirection direction)
    {
        if (hasOutgoingRivers[(int)direction] || HasRoads)
        {
            Debug.Log("Could not add river");
            return;
        }
        SquareCell neighbor = GetNeighbor(direction);

        if (!neighbor || CentreElevation < neighbor.CentreElevation)
        {
            Debug.Log("Could not add river uphill");
            return;
        }
        if (hasIncomingRivers[(int)direction])
        {
            RemoveIncomingRiver(direction);
        }
        hasOutgoingRivers[(int)direction] = true;
        RefreshChunkOnly();

        neighbor.RemoveOutgoingRiver(direction.Opposite());
        neighbor.hasIncomingRivers[(int)direction.Opposite()] = true;
        neighbor.RefreshChunkOnly();
    }
Пример #2
0
    public void RemoveIncomingRiver(GridDirection direction)
    {
        if (!hasIncomingRivers[(int)direction])
        {
            return;
        }
        hasIncomingRivers[(int)direction] = false;
        RefreshChunkOnly();
        SquareCell neighbor = GetNeighbor(direction);

        hasOutgoingRivers[(int)direction.Opposite()] = false;
        neighbor.RefreshChunkOnly();
    }
Пример #3
0
    public void RemoveIncomingRivers()
    {
        if (!hasIncomingRivers.Any())
        {
            return;
        }
        GridDirection[] neighbors = IncomingRivers;
        for (int i = 0; i < hasIncomingRivers.Length; i++)
        {
            hasIncomingRivers[i] = false;
        }
        GroundMaterial.SetToMud(this, ref tile);
        RefreshChunkOnly();

        foreach (GridDirection direction in neighbors)
        {
            SquareCell neighbor = GetNeighbor(direction);
            hasOutgoingRivers[(int)direction.Opposite()] = false;
            neighbor.RefreshChunkOnly();
        }
    }