Ejemplo n.º 1
0
    /*
     *      The dungeon generator will place the stairs, then the direction and finally check for a suitable spawn location, which will be the first non
     *  occupied space it surrounds.
     *      The stairs will always be placed in first and last room, first room goes up, last room goes down.
     *      Except for first and last floor, since first won't have stairs going up and last won't have stairs going down.
     *      Once the stairs are fully spawned, the ready method will run.
     *      This will set the sprite for the stairs depending on it's direction.
     *      when player walks up to the stairs a few things will happen.
     *      The current floor will change depending on the direction.
     *      All parts of the grid will be freed, doors, chests, enemies, the grid itself.
     *      Once that is cleared a new grid will be set.
     */

    public void InitializeStair(Grid _grid, Vector2 _positionToSet, StairDirection _direction)
    {
        grid = _grid;

        positionToSet     = _positionToSet;
        gridPosition      = new Vector2(Mathf.FloorToInt(positionToSet.x / 16), Mathf.FloorToInt(positionToSet.y / 16));
        SelectedDirection = _direction;
    }
Ejemplo n.º 2
0
 public Stairs(StairDirection direction)
 {
     Direction = direction;
 }
Ejemplo n.º 3
0
 protected virtual List <KeyValuePair <MapCoordinate, Stairs> > GetStairs(IMap map, StairDirection direction, IEntityEngine engine)
 {
     return(engine.EntitiesWith <Stairs>()
            .Where(e => e.Get <Position>().MapCoordinate.Key == map.MapKey)
            .Where(c => c.Get <Stairs>().Direction == direction)
            .Select(c => new KeyValuePair <MapCoordinate, Stairs>(c.Get <Position>().MapCoordinate, c.Get <Stairs>()))
            .ToList());
 }