예제 #1
0
    //Builds the floor from the dungeon data
    public void BuildFloor()
    {
        var now = DateTime.Now;

        Level.Build();
        var end = DateTime.Now;

        Debug.Log($"It took {(end - now).TotalSeconds} to generate the level");
        sizeX = Level.Bounds.Width;
        sizeZ = Level.Bounds.Height;
        map   = new Roguelike.Tile[sizeX, sizeZ];
        for (int i = 0; i < sizeX; i++)
        {
            for (int j = 0; j < sizeZ; j++)
            {
                map[i, j] = new Roguelike.Tile();
            }
        }
        Level.Paint();
        ConstructTiles();

        AssignPlayerLocation();

        SetStairsLocation();
    }
예제 #2
0
    /// <summary>
    /// Applies a status effect to the entity on the specified tile.
    /// </summary>
    /// <param name="target">A Vector2Int specifying which tile to target</param>
    /// <param name="status">Enum located in BattleManager that corresponds to which status effect you want to apply</param>
    /// <param name="power">How much status to apply</param>
    /// <returns>True if there was something on this tile.</returns>
    public bool ApplyStatusEffectOnTile(Vector2Int target, BattleManager.StatusEffectEnum status, int power)
    {
        Debug.Log("Applying status effect " + status.ToString() + " on tile " + target + ", with power " + power);
        Roguelike.Tile targetTile  = map[target.x, target.y];
        TileCreature   tarCreature = targetTile.GetEntityOnTile() as TileCreature;

        if (tarCreature != null)
        {
            tarCreature.ApplyStatusEffect(status, power);
            return(true);
        }
        return(false);
    }
예제 #3
0
 private static bool IsEmpty(Roguelike.Tile tile)
 {
     return(tile.tileEntityType == Roguelike.Tile.TileEntityType.empty);
 }