Example #1
0
    public override void Generate(GridMaintaner gridMaintaner)
    {
        if (_pointOfInterestPrefabs.Count == 0)
        {
            GrabPOIPrefabs();
        }

        #region TEMP
        List <Vector2Int> points = gridMaintaner.GetComponent <TEMP_SpecificPointsOfInterest>().Points;
        foreach (Vector2Int point in points)
        {
            PointOfInterest   poi     = _pointOfInterestPrefabs[PointsOfInterest.POIType.DEAD_END];
            List <Vector2Int> offsets = poi.GetPointOffsets();
            foreach (Vector2Int offset in offsets)
            {
                TileAttributes attr = gridMaintaner.GetTileAt(point + offset);
                attr.SetOpenDirections(poi.GetOpenDirectionsOfTile(offset));
                attr.SetTileType(Attributes.TileType.POINT_OF_INTEREST);
            }
            TileAttributes ti = gridMaintaner.GetTileAt(point);
            ti.SetTileType(Attributes.TileType.POINT_OF_INTEREST_MAIN);
        }
        #endregion

        LogSuccess("points of interest");
    }
Example #2
0
    public override void Generate(GridMaintaner gridMaintaner)
    {
        TileAttributes tile = gridMaintaner.GetTileAt(Vector2Int.zero);

        tile.SetTileType(Attributes.TileType.STARTING_TILE);
        tile.SetOpenDirections(Attributes.OpenDirections.ALL);

        LogSuccess("first tile");
    }
    public override void InterpretAttributes(KeyValuePair <Vector2Int, TileAttributes> attributes)
    {
#if LOG_INTERPRETATION
        if (!attributes.Value.IsTileType(Attributes.TileType.STARTING_TILE))
        {
            Debug.LogWarning("[INTERPRETATION]: Attempted to interpret first tile attribute when first tile attribute was not present!");
            return;
        }
#endif
        Vector3 pos = GridMaintaner.GetGridPositionOf(attributes.Key);
        Instantiate(_firstTile, pos, Quaternion.identity);
        LogSuccess("first tile");
    }
    public override void InterpretAttributes(KeyValuePair <Vector2Int, TileAttributes> attributes)
    {
#if LOG_INTERPRETATION
        if (attributes.Value.GetTileType() < Attributes.TileType.POINT_OF_INTEREST)
        {
            Debug.LogWarning("[INTERPRETATION]: Attempted to interpret point of interest attibute when point of interest attribute was not present!");
            return;
        }
#endif

        Vector3 pos = GridMaintaner.GetGridPositionOf(attributes.Key);
        Instantiate(PointOfInterestGenerator.GetPointOfInterest((PointsOfInterest.POIType)attributes.Value.GetTileType()), pos, Quaternion.identity);
        LogSuccess("point of interest");
    }
    public void OnGeneratorsFinished(GridMaintaner grid)
    {
        Dictionary <Vector2Int, TileAttributes> attributes = grid.GetGridData();

        _tileInterpreters = GetComponents <TileInterpreter>();
        List <Generator.GeneratorType> types = grid.GetGeneratorTypes();

        foreach (KeyValuePair <Vector2Int, TileAttributes> tile in attributes)
        {
            foreach (TileInterpreter interpreter in _tileInterpreters)
            {
                if (types.Contains(interpreter.GetLinkedType()))
                {
                    interpreter.InterpretAttributes(tile);
                }
            }
        }

#if LOG_INTERPRETATION
        Debug.Log("[INTERPRETATION]: Tiles succesfully interpreted!");
#endif
    }
Example #6
0
 public override void Generate(GridMaintaner gridMaintaner)
 {
     LogSuccess("biomes");
 }
 public override void Generate(GridMaintaner gridMaintaner)
 {
     LogSuccess("empty tiles");
 }
Example #8
0
 public abstract void Generate(GridMaintaner gridMaintaner);