示例#1
0
    Block CreateBlock()
    {
        string blockType = GetComponent <PrefabBlockTexture>().blockType;
        Block  block;

        switch (blockType)
        {
        case "Stone":
            block = new Block();
            break;

        case "Grass":
            block = new BlockGrass();
            break;

        case "BrownWood":
            block = new BlockBrownWood();
            break;

        case "Lava":
            block = new BlockLava();
            break;

        case "GreenLeaves":
            block = new BlockGreenLeaves();
            break;

        case "OrangeLeaves":
            block = new BlockOrangeLeaves();
            break;

        case "StoneSnow":
            block = new BlockStoneSnow();
            break;

        case "Ice":
            block = new BlockIce();
            break;

        case "Glass":
            block = new BlockGlass();
            break;

        case "WhiteWood":
            block = new BlockWhiteWood();
            break;

        case "Apple":
            block = new BlockApple();
            break;

        case "Alphabet":
            block = new BlockAlphabet();
            break;

        case "Amazon":
            block = new BlockAmazon();
            break;

        case "Facebook":
            block = new BlockFacebook();
            break;

        case "IBM":
            block = new BlockIBM();
            break;

        case "Intel":
            block = new BlockIntel();
            break;

        case "Microsoft":
            block = new BlockMicrosoft();
            break;

        case "Netflix":
            block = new BlockNetflix();
            break;

        case "Twitter":
            block = new BlockTwitter();
            break;

        case "Yahoo":
            block = new BlockYahoo();
            break;

        default:
            block = new BlockAir();
            break;
        }
        block.upsideDown = GetComponent <PrefabBlockTexture>().upsideDown;
        return(block);
    }
示例#2
0
    public virtual Block.Tile TexturePosition(Block.Direction direction)
    {
        Block.Tile tile = new Block.Tile();

        switch (blockType)
        {
        case "Stone":
            Block blockStone = new Block();
            blockStone.upsideDown = upsideDown;
            tile = blockStone.TexturePosition(direction);
            return(tile);

        case "Grass":
            BlockGrass blockGrass = new BlockGrass();
            blockGrass.upsideDown = upsideDown;
            tile = blockGrass.TexturePosition(direction);
            return(tile);

        case "BrownWood":
            BlockBrownWood blockBrownWood = new BlockBrownWood();
            blockBrownWood.upsideDown = upsideDown;
            tile = blockBrownWood.TexturePosition(direction);
            return(tile);

        case "Lava":
            BlockLava blockLava = new BlockLava();
            blockLava.upsideDown = upsideDown;
            tile = blockLava.TexturePosition(direction);
            return(tile);

        case "GreenLeaves":
            BlockGreenLeaves blockGreenLeaves = new BlockGreenLeaves();
            blockGreenLeaves.upsideDown = upsideDown;
            tile = blockGreenLeaves.TexturePosition(direction);
            return(tile);

        case "OrangeLeaves":
            BlockOrangeLeaves blockOrangeLeaves = new BlockOrangeLeaves();
            blockOrangeLeaves.upsideDown = upsideDown;
            tile = blockOrangeLeaves.TexturePosition(direction);
            return(tile);

        case "StoneSnow":
            BlockStoneSnow blockStoneSnow = new BlockStoneSnow();
            blockStoneSnow.upsideDown = upsideDown;
            tile = blockStoneSnow.TexturePosition(direction);
            return(tile);

        case "Ice":
            BlockIce blockIce = new BlockIce();
            blockIce.upsideDown = upsideDown;
            tile = blockIce.TexturePosition(direction);
            return(tile);

        case "Glass":
            BlockGlass blockGlass = new BlockGlass();
            blockGlass.upsideDown = upsideDown;
            tile = blockGlass.TexturePosition(direction);
            return(tile);

        case "WhiteWood":
            BlockWhiteWood blockWhiteWood = new BlockWhiteWood();
            blockWhiteWood.upsideDown = upsideDown;
            tile = blockWhiteWood.TexturePosition(direction);
            return(tile);

        case "Apple":
            BlockApple blockApple = new BlockApple();
            blockApple.upsideDown = upsideDown;
            tile = blockApple.TexturePosition(direction);
            return(tile);

        case "Alphabet":
            BlockAlphabet blockAlphabet = new BlockAlphabet();
            blockAlphabet.upsideDown = upsideDown;
            tile = blockAlphabet.TexturePosition(direction);
            return(tile);

        case "Amazon":
            BlockAmazon blockAmazon = new BlockAmazon();
            blockAmazon.upsideDown = upsideDown;
            tile = blockAmazon.TexturePosition(direction);
            return(tile);

        case "Facebook":
            BlockFacebook blockFacebook = new BlockFacebook();
            blockFacebook.upsideDown = upsideDown;
            tile = blockFacebook.TexturePosition(direction);
            return(tile);

        case "IBM":
            BlockIBM blockIBM = new BlockIBM();
            blockIBM.upsideDown = upsideDown;
            tile = blockIBM.TexturePosition(direction);
            return(tile);

        case "Intel":
            BlockIntel blockIntel = new BlockIntel();
            blockIntel.upsideDown = upsideDown;
            tile = blockIntel.TexturePosition(direction);
            return(tile);

        case "Microsoft":
            BlockMicrosoft blockMicrosoft = new BlockMicrosoft();
            blockMicrosoft.upsideDown = upsideDown;
            tile = blockMicrosoft.TexturePosition(direction);
            return(tile);

        case "Netflix":
            BlockNetflix blockNetflix = new BlockNetflix();
            blockNetflix.upsideDown = upsideDown;
            tile = blockNetflix.TexturePosition(direction);
            return(tile);

        case "Twitter":
            BlockTwitter blockTwitter = new BlockTwitter();
            blockTwitter.upsideDown = upsideDown;
            tile = blockTwitter.TexturePosition(direction);
            return(tile);

        case "Yahoo":
            BlockYahoo blockYahoo = new BlockYahoo();
            blockYahoo.upsideDown = upsideDown;
            tile = blockYahoo.TexturePosition(direction);
            return(tile);

        case "Leaves0":
            BlockLeaves0 blockLeaves0 = new BlockLeaves0();
            blockLeaves0.upsideDown = upsideDown;
            tile = blockLeaves0.TexturePosition(direction);
            return(tile);

        case "Leaves1":
            BlockLeaves1 blockLeaves1 = new BlockLeaves1();
            blockLeaves1.upsideDown = upsideDown;
            tile = blockLeaves1.TexturePosition(direction);
            return(tile);

        case "Leaves2":
            BlockLeaves2 blockLeaves2 = new BlockLeaves2();
            blockLeaves2.upsideDown = upsideDown;
            tile = blockLeaves2.TexturePosition(direction);
            return(tile);

        case "Leaves3":
            BlockLeaves3 blockLeaves3 = new BlockLeaves3();
            blockLeaves3.upsideDown = upsideDown;
            tile = blockLeaves3.TexturePosition(direction);
            return(tile);

        case "Leaves4":
            BlockLeaves4 blockLeaves4 = new BlockLeaves4();
            blockLeaves4.upsideDown = upsideDown;
            tile = blockLeaves4.TexturePosition(direction);
            return(tile);
        }
        //just in case it's not registered
        Block blockAir = new BlockAir();

        tile = blockAir.TexturePosition(direction);
        return(tile);
    }