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); }
private void SetRoad(VoronoiDirection direction, bool state) { Roads[direction] = state; Neighbors[direction].Roads[direction.Opposite(this)] = state; Neighbors[direction].RefreshSelfOnly(); RefreshSelfOnly(); }