AI for Games 1.1.1
Loading...
Searching...
No Matches
game2dai.entities.Building Class Reference
Inheritance diagram for game2dai.entities.Building:

Classes

class  ELine
 

Public Member Functions

 Building (Vector2D[] contour)
 
 Building (Vector2D offset, Vector2D[] contour)
 
 Building (String name, Vector2D offset, Vector2D[] contour)
 
Wall[] walls ()
 
void walls (Wall[] walls)
 
Domain getExtent ()
 
boolean isOver (double px, double py)
 
boolean isEitherSide (double x0, double y0, double x1, double y1)
 
Vector2D[] contour ()
 
Vector2D[] expandedContour (double e)
 
Integer[] triangle ()
 
boolean isInDomain (Domain view)
 
String toString ()
 
- Public Member Functions inherited from game2dai.entities.BaseEntity
 BaseEntity ()
 
 BaseEntity (String name)
 
 BaseEntity (String entityName, Vector2D entityPos, double entityColRadius)
 
int ID ()
 
void updateFSM (double deltaTime, World world)
 
FiniteStateMachine FSM ()
 
boolean hasFSM ()
 
void addFSM ()
 
boolean removeFSM ()
 
int Z ()
 
BaseEntity Z (int z)
 
boolean isVisible ()
 
BaseEntity visible (boolean visible)
 
double colRadius ()
 
BaseEntity colRadius (double colRadius)
 
boolean isOverLapAllowed ()
 
BaseEntity overLapAllowed (boolean overLapAllowed)
 
boolean isInDomain (Domain view)
 
boolean isOver (double px, double py)
 
BaseEntity renderer (Picture renderer)
 
Picture renderer ()
 
void die (World world, double timeToLive)
 
void born (World world, double timeToLive)
 
BaseEntity moveTo (double x, double y)
 
BaseEntity moveTo (Vector2D p)
 
BaseEntity moveBy (double x, double y)
 
BaseEntity moveBy (Vector2D p)
 
Vector2D pos ()
 
BaseEntity name (String name)
 
String name ()
 
boolean isEitherSide (double x0, double y0, double x1, double y1)
 
boolean isEitherSide (Vector2D p0, Vector2D p1)
 
void update (double deltaTime, World world)
 
void draw (World world)
 
void draw (double elapsedTime, World world)
 
int compareTo (BaseEntity o)
 
String toString ()
 

Static Public Member Functions

static Building[] makeFromXML (PApplet app, String xmlFilename)
 
static Building[] makeFromXML (String xmlFilename)
 
static Building[] makeFromXML (File xmlFile)
 

Private Attributes

Wall[] walls = null
 
Vector2D[] contour
 
Integer[] triangle
 
double minX
 
double maxX
 
double minY
 
double maxY
 

Additional Inherited Members

- Public Attributes inherited from game2dai.entities.BaseEntity
String tag = ""
 
int tagNo = 0
 
- Protected Attributes inherited from game2dai.entities.BaseEntity
Integer entityID
 
String name = ""
 
Picture renderer = null
 
boolean visible = true
 
Vector2D pos = new Vector2D()
 
double colRadius
 
- Package Attributes inherited from game2dai.entities.BaseEntity
boolean overlapAllowed = false
 

Detailed Description

This class is used to represent a building.

Author
Peter Lager

Constructor & Destructor Documentation

◆ Building() [1/3]

game2dai.entities.Building.Building ( Vector2D[]  contour)

Create a building with the given contour.

Parameters
contouropen list (shape is automatically closed) of corners in counter-clockwise order

◆ Building() [2/3]

game2dai.entities.Building.Building ( Vector2D  offset,
Vector2D[]  contour 
)

Create a building with the given contour.

Parameters
offsetx/y to offset the contour data
contouropen list (shape is automatically closed) of corners in counter-clockwise order

◆ Building() [3/3]

game2dai.entities.Building.Building ( String  name,
Vector2D  offset,
Vector2D[]  contour 
)

Create a building with the given contour.

Parameters
namean optional name for the building
offsetx/y to offset the contour data
contouropen list (shape is automatically closed) of corners in counter-clockwise order

Member Function Documentation

◆ contour()

Vector2D[] game2dai.entities.Building.contour ( )

This is needed by any renderer you might want to create.

Returns
the contour

◆ expandedContour()

Vector2D[] game2dai.entities.Building.expandedContour ( double  e)

Get an expanded contour.

Parameters
ethe perpendicular distance between existent and expanded walls.
Returns
an array of vertices for the expanded contour.

◆ getExtent()

Domain game2dai.entities.Building.getExtent ( )

Get the rectangle that encompasses the building in world coordinates.

◆ isEitherSide()

boolean game2dai.entities.Building.isEitherSide ( double  x0,
double  y0,
double  x1,
double  y1 
)

Determines whether two world points are either side of a building. If they are then they cannot 'see' each other.

Parameters
x0
y0
x1
y1
Returns
true if the building is 'inbetween' the 2 points

Reimplemented from game2dai.entities.BaseEntity.

◆ isInDomain()

boolean game2dai.entities.Building.isInDomain ( Domain  view)

Determine whether this building is inside or part inside the domain. This method is used by the world draw method to see if this entity should be drawn.

Parameters
viewthe world domain
Returns
true if any part of this entity is inside the domain

Reimplemented from game2dai.entities.BaseEntity.

◆ isOver()

boolean game2dai.entities.Building.isOver ( double  px,
double  py 
)

Determines whether a world point is inside the building or not

Reimplemented from game2dai.entities.BaseEntity.

◆ makeFromXML() [1/3]

static Building[] game2dai.entities.Building.makeFromXML ( File  xmlFile)
static

Alternative if not using Processing

Parameters
xmlFileFile to parse
Returns
an array of Buildings

◆ makeFromXML() [2/3]

static Building[] game2dai.entities.Building.makeFromXML ( PApplet  app,
String  xmlFilename 
)
static

This is the one to use with Processing

Parameters
app
xmlFilename
Returns
an array of Buildings

◆ makeFromXML() [3/3]

static Building[] game2dai.entities.Building.makeFromXML ( String  xmlFilename)
static

Alternative if not using Processing

Parameters
xmlFilenamename of the file to parse
Returns
an array of Buildings

◆ toString()

String game2dai.entities.Building.toString ( )

Entity ID number and name returned as a String

Reimplemented from game2dai.entities.BaseEntity.

◆ triangle()

Integer[] game2dai.entities.Building.triangle ( )

This is needed by any renderer you might want to create.

Returns
the triangle

◆ walls() [1/2]

Wall[] game2dai.entities.Building.walls ( )
Returns
the walls

◆ walls() [2/2]

void game2dai.entities.Building.walls ( Wall[]  walls)
Parameters
wallsthe walls to set

The documentation for this class was generated from the following file: