Class EntityEntityCollision
- java.lang.Object
-
- net.egartley.beyondorigins.core.logic.collision.EntityEntityCollision
-
public class EntityEntityCollision extends java.lang.Object
A collision between two different entities
-
-
Field Summary
Fields Modifier and Type Field Description EntityBoundary[]
boundaries
Entity[]
entities
Entities that are to collideprivate boolean
firedEvent
Whether or not the onCollide event has been firedboolean
isActive
Whether or not the collision is currently being usedboolean
isCollided
Whether or not the two entities are collidedboolean
isMovementRestricting
Whether or not the collision would impose movement restrictions, typically on the playerEntityEntityCollisionEvent
lastEvent
The collision's most recent eventprivate boolean
previouslyCollided
Prevents boundary colors from being set more than they have toprivate java.awt.Rectangle[]
rectangles
-
Constructor Summary
Constructors Constructor Description EntityEntityCollision(EntityBoundary boundary1, EntityBoundary boundary2)
Creates a new collision between two entity boundaries
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activate()
void
deactivate()
private void
determineBoundaryColor(EntityBoundary e)
private void
determineBoundaryColors(java.util.ArrayList<EntityBoundary> e)
void
end()
void
end(EntityEntityCollisionEvent event)
This is called once after the collision endsprivate void
onCollide()
Called right beforestart(EntityEntityCollisionEvent)
private void
onCollisionEnd()
Called right beforeend(EntityEntityCollisionEvent)
private void
setBoundaryColors()
Sets or updates the colors for both boundariesvoid
start(EntityEntityCollisionEvent event)
This is called once after the collision occursvoid
tick()
Updates coordinates, then checks for collision between the entitiesjava.lang.String
toString()
-
-
-
Field Detail
-
previouslyCollided
private boolean previouslyCollided
Prevents boundary colors from being set more than they have to
-
firedEvent
private boolean firedEvent
Whether or not the onCollide event has been fired
-
isCollided
public boolean isCollided
Whether or not the two entities are collided
-
isActive
public boolean isActive
Whether or not the collision is currently being used
-
isMovementRestricting
public boolean isMovementRestricting
Whether or not the collision would impose movement restrictions, typically on the player
-
rectangles
private final java.awt.Rectangle[] rectangles
-
lastEvent
public EntityEntityCollisionEvent lastEvent
The collision's most recent event
-
boundaries
public EntityBoundary[] boundaries
-
entities
public Entity[] entities
Entities that are to collide
-
-
Constructor Detail
-
EntityEntityCollision
public EntityEntityCollision(EntityBoundary boundary1, EntityBoundary boundary2)
Creates a new collision between two entity boundaries- Parameters:
boundary1
- First entity's boundaryboundary2
- Second entity's boundary
-
-
Method Detail
-
tick
public void tick()
Updates coordinates, then checks for collision between the entities
-
start
public void start(EntityEntityCollisionEvent event)
This is called once after the collision occurs- Parameters:
event
- The collision's event
-
end
public void end(EntityEntityCollisionEvent event)
This is called once after the collision ends- Parameters:
event
- The collision's event
-
end
public void end()
-
deactivate
public void deactivate()
-
activate
public void activate()
-
setBoundaryColors
private void setBoundaryColors()
Sets or updates the colors for both boundaries
-
determineBoundaryColors
private void determineBoundaryColors(java.util.ArrayList<EntityBoundary> e)
-
determineBoundaryColor
private void determineBoundaryColor(EntityBoundary e)
-
onCollide
private void onCollide()
Called right beforestart(EntityEntityCollisionEvent)
-
onCollisionEnd
private void onCollisionEnd()
Called right beforeend(EntityEntityCollisionEvent)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-