Exemple #1
0
    protected void MoveCape(CapeTile prevPiece, int newVerticalLayer, Vector3Int direction)
    {
        Vector3 myOldPosition = transform.position;

        transform.position += direction;

        if (prevPiece != null)
        {
            RotateFrontTowards(prevPiece);
        }

        int oldVerticalLayer = VerticalLayer;

        VerticalLayer = newVerticalLayer;

        if (NextCapePiece != null)
        {
            if (NextCapePiece.HadWeightOnTop)
            {
                NextCapePiece.HadWeightOnTop = false;
                SnapNextCapePiece();
                Level.DropAllVerticalLayers();
            }
            else
            {
                NextCapePiece.MoveCape(this, oldVerticalLayer, Vector3Int.RoundToInt(myOldPosition - NextCapePiece.transform.position));
                UpdateGeometryVariantBasedOnNextPiece();
                UpdateModel();
            }
        }
        else
        {
            Level.DropAllVerticalLayers();
        }
    }
Exemple #2
0
 public void MarkWeightsForMove()
 {
     if (IsWeightOnTop())
     {
         HadWeightOnTop = true;
     }
     else if (NextCapePiece != null)
     {
         NextCapePiece.MarkWeightsForMove();
     }
 }
Exemple #3
0
 public bool IsConnectedToTile(Vector3Int coords)
 {
     if (TileCoordinates == coords)
     {
         return(true);
     }
     if (NextCapePiece != null)
     {
         return(NextCapePiece.IsConnectedToTile(coords));
     }
     return(false);
 }
Exemple #4
0
 public bool HasLadyOnTop()
 {
     if (Level.TileHasComponent <Lady>(this.TileCoordinates))
     {
         return(true);
     }
     if (NextCapePiece != null)
     {
         return(NextCapePiece.HasLadyOnTop());
     }
     return(false);
 }