Exemple #1
0
 /// <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));
 }
Exemple #2
0
    /// <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();
    }
Exemple #3
0
 private void HandleContradiction()
 {
     ResetOptions();
     LeftNeighbor.ResetOptions();
     RightNeighbor.ResetOptions();
     UpNeighbor.ResetOptions();
     DownNeighbor.ResetOptions();
 }