1 package erland.game.tileadventure;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 import erland.game.GameEnvironmentInterface;
22 import erland.util.ParameterValueStorageExInterface;
23 import erland.util.ParameterSerializable;
24
25 import java.awt.*;
26
27
28 public class RoomObject implements Cloneable, MapObjectInterface {
29 /*** The block container which the block exist in */
30 private IrregularBlockContainerInterface cont;
31 /*** The x position of the block */
32 private float posX;
33 /*** The y position of the block */
34 private float posY;
35 /*** The z position of the block */
36 private float posZ;
37 /*** The game environment of the block */
38 private GameEnvironmentInterface environment;
39 /*** The blocks in the room */
40 private MapObjectContainerInterface maps;
41 /*** The extended level info for the room */
42 private ParameterSerializable extendedLevelInfo;
43 /*** Bounding box */
44 private Box3D boundingBox;
45
46 public void init(GameEnvironmentInterface environment) {
47 this.environment = environment;
48 }
49
50 public void setContainer(IrregularBlockContainerInterface cont) {
51 this.cont = cont;
52 }
53
54 public IrregularBlockContainerInterface getContainer() {
55 return cont;
56 }
57
58 public float getPosX() {
59 return posX;
60 }
61
62 public float getPosY() {
63 return posY;
64 }
65
66 public float getPosZ() {
67 return posZ;
68 }
69
70 public void setPos(float x, float y, float z) {
71 this.posX = x;
72 this.posY = y;
73 this.posZ = z;
74 if(boundingBox!=null) {
75 boundingBox.setLocation(x,y,z);
76 boundingBox.setSize(999f,0.999f,0.999f);
77 }
78 }
79
80 public void draw(Graphics g) {
81
82 }
83
84 public Object clone() {
85 RoomObject b=null;
86 try {
87 b = (RoomObject)super.clone();
88 } catch (CloneNotSupportedException e) {
89 e.printStackTrace();
90 }
91 return b;
92 }
93
94 public void setBlocks(MapObjectContainerInterface maps) {
95 this.maps = maps;
96 }
97 public MapObjectContainerInterface getBlocks() {
98 return maps;
99 }
100
101 public void setExtendedLevelInfo(ParameterSerializable extendedLevelInfo) {
102 this.extendedLevelInfo = extendedLevelInfo;
103 }
104 public ParameterSerializable getExtendedLevelInfo() {
105 return extendedLevelInfo;
106 }
107
108 public Box3D getBoundingBox() {
109 if(boundingBox==null) {
110 boundingBox = new Box3D();
111 boundingBox.setLocation(posX,posY,posZ);
112 boundingBox.setSize(0.999f,0.999f,0.999f);
113 }
114 return boundingBox;
115 }
116 }
117