|
||||||||||
| 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.CurveStrategy
public class CurveStrategy
ANoOpStrategy-based strategy that continuously modifies the velocity to produce circular motion.
| Field Summary | |
|---|---|
private double |
angle
The incremental amount to rotate the context's velocity by each time its updateState is called (in radians). |
private double |
cosA
Precalculated value of cos(angle) |
private IRandomizer |
rand
Randomizer used to randomly generate the increment angle. |
private double |
sinA
Pre-calculated value of sin(angle) |
| Fields inherited from interface ballwar.model.IUpdateStrategy |
|---|
NullObject |
| Constructor Summary | |
|---|---|
CurveStrategy()
|
|
| Method Summary | |
|---|---|
void |
updateState(Ball context)
Rotates the context's velocity by the specified angle. |
| Methods inherited from class ballwar.model.strategy.ANoOpStrategy |
|---|
init, updateCollision, updateKill |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private IRandomizer rand
private double angle
private double cosA
private double sinA
| Constructor Detail |
|---|
public CurveStrategy()
| Method Detail |
|---|
public void updateState(Ball context)
updateState in interface IUpdateStrategyupdateState in class ANoOpStrategycontext - The strategy's context
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||