예제 #1
0
        public void CreateRoom(float width, float length, float height)
        {
            Crate ground = new Crate(new Vector3(width, 4f, height));
            ground.Position = new Vector3(0f, -9f, 0f);
            ground.model = CrateModel;
            ground.Texture = Ground;
            ground.SelectedTexture = null;
            ground.InverseMass = 0;
            ground.Lock();
            AddToRoom(ground);

            Crate RightWall = new Crate(new Vector3(0.01f, length, height));
            RightWall.Position = new Vector3(width+0.01f, 5.01f, 0f);
            RightWall.model = CrateModel;
            RightWall.Texture = Wall;
            RightWall.SelectedTexture = null;
            RightWall.InverseMass = 0;
            RightWall.Lock();
            AddToRoom(RightWall);

            Crate FrontWall = new Crate(new Vector3(width, length, 0.01f));
            FrontWall.Position = new Vector3(0f, 5.01f, -(height + 0.01f));
            FrontWall.model = CrateModel;
            FrontWall.Texture = Game.Content.Load<Texture2D>(@"Textures\Wall");
            FrontWall.SelectedTexture = null;
            FrontWall.InverseMass = 0;
            FrontWall.Lock();
            AddToRoom(FrontWall);

            Crate LeftWall = new Crate(new Vector3(0.01f, length, height));
            LeftWall.Position = new Vector3(-(width+0.01f), 5.01f, 0f);
            LeftWall.model = CrateModel;
            LeftWall.Texture = Wall;
            LeftWall.SelectedTexture = null;
            LeftWall.InverseMass = 0;
            LeftWall.Lock();
            AddToRoom(LeftWall);

            Crate Slope = new Crate(new Vector3(width / 4, length - length / 4, 0.01f));
            Slope.Position = new Vector3(width - width / 4, length/4,  0f);
            Slope.AddScaledOrientation(new Vector3(-0.9f,0,0));
            Slope.model = CrateModel;
            Slope.Texture = Ground;
            Slope.SelectedTexture = null;
            Slope.InverseMass = 0;
            Slope.Lock();
            AddToRoom(Slope);

            Crate Roof = new Crate(new Vector3(width, 0.4f, height/4));
            Roof.Position = new Vector3(0, length / 2+length/4, -(height - height/4));
            Roof.model = CrateModel;
            Roof.Texture = Ground;
            Roof.SelectedTexture = null;
            Roof.InverseMass = 0;
            Roof.Lock();
            AddToRoom(Roof);

            Crate Stop = new Crate(new Vector3(width/4, 1f, 0.1f));
            Stop.Position = new Vector3(width - width / 4, -height/2 + 1, length);
            Stop.model = CrateModel;
            Stop.Texture = Ground;
            Stop.SelectedTexture = null;
            Stop.InverseMass = 0;
            Stop.Lock();
            AddToRoom(Stop);
        }