Beispiel #1
0
        void makeGlassBuilding()
        {
            // create textures
            Texture2D glass = generator.makeGlassTexture();

            // number of each block
            int numGlass = 5;

            // add glass blocks to cubes list
            for (int i = 0; i < numGlass; i++)
            {
                // position should vary
                Block block = new Block(cube, Vector3.Up * 2* i, Block.Type.Glass);
                block.Texture = glass;
                block.Parent = states[GameState.Play];
                block.BreakEvent += Broken;
                cubes.Add(block);
            }
        }
Beispiel #2
0
 // checks if block collided with another box
 public bool DidCollide(Block block)
 {
     // see: http://www.gamasutra.com/view/feature/131790/simple_intersection_tests_for_games.php?page=5
     return false;
 }
Beispiel #3
0
        void makeBuilding()
        {
            // create textures
            Texture2D glass = generator.makeGlassTexture();
            Texture2D wood = generator.makeWoodTexture();
            Texture2D stone = generator.makeMarbleTexture();

            // number of each block
            int numGlass = 1;
            int numWood = 1;
            int numStone = 1;

            // add glass blocks to cubes list
            for (int i = 0; i < numGlass; i++)
            {
                // position should vary
                Block block = new Block(cube, Vector3.Up * 2, Block.Type.Glass);
                block.Texture = glass;
                block.Parent = states[GameState.Play];
                block.BreakEvent += Broken;
                cubes.Add(block);
            }

            // add wood blocks to cubes list
            for (int i = 0; i < numWood; i++)
            {
                // position should vary
                Block block = new Block(cube, Vector3.Right, Block.Type.Wood);
                block.Texture = wood;
                block.Parent = states[GameState.Play];
                block.BreakEvent += Broken;
                cubes.Add(block);
            }

            // add stone blocks to cubes list
            for (int i = 0; i < numStone; i++)
            {
                // position should vary
                Block block = new Block(cube, Vector3.Left, Block.Type.Stone);
                block.Texture = stone;
                block.Parent = states[GameState.Play];
                block.BreakEvent += Broken;
                cubes.Add(block);
            }
        }