Exemplo n.º 1
0
 private void Awake()
 {
     if (instance != null)
     {
         GameObject.Destroy(instance);
         Debug.LogError("additional instance of ShapePositioning found. Destroying the old one.");
     }
     instance = this;
 }
Exemplo n.º 2
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);
 }
Exemplo n.º 3
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);
        }
    }