|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectes.ucm.fdi.hysteria.game.Obstacle
public class Obstacle
Field Summary | |
---|---|
protected java.lang.String |
_desc
Obstacle description |
protected boolean |
_enabled
Is the obstacle enabled? |
protected java.util.Set<Item> |
_keys
Set of keys needed for interact with this obstacle |
protected boolean |
_needKeys
The obstacle needs keys to be interacted with? |
protected java.util.LinkedHashSet<Obstacle> |
_related
Set of obstacles affected by this one |
Constructor Summary | |
---|---|
Obstacle(java.lang.String desc)
Builds a default disabled obstacle, with a given description |
|
Obstacle(java.lang.String desc,
boolean state)
Builds an obstacle with a given description and a given state, but no keys |
|
Obstacle(java.lang.String desc,
boolean state,
java.util.Set<Item> keys)
Builds an obstacle with a given description, a given state and a given set of keys |
Method Summary | |
---|---|
void |
addKey(Item key)
It adds a given key to the obstacle, and changes it's behaviour if needed |
void |
addRelatedObstacle(Obstacle related)
Adds an obstacle to the list of affected ones. |
java.lang.String |
getDescription()
The obstacle description |
protected void |
initPropagation(Obstacle origin)
It inits the propagation to the affected obstacles |
boolean |
invertState()
It changes the state to it's contrary |
boolean |
invertState(Item key)
It changes the state to it's contrary using an item |
boolean |
isEnabled()
The obstacle is enabled? |
boolean |
isKeyTo(Item key)
The obstacle doesn't need keys to be interacted with? |
boolean |
isSimpleLocked()
The obstacle doesn't need keys to be interacted with? |
protected void |
propagateChanges(java.util.Deque<Obstacle> origin,
Obstacle actual)
Recursive method that changes the state of affected obstacles, and does so for the new affected. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected boolean _enabled
protected boolean _needKeys
protected java.lang.String _desc
protected java.util.Set<Item> _keys
protected java.util.LinkedHashSet<Obstacle> _related
Constructor Detail |
---|
public Obstacle(java.lang.String desc)
desc
- Descriptionpublic Obstacle(java.lang.String desc, boolean state)
desc
- Descriptionstate
- Is enabled?public Obstacle(java.lang.String desc, boolean state, java.util.Set<Item> keys)
desc
- Descriptionstate
- Is enabled?keys
- The keysMethod Detail |
---|
public boolean isSimpleLocked()
public boolean isEnabled()
public java.lang.String getDescription()
public boolean isKeyTo(Item key) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public void addKey(Item key) throws java.lang.IllegalArgumentException
key
- The key
java.lang.IllegalArgumentException
public void addRelatedObstacle(Obstacle related) throws java.lang.IllegalArgumentException
related
- The obstacle
java.lang.IllegalArgumentException
public boolean invertState() throws ObstacleNeedsAKeyException
ObstacleNeedsAKeyException
public boolean invertState(Item key) throws ObstacleDoesntNeedKeyException, java.lang.IllegalArgumentException
key
- The key
ObstacleDoesntNeedKeyException
java.lang.IllegalArgumentException
protected void initPropagation(Obstacle origin)
origin
- The initial obstacleprotected void propagateChanges(java.util.Deque<Obstacle> origin, Obstacle actual)
origin
- The list of origin obstaclesactual
- The actual affected obstacle
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |