Added untracked building files.
[alterverse.git] / src / org / alterverse / world / Building.java
blob06ecb84a8ee947130fa30273ea48bf6e9298f6bc
1 package org.alterverse.world;
3 public class Building extends GameObject {
4 public Building(Area area,double x, double y, double z) {
5 super(area,new Box(x,y,z,1.0,1.0,1.0));
6 setSolid(false);
9 public Story addStory() {
10 Story story;
11 if (numChildren() ==0)
12 story = new Story(this,x,y,z);
13 else
14 story = new Story(this,x,getChild(numChildren()-1).getY()+8.0,z);
15 addChild(story);
16 resize();
17 return story;
20 public void resize() {
21 double mx=0;
22 double my = 0;
23 double mz = 0;
24 for (int i = 0; i < numChildren(); i++) {
25 GameObject child = getChild(i);
26 if (child.maxX()>mx)
27 mx=child.MaxX();
28 if (child.maxY()>my)
29 my = child.maxY();
30 if (child.maxZ()>mz)
31 mz = child.maxZ();
33 setShape(new Box(x,y,z,mx,my+8.0,mz));