|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectballwar.model.strategy.ANoOpStrategy
ballwar.model.strategy.LightUpStrategy
public class LightUpStrategy
An ANoOpStrategy-based strategy that switches its color to a preset "lit up" color for a while after a collision.
| Field Summary | |
|---|---|
private int |
_count
The count of how many cycles have passed since initially being lit up. |
private static Color |
_LitUpColor
The color when "lit up" |
private static int |
_LitUpDuration
The number of update cycles to remain "lit up". |
private Color |
_oldColor
The pre-lit-up color. |
| Fields inherited from interface ballwar.model.IUpdateStrategy |
|---|
NullObject |
| Constructor Summary | |
|---|---|
LightUpStrategy()
|
|
| Method Summary | |
|---|---|
void |
init(Ball context)
Saves the context's current color. |
void |
updateCollision(Ball context,
Ball target)
I the count is non-positive, saves the color of the context, sets the count to a preset value and sets the color of the context to a preset "lit up" value. |
void |
updateState(Ball context)
Updates the state of the context. |
| Methods inherited from class ballwar.model.strategy.ANoOpStrategy |
|---|
updateKill |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static int _LitUpDuration
private static Color _LitUpColor
private int _count
private Color _oldColor
| Constructor Detail |
|---|
public LightUpStrategy()
| Method Detail |
|---|
public void updateState(Ball context)
updateState in interface IUpdateStrategyupdateState in class ANoOpStrategycontext - The stategy's context.
public void updateCollision(Ball context,
Ball target)
updateCollision in interface IUpdateStrategyupdateCollision in class ANoOpStrategycontext - The strategy's context.target - The target ball that the context hit.public void init(Ball context)
init in interface IUpdateStrategyinit in class ANoOpStrategycontext - The context of the strategy
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||