ballwar.model.strategy
Class CurveStrategy
java.lang.Object
ballwar.model.strategy.ANoOpStrategy
ballwar.model.strategy.CurveStrategy
- All Implemented Interfaces:
- IUpdateStrategy
public class CurveStrategy
- extends ANoOpStrategy
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 IRandomizer |
rand
Randomizer used to randomly generate the increment angle. |
Method Summary |
void |
updateState(Ball context)
Rotates the context's velocity by the specified angle. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
rand
private IRandomizer rand
- Randomizer used to randomly generate the increment angle.
angle
private double angle
- The incremental amount to rotate the context's velocity by each time its updateState is called (in radians).
CurveStrategy
public CurveStrategy()
updateState
public void updateState(Ball context)
- Rotates the context's velocity by the specified angle.
- Specified by:
updateState
in interface IUpdateStrategy
- Overrides:
updateState
in class ANoOpStrategy
- Parameters:
context
- The strategy's context