コード例 #1
0
 public void ReturnToShapeQueue()
 {
     currentShape      = null;
     currentlyDragging = false;
     ClearPreviewTiles();
     shapeQueuePanel.CancelPreparedSelections();
 }
コード例 #2
0
 public void BeginDraggingPiece(ForecastShape shape, float _rotation = 0f)
 {
     rotation          = _rotation;
     dragOrigin        = Input.mousePosition;
     currentShape      = shape;
     currentlyDragging = true;
     // StartCoroutine(BuildTileArraySlow());
     BuildTileArray();
     UpdateTileArray();
 }
コード例 #3
0
 public bool AllTilesValid(int x, int y, ForecastShape shape, float rotation = 0f)
 {
     for (int i = 0; i < shape.tiles.Count; i++)
     {
         Vector2Int offs = ShapePositioning.RotateOffset(shape.tiles[i].offset, rotation);
         if (!ValidCoordinate(offs.x + x, offs.y + y))
         {
             return(false);
         }
     }
     return(true);
 }
コード例 #4
0
 public void EndDragging()
 {
     if (PGTileStateManager.instance.AllTilesValid(currentOriginTile.x, currentOriginTile.y, currentShape, rotation))
     {
         applyForecastShape.ApplyCurrentTetramino(currentShape);
         if (onPlaceShape != null)
         {
             onPlaceShape();
         }
         currentShape      = null;
         currentlyDragging = false;
     }
     else
     {
         ReturnToShapeQueue();
     }
 }
コード例 #5
0
    public void ApplyCurrentTetramino(int x, int y, float rotation = 0f)
    {
        ForecastShape _shape = forecastQueue.forecastShapes[0];

        for (int i = 0; i < _shape.tiles.Count; i++)
        {
            Vector2Int offs = RotateOffset(_shape.tiles[i].offset, rotation);
            if (_shape.tiles[i].type == ForecastType.Water)
            {
                state.AddWater(x + offs.x, y + offs.y, 1);
            }
            if (_shape.tiles[i].type == ForecastType.Sun)
            {
                state.AddSunlight(x + offs.x, y + offs.y, 1);
            }
        }
        forecastQueue.forecastShapes.RemoveAt(0);
    }
コード例 #6
0
    // public ForecastQueue forecastQueue;

    public void ApplyCurrentTetramino(ForecastShape _shape)
    {
        // Debug.Log("Applying!!!");
        int          x    = shapePositioning.currentOriginTile.x;
        int          y    = shapePositioning.currentOriginTile.y;
        ForecastType type = WeatherQueue.currentWeather;

        for (int i = 0; i < _shape.tiles.Count; i++)
        {
            Vector2Int offs = ShapePositioning.RotateOffset(_shape.tiles[i].offset, shapePositioning.rotation);
            // note that this is not using the type on the forecastTile (deprecated), but is instead using the current weather in the weatherqueue.
            if (_shape.tiles[i].type != ForecastType.None)
            {
                state.AddWeather(x + offs.x, y + offs.y, type, 1);
            }
            // if(_shape.tiles[i].type == ForecastType.Sun) state.AddSunlight(x+offs.x, y+offs.y, 1);
        }
    }