summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/tankontank/game/GameStateNone.java
blob: 61a9d210881d36f1359585bc77784d998d050ddd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package ch.asynk.tankontank.game;

import ch.asynk.tankontank.game.Map;

public class GameStateNone extends GameStateCommon
{
    public GameStateNone()
    {
        super();
    }

    public GameStateNone(GameCtrl ctrl, Map map)
    {
        super(ctrl, map);
    }

    @Override
    public boolean drag(float dx, float dy)
    {
        return false;
    }

    @Override
    public void touchDown()
    {
        System.out.println("GameStateNone: touchDown()");
        if (map.isInPossibleMoves(downHex)) {
            ctrl.setState(State.PATH, true);
        } else {
            unselectHex();
            setHex();
            selectHex();
            if (hexHasUnit()) {
                setPawn();
                map.showPossibleActions(pawn, hex, true);
            } else {
                map.showPossibleActions(pawn, hex, false);
            }
        }
    }

    @Override
    public void touchUp()
    {
        System.out.println("GameStateNone: touchUp()");
        if (!hexHasUnit())
            unselectHex();
    }

    @Override
    public void abort()
    {
        System.err.println("GameStateNone: abort");
    }
}