/// <summary> /// Checks that the neighbors of the cell allow this option /// </summary> private bool GetIsValidByPlacement(ItemBlueprint item) { return(UpNeighbor.DoesDownConnectTo(item.Up) && DownNeighbor.DoesUpConnectTo(item.Down) && LeftNeighbor.DoesRightConnectTo(item.Left) && RightNeighbor.DoesLeftConnectTo(item.Right)); }
/// <summary> /// Recalculates values that depends on neighbors' state. /// </summary> public void RecalculateNeighborsValues() { Clean(); if (SplineFormer == null) { return; } RecalculateBasicValues(); if (RightNeighbor != null) { RecalculateRightP(); RightNeighbor.RecalculateLeftP(); //_distanceToNext = Vector3.Distance(LocalPosition, RightNeighbor.LocalPosition); _distanceToNext = Vector3.Distance(_localPosition, _rightP) + Vector3.Distance(_rightP, RightNeighbor._leftP) + Vector3.Distance(RightNeighbor._leftP, RightNeighbor._localPosition); } else { _distanceToNext = 0; } RecalculateDistanceFromStart(); RecalculateRightP(); RecalculateLeftP(); }
private void HandleContradiction() { ResetOptions(); LeftNeighbor.ResetOptions(); RightNeighbor.ResetOptions(); UpNeighbor.ResetOptions(); DownNeighbor.ResetOptions(); }