コード例 #1
0
    public void SetOutgoingRiver(VoronoiDirection direction)
    {
        if (_hasOutgoingRiver && _outgoingRiver == direction)
        {
            return;
        }

        VoronoiCell neighbor = GetNeighbor(direction);

        if (!neighbor || _elevation < neighbor._elevation)
        {
            return;
        }

        RemoveOutgoingRiver();
        if (_hasIncomingRiver && _incomingRiver == direction)
        {
            RemoveIncomingRiver();
        }

        _hasOutgoingRiver = true;
        _outgoingRiver    = direction;

        neighbor.RemoveIncomingRiver();
        neighbor._hasIncomingRiver = true;
        neighbor._incomingRiver    = direction.Opposite(this);

        SetRoad(direction, false);
    }
コード例 #2
0
 private void SetRoad(VoronoiDirection direction, bool state)
 {
     Roads[direction] = state;
     Neighbors[direction].Roads[direction.Opposite(this)] = state;
     Neighbors[direction].RefreshSelfOnly();
     RefreshSelfOnly();
 }