Class Building
- java.lang.Object
-
- net.egartley.beyondorigins.core.abstracts.Renderable
-
- net.egartley.beyondorigins.core.abstracts.Entity
-
- net.egartley.beyondorigins.core.abstracts.StaticEntity
-
- net.egartley.beyondorigins.ingame.Building
-
- All Implemented Interfaces:
Tickable
- Direct Known Subclasses:
House1
public class Building extends StaticEntity
A place that the player can enter, treated seperately from the current map
-
-
Field Summary
Fields Modifier and Type Field Description BuildingFloor
currentFloor
EntityBoundary
entryBoundary
BuildingFloor
entryFloor
java.util.ArrayList<BuildingFloor>
floors
int
playerLeaveX
int
playerLeaveY
-
Fields inherited from class net.egartley.beyondorigins.core.abstracts.Entity
boundaries, canCollide, defaultBoundary, deltaX, deltaY, DIRECTION_DOWN, DIRECTION_LEFT, DIRECTION_RIGHT, DIRECTION_UP, firstLayer, health, image, interactions, inventory, isAllowedToMoveDownwards, isAllowedToMoveLeftwards, isAllowedToMoveRightwards, isAllowedToMoveUpwards, isAnimated, isCollided, isDualRendered, isMovingDownwards, isMovingLeftwards, isMovingRightwards, isMovingUpwards, isSectorSpecific, isTraversable, lastCollision, lastCollisionEvent, maximumHealth, name, secondLayer, sheets, speed, sprite, sprites, uuid
-
-
Constructor Summary
Constructors Constructor Description Building(java.lang.String id, int x, int y, int playerLeaveX, int playerLeaveY)
Creates a new building
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addFloor(BuildingFloor floor)
Add a floor to the building.void
changeFloor(BuildingFloor floor)
Move the player from the current floor to another, settingcurrentFloor
to that new onevoid
downstairs()
Change the floor to the one below it (warning if already at bottom floor)void
onPlayerEnter()
Called when the player enters the buildingvoid
onPlayerLeave()
Called when the player leaves the buildingprotected void
setBoundaries()
Sets the entity's boundariesvoid
setCollisions()
Sets the entity's collisionsprotected void
setInteractions()
Sets the entity's interactionsvoid
upstairs()
Change the floor to the one above it (warning if already at top floor)-
Methods inherited from class net.egartley.beyondorigins.core.abstracts.Entity
allowAllMovement, drawDebug, drawFirstLayer, drawSecondLayer, move, onMove, onSectorEnter, onSectorLeave, render, setPosition, setSprite, setSprite, setSprites, tick, toString, x, x, y, y
-
Methods inherited from class net.egartley.beyondorigins.core.abstracts.Renderable
x, y
-
-
-
-
Field Detail
-
playerLeaveX
public int playerLeaveX
-
playerLeaveY
public int playerLeaveY
-
entryBoundary
public EntityBoundary entryBoundary
-
entryFloor
public BuildingFloor entryFloor
-
currentFloor
public BuildingFloor currentFloor
-
floors
public java.util.ArrayList<BuildingFloor> floors
-
-
Constructor Detail
-
Building
public Building(java.lang.String id, int x, int y, int playerLeaveX, int playerLeaveY)
Creates a new building- Parameters:
id
- Identifier for the buildingx
- The x-coordinate of where to render ity
- The y-coordinate of where to render itplayerLeaveX
- The x-coordinate of where to put the player when they leaveplayerLeaveY
- The y-coordinate of where to put the player when they leave
-
-
Method Detail
-
addFloor
public void addFloor(BuildingFloor floor)
Add a floor to the building. SetsentryFloor
andcurrentFloor
if this is the first one to be added- Parameters:
floor
- The floor to add
-
changeFloor
public void changeFloor(BuildingFloor floor)
Move the player from the current floor to another, settingcurrentFloor
to that new one- Parameters:
floor
- The floor to move to- See Also:
BuildingFloor.onPlayerLeave()
,BuildingFloor.onPlayerEnter(BuildingFloor)
-
onPlayerEnter
public void onPlayerEnter()
Called when the player enters the building- See Also:
entryFloor
,entryBoundary
,Player.enteredBuilding()
-
onPlayerLeave
public void onPlayerLeave()
Called when the player leaves the building- See Also:
playerLeaveX
,playerLeaveY
,Player.leftBuilding(Building)
-
upstairs
public void upstairs()
Change the floor to the one above it (warning if already at top floor)
-
downstairs
public void downstairs()
Change the floor to the one below it (warning if already at bottom floor)
-
setBoundaries
protected void setBoundaries()
Description copied from class:Entity
Sets the entity's boundaries- Specified by:
setBoundaries
in classEntity
- See Also:
Entity.boundaries
-
setCollisions
public void setCollisions()
Description copied from class:Entity
Sets the entity's collisions- Specified by:
setCollisions
in classEntity
- See Also:
Entity.boundaries
-
setInteractions
protected void setInteractions()
Description copied from class:Entity
Sets the entity's interactions- Specified by:
setInteractions
in classEntity
- See Also:
Entity.interactions
-
-