Example #1
0
    void setBoardIDandSpecialMaterialBlcok()
    {
        RFIB.setBoardBlockMappingArray(1, "0101");
        RFIB.setBoardBlockMappingArray(2, "0201");
        RFIB.setBoardBlockMappingArray(3, "0301");

        RFIB.setBoardBlockMappingArray(4, "0102");
        RFIB.setBoardBlockMappingArray(5, "0202");
        RFIB.setBoardBlockMappingArray(6, "0302");

        RFIB.setBoardBlockMappingArray(7, "0103");
        RFIB.setBoardBlockMappingArray(8, "0203");
        RFIB.setBoardBlockMappingArray(9, "0303");


        int[] Cube_StreetA   = { 940104 };
        int[] Cube_topLavaA  = { 920135, 920143, 910112, 910173, 920120, 910128 };
        int[] Cube_RedBrickA = { 910109, 920119, 920134, 920117, 910174, 910175 };
        int[] Cube_cr010A    = { 940103 };
        int[] Cube_cr016A    = { 940101 };
        int[] Cube_GrassA    = { 940102 };


        foreach (int xID in Cube_GrassA)
        {
            Cube_Grass.Add(xID);
        }
        foreach (int xID in Cube_cr016A)
        {
            Cube_cr016.Add(xID);
        }
        foreach (int xID in Cube_StreetA)
        {
            Cube_Street.Add(xID);
        }
        foreach (int xID in Cube_topLavaA)
        {
            Cube_topLava.Add(xID);
        }

        foreach (int xID in Cube_RedBrickA)
        {
            Cube_RedBrick.Add(xID);
        }

        foreach (int xID in Cube_cr010A)
        {
            Cube_cr010.Add(xID);
        }
    }
