Package marauroa.server.game.rp
Class RPScheduler
java.lang.Object
marauroa.server.game.rp.RPScheduler
This class represents a scheduler to deliver action by turns, so every action
added to the scheduler is executed on the next turn. Each object can cast as
many actions as it wants.
We have two turns: actual and next one.
When we execute actions on actual turn, next turn become actual turn and the
process repeat.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
addRPAction(RPObject object, RPAction action, IRPRuleProcessor ruleProcessor)
Add an RPAction to the scheduler for the next turnvoid
clearRPActions(RPObject object)
This method clears the actions that may exist in actual turn or the next one for the giver object id.void
nextTurn()
This method moves to the next turn and deletes all the actions in the actual turnvoid
visit(IRPRuleProcessor ruleProcessor)
For each action in the actual turn, make it to be run in the ruleProcessor.
-
Constructor Details
-
RPScheduler
public RPScheduler()Constructor
-
-
Method Details
-
addRPAction
Add an RPAction to the scheduler for the next turn- Parameters:
object
- the object that casted the action.action
- the RPAction to add.ruleProcessor
- where the actions are going to checked.- Returns:
- true, if the action was added successfully, false otherwise
-
clearRPActions
This method clears the actions that may exist in actual turn or the next one for the giver object id.- Parameters:
object
- object to remove actions from.
-
visit
For each action in the actual turn, make it to be run in the ruleProcessor.- Parameters:
ruleProcessor
- the class that really run the action.
-
nextTurn
public void nextTurn()This method moves to the next turn and deletes all the actions in the actual turn
-