Example #1
0
 public static void initialize()
 {
     for (int a = 0; a < blockrenderers.Length; a++)
     {
         blockrenderers[a] = new BlockRenderer[Map.mapsize];
     }
 }
Example #2
0
        public static BlockRenderer spawnBlockRenderer(Block block, int x, int y, bool isprovisional)
        {
            BlockRenderer blockrenderer = null;

            switch (block.id)
            {
            case 1:
                blockrenderer = Main.main.blockrendererprefab_tree;
                break;

            case 2:
                blockrenderer = Main.main.blockrendererprefab_forest;
                break;

            case 3:
                blockrenderer = Main.main.blockrendererprefab_stone;
                break;

            case 4:
                blockrenderer = Main.main.blockrendererprefab_roadx;
                break;

            case 5:
                blockrenderer = Main.main.blockrendererprefab_roady;
                break;

            case 6:
                blockrenderer = Main.main.blockrendererprefab_roadlu;
                break;

            case 7:
                blockrenderer = Main.main.blockrendererprefab_roadru;
                break;

            case 8:
                blockrenderer = Main.main.blockrendererprefab_roadrd;
                break;

            case 9:
                blockrenderer = Main.main.blockrendererprefab_roadld;
                break;

            case 10:
                blockrenderer = Main.main.blockrendererprefab_roadlur;
                break;

            case 11:
                blockrenderer = Main.main.blockrendererprefab_roadrud;
                break;

            case 12:
                blockrenderer = Main.main.blockrendererprefab_roadldr;
                break;

            case 13:
                blockrenderer = Main.main.blockrendererprefab_roadlud;
                break;

            case 14:
                blockrenderer = Main.main.blockrendererprefab_roadc;
                break;

            case 15:
                blockrenderer = Main.main.blockrendererprefab_dirt;
                break;

            default:
                blockrenderer = Main.main.blockrendererprefab_grass;
                break;
            }
            blockrenderer = Instantiate(blockrenderer);
            blockrenderer.gameObject.transform.position = new Vector3(x + 0.5f, 0, y + 0.5f);
            blockrenderer.init(block.id, x, y, isprovisional);
            return(blockrenderers[x][y] = blockrenderer);
        }