1 package cz.cuni.amis.pogamut.defcon.communication.messages.infos;
2
3 import cz.cuni.amis.pogamut.defcon.base3d.worldview.object.DefConLocation;
4 import cz.cuni.amis.pogamut.defcon.communication.messages.Updatable;
5 import cz.cuni.amis.pogamut.defcon.consts.UnitType;
6 import cz.cuni.amis.pogamut.defcon.consts.state.IState;
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 public class DefConUnitObject<T extends IState> extends DefConViewableObject {
24
25
26
27 @Updatable
28 private T state;
29
30
31
32
33 @Updatable
34 private int stateCount;
35
36
37
38
39 @Updatable
40 private int target;
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55 public DefConUnitObject(int id, UnitType type, int teamId, DefConLocation location,
56 boolean visible, T state, int stateCount, int target, double time) {
57 super(id, type, teamId, location, visible, time);
58
59 this.state = state;
60 this.stateCount = stateCount;
61 this.target = target;
62 }
63
64
65
66
67
68
69 public DefConUnitObject(DefConUnitObject<T> original) {
70 super(original);
71
72 this.state = original.state;
73 this.stateCount = original.stateCount;
74 this.target = original.target;
75 }
76
77
78
79
80
81
82 public T getState() {
83 return state;
84 }
85
86
87
88
89
90
91 protected void setState(T state) {
92 this.state = state;
93 }
94
95
96
97
98
99
100 public int getStateCount() {
101 return stateCount;
102 }
103
104
105
106
107
108
109 protected void setStateCount(int stateCount) {
110 this.stateCount = stateCount;
111 }
112
113
114
115
116
117
118 public int getTarget() {
119 return target;
120 }
121
122
123
124
125
126
127 protected void setTarget(int target) {
128 this.target = target;
129 }
130
131
132
133
134
135
136 @Override
137 public String getStringizedFields() {
138 return super.getStringizedFields() + "; state: " +
139 ((state != null) ? state.toString() : "none") + "; stateCount: " + stateCount +
140 "; target: " + target;
141 }
142 }