diff options
-rw-r--r-- | src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/ChangeFrequencyMoveEvent.java | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/ChangeFrequencyMoveEvent.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/ChangeFrequencyMoveEvent.java new file mode 100644 index 0000000..58117a5 --- /dev/null +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/ChangeFrequencyMoveEvent.java | |||
@@ -0,0 +1,36 @@ | |||
1 | /* | ||
2 | * To change this template, choose Tools | Templates | ||
3 | * and open the template in the editor. | ||
4 | */ | ||
5 | |||
6 | package com.fourisland.fourpuzzle.gamestate.mapview.event.specialmove; | ||
7 | |||
8 | import com.fourisland.fourpuzzle.gamestate.mapview.event.Event; | ||
9 | import com.fourisland.fourpuzzle.gamestate.mapview.event.LayerEvent; | ||
10 | |||
11 | /** | ||
12 | * ChangeFrequencyMoveEvent changes the walk frequency of an event; in other | ||
13 | * words, it changes how how often this event will initiate movement. The event | ||
14 | * must be a LayerEvent and the frequency must be larger than or equal to 1. | ||
15 | * | ||
16 | * @author hatkirby | ||
17 | */ | ||
18 | public class ChangeFrequencyMoveEvent implements MoveEvent { | ||
19 | |||
20 | private int freq; | ||
21 | public ChangeFrequencyMoveEvent(int freq) | ||
22 | { | ||
23 | this.freq = freq; | ||
24 | } | ||
25 | |||
26 | public void doAction(Event ev) | ||
27 | { | ||
28 | if (!(ev instanceof LayerEvent)) | ||
29 | { | ||
30 | throw new IllegalArgumentException(""); | ||
31 | } | ||
32 | |||
33 | ((LayerEvent) ev).setFrequency(freq); | ||
34 | } | ||
35 | |||
36 | } | ||