Example #2
0
    private void DrawTheObjectXYZ(int blockID, int BlockType, int X, int Y, int Z)
    {
        Color tmpColor      = new Color(255, 0, 0);
        Color tmpBoardColor = new Color(255, 0, 0);
        int   pureBlockSN   = blockID % 100;

        for (int z = 0; z < 10; z++)
        {
            for (int y = -boxNumY * 2; y < boxNumY * 2; y++)
            {
                for (int x = -boxNumX * 2; x < boxNumX * 2; x++)
                {
                    if (x == X && y == Y && z == Z)
                    {
                        //========== Set Color ================
                        if (BlockType == 8701 || BlockType == 8601 || BlockType == 8602 || BlockType == 8603 || BlockType == 8604 || BlockType == 8501 || BlockType == 801 || BlockType == 8301 || BlockType == 8201 || BlockType == 8101 || BlockType == 8401)
                        {
                        }
                        else if ((BlockType >= 9100 && BlockType < 9500) || (BlockType >= 7100 && BlockType <= 7500))
                        {
                            int blockIDa = BlockType - BlockType % 100 - 9000;
                            if (blockIDa == 100)
                            {
                                tmpColor = new Color(0, 0, 0); tmpBoardColor = new Color(0, 0, 0);
                            }                                                                                                                        //Black
                            else if (blockIDa == 200)
                            {
                                tmpColor = new Color(255, 255, 255); tmpBoardColor = new Color(100, 100, 100);
                            }                                                                                                                                         //White
                            else if (blockIDa == 300)
                            {
                                tmpColor = new Color(100, 100, 100);
                            }                                                                                               //Gray
                            else if (blockIDa == 400)
                            {
                                tmpColor = new Color(255, 0, 0);
                            }                                                                                           //Red
                        }
                        else if (BlockType == 9601 || BlockType == 9602 || BlockType == 9603 || BlockType == 9604 || BlockType == 9701 || BlockType == 8602 || BlockType == 8603 || BlockType == 8604)
                        {
                        }
                        else
                        {
                        }

                        //========== Draw Object ================
                        //print("DrawTheObjectXYZ():" + blockID + "-" + X + "-" + Y + "-" + Z);



                        if (cubes_Blocks.ContainsKey(blockID) == false)
                        {
                            if (blockID == 910111)
                            {
                                cubes_Blocks.Add(blockID, GameObject.Instantiate(Resources.Load("CubeB1")) as GameObject);
                                cubes_Blocks[blockID].name = "Block-" + blockID;
                                float scale = 1f;
                                //, offset = 0f;
                                cubes_Blocks[blockID].transform.Translate(new Vector3(-X * scale, Z * scale, Y * scale));
                            }
                            else if (blockID == 920172)
                            {
                                cubes_Blocks.Add(blockID, GameObject.Instantiate(Resources.Load("CubeG1")) as GameObject);
                                cubes_Blocks[blockID].name = "Block-" + blockID;
                                float scale = 1f;
                                //, offset = 0f;
                                cubes_Blocks[blockID].transform.Translate(new Vector3(-X * scale, Z * scale, Y * scale));
                            }
                            else if (blockID == 920170)
                            {
                                cubes_Blocks.Add(blockID, GameObject.Instantiate(Resources.Load("CubeR1")) as GameObject);
                                cubes_Blocks[blockID].name = "Block-" + blockID;
                                float scale = 1f;
                                //, offset = 0f;
                                cubes_Blocks[blockID].transform.Translate(new Vector3(-X * scale, Z * scale, Y * scale));
                            }
                            else if (blockID == 920171)
                            {
                                cubes_Blocks.Add(blockID, GameObject.Instantiate(Resources.Load("CubeB1")) as GameObject);
                                cubes_Blocks[blockID].name = "Block-" + blockID;
                                float scale = 1f;
                                //, offset = 0f;
                                cubes_Blocks[blockID].transform.Translate(new Vector3(-X * scale, Z * scale, Y * scale));
                            }
                            else if (Cube_cr016.Contains(blockID))
                            {
                                cubes_Blocks.Add(blockID, GameObject.Instantiate(Resources.Load("Cube_cr016")) as GameObject);
                                cubes_Blocks[blockID].name = "Block-" + blockID;
                                float scale = 1f;
                                //, offset = 0f;
                                cubes_Blocks[blockID].transform.Translate(new Vector3((-X) * scale, Z * scale, (Y)*scale));
                                cubes_Blocks[blockID].transform.Rotate(new Vector3(0, (RFIB.getDataStackOrderIn3D(blockID, "FacingDirect") - 2) * 90, 0));
                                if (blockID == 920136)
                                {
                                    cubes_Blocks[blockID].transform.Rotate(new Vector3(0, -90, 0));
                                }
                            }
                            else if (Cube_cr010.Contains(blockID))
                            {
                                cubes_Blocks.Add(blockID, GameObject.Instantiate(Resources.Load("Cube_cr010")) as GameObject);
                                cubes_Blocks[blockID].name = "Block-" + blockID;
                                float scale = 1f;
                                //, offset = 0f;
                                cubes_Blocks[blockID].transform.Translate(new Vector3((-X) * scale, Z * scale, (Y)*scale));

                                cubes_Blocks[blockID].transform.Rotate(new Vector3(0, (RFIB.getDataStackOrderIn3D(blockID, "FacingDirect") - 2) * 90, 0));
                                if (blockID == 910105)
                                {
                                    cubes_Blocks[blockID].transform.Rotate(new Vector3(0, 90, 0));
                                }
                                if (blockID == 920121)
                                {
                                    cubes_Blocks[blockID].transform.Rotate(new Vector3(0, 180, 0));
                                }
                            }
                            else if (Cube_topLava.Contains(blockID))
                            {
                                cubes_Blocks.Add(blockID, GameObject.Instantiate(Resources.Load("Cube_topLava")) as GameObject);
                                cubes_Blocks[blockID].name = "Block-" + blockID;
                                float scale = 1f;
                                //, offset = 0f;
                                cubes_Blocks[blockID].transform.Translate(new Vector3(-X * scale, Z * scale, Y * scale));
                            }
                            else if (Cube_Grass.Contains(blockID))
                            {
                                cubes_Blocks.Add(blockID, GameObject.Instantiate(Resources.Load("Cube_Grass")) as GameObject);
                                cubes_Blocks[blockID].name = "Block-" + blockID;
                                float scale = 1f;
                                //, offset = 0f;
                                cubes_Blocks[blockID].transform.Translate(new Vector3(-X * scale, Z * scale, Y * scale));
                            }
                            else if (Cube_Street.Contains(blockID))
                            {
                                //Debug.Log("Cube_Street");
                                cubes_Blocks.Add(blockID, GameObject.Instantiate(Resources.Load("Cube_Street")) as GameObject);
                                cubes_Blocks[blockID].name = "Block-" + blockID;
                                float scale = 1f;
                                //, offset = 0f;
                                cubes_Blocks[blockID].transform.Translate(new Vector3(-X * scale, Z * scale, Y * scale));
                            }
                            else if (Cube_RedBrick.Contains(blockID))
                            {
                                Debug.Log("Cube_RedBrick");
                                cubes_Blocks.Add(blockID, GameObject.Instantiate(Resources.Load("Cube_RedBrick")) as GameObject);
                                cubes_Blocks[blockID].name = "Block-" + blockID;
                                float scale = 1f;
                                //, offset = 0f;
                                cubes_Blocks[blockID].transform.Translate(new Vector3(-X * scale, Z * scale, Y * scale));
                            }

                            else if (Cube_cr010.Contains(blockID))
                            {
                                cubes_Blocks.Add(blockID, GameObject.Instantiate(Resources.Load("Cube_Rabbit")) as GameObject);
                                cubes_Blocks[blockID].name = "Block-" + blockID;
                                float scale = 1f;
                                //, offset = 0f;
                                cubes_Blocks[blockID].transform.Translate(new Vector3(X * scale, Z * scale, Y * scale));
                                cubes_Blocks[blockID].transform.Rotate(new Vector3(0, RFIB.getDataStackOrderIn3D(blockID, "FacingDirect") * 90, 0));
                            }
                            //Black
                            else if (BlockType == 9101)
                            {
                                cubes_Blocks.Add(blockID, GameObject.Instantiate(Resources.Load("CubeB1")) as GameObject);
                                cubes_Blocks[blockID].name = "Block-" + blockID;
                                float scale = 1f;
                                //, offset = 0f;
                                cubes_Blocks[blockID].transform.Translate(new Vector3(-X * scale, Z * scale, Y * scale));
                            }
                            else if (BlockType == 9201)
                            {
                                cubes_Blocks.Add(blockID, GameObject.Instantiate(Resources.Load("CubeW1")) as GameObject);
                                cubes_Blocks[blockID].name = "Block-" + blockID;
                                float scale = 1f;
                                //, offset = 0f;
                                cubes_Blocks[blockID].transform.Translate(new Vector3(-X * scale, Z * scale, Y * scale));
                            }                              //White
                            else if (BlockType == 9301)
                            {
                                cubes_Blocks.Add(blockID, GameObject.Instantiate(Resources.Load("CubeG1")) as GameObject);
                                cubes_Blocks[blockID].name = "Block-" + blockID;
                                float scale = 1f;
                                //, offset = 0f;
                                cubes_Blocks[blockID].transform.Translate(new Vector3(-X * scale, Z * scale, Y * scale));
                            }                              //White
                            else if (BlockType == 9401)
                            {
                                cubes_Blocks.Add(blockID, GameObject.Instantiate(Resources.Load("CubeR1")) as GameObject);
                                cubes_Blocks[blockID].name = "Block-" + blockID;
                                float scale = 1f;
                                //, offset = 0f;
                                cubes_Blocks[blockID].transform.Translate(new Vector3(-X * scale, Z * scale, Y * scale));
                            }                              //White
                            else
                            {
                                cubes_Blocks.Add(blockID, GameObject.CreatePrimitive(PrimitiveType.Cube));
                                cubes_Blocks[blockID].name = "Block-" + blockID;
                                cubes_Blocks[blockID].GetComponent <Renderer>().material.color = tmpColor;
                                float scale = 1f;
                                //, offset = 0f;
                                cubes_Blocks[blockID].transform.Translate(new Vector3(-X * scale, Z * scale, Y * scale));
                            }
                        }
                    }
                }
            }
        }
    }