ballwar.model.strategy
Class ScoreStrategy
java.lang.Object
   ballwar.model.strategy.ANoOpStrategy
ballwar.model.strategy.ANoOpStrategy
       ballwar.model.strategy.ScoreStrategy
ballwar.model.strategy.ScoreStrategy
- All Implemented Interfaces: 
- IUpdateStrategy
- public class ScoreStrategy 
- extends ANoOpStrategy
An ANoOpStrategy-based strategy that increments an associated player's score at every collision 
 and resets that player's score if it is killed.   Note that more than one ScoreStrategy can be associated
 with any given player.
| Field Summary | 
| private  IPlayer | _playerThe IPlayer associated with this scoring strategy.
 | 
 
 
 
| Method Summary | 
|  void | init(Ball context)Associates this strategy with the currently selected player
 | 
|  void | updateCollision(Ball context,
                Ball target)Adds one to the associated player's score.
 | 
|  void | updateKill(Ball context)Sets the player's score to zero.
 | 
 
 
| Methods inherited from class java.lang.Object | 
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
 
_player
private IPlayer _player
- The IPlayer associated with this scoring strategy.
 
 
ScoreStrategy
public ScoreStrategy()
init
public void init(Ball context)
- Associates this strategy with the currently selected player
 
- 
- Specified by:
- initin interface- IUpdateStrategy
- Overrides:
- initin class- ANoOpStrategy
 
- 
- Parameters:
- context- This strategy's context.
 
updateCollision
public void updateCollision(Ball context,
                            Ball target)
- Adds one to the associated player's score.
 
- 
- Specified by:
- updateCollisionin interface- IUpdateStrategy
- Overrides:
- updateCollisionin class- ANoOpStrategy
 
- 
- Parameters:
- context- This strategy's context.
- target- The ball the context collided with.
 
updateKill
public void updateKill(Ball context)
- Sets the player's score to zero.   Does not kill the context ball.
 
- 
- Specified by:
- updateKillin interface- IUpdateStrategy
- Overrides:
- updateKillin class- ANoOpStrategy
 
- 
- Parameters:
- context- This strategy's context.