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