コード例 #1
0
    public void CylinderBuild(Vector3 pos, Vector3 scale)
    {
        MazeObject = InitBuild(pos, scale);

        GameObject MazeBase;

        if (MyFloorPrefab)
        {
            MazeBase = Instantiate(MyFloorPrefab);
        }
        else
        {
            MazeBase = GameObject.CreatePrimitive(PrimitiveType.Cylinder);
        }
        MazeBase.transform.parent        = MazeObject.transform;
        MazeBase.transform.localPosition = new Vector3(0, 0, 0);
        MazeBase.transform.localScale    = new Vector3(((scale.x - 1) / scale.x), ((scale.y - 1) / scale.y) * 0.5f, ((scale.z - 1) / scale.z));
        if (MyFloor)
        {
            MazeBase.GetComponent <Renderer>().material = MyFloor;
        }

        GameObject[] MazeBases = new GameObject[2];
        for (int i = 0; i < 2; i++)
        {
            MazeBases[i] = GameObject.CreatePrimitive(PrimitiveType.Cylinder);
            MazeBases[i].transform.parent = MazeObject.transform;
            if (MyFloor)
            {
                MazeBases[i].GetComponent <Renderer>().material = MyFloor;
            }
            MazeBases[i].name = "Floortile";
            MazeBases[i].transform.localScale = new Vector3(1f, (1 / scale.y), 1f);
        }
        float Locposition = 0.5f;

        MazeBases[0].transform.localPosition = new Vector3(0, Locposition, 0);

        MazeBases[1].transform.localPosition = new Vector3(0, -Locposition, 0);

        SearchArray(8);
    }
コード例 #2
0
    public void SphereBuild(Vector3 pos, Vector3 scale)
    {
        MazeObject = InitBuild(pos, scale);

        SearchArray(5);
        GameObject MazeBase;

        if (MyFloorPrefab)
        {
            MazeBase = Instantiate(MyFloorPrefab);
        }
        else
        {
            MazeBase = GameObject.CreatePrimitive(PrimitiveType.Sphere);
        }
        MazeBase.transform.parent        = MazeObject.transform;
        MazeBase.transform.localPosition = new Vector3(0, 0, 0);
        MazeBase.transform.localScale    = new Vector3(((scale.x - 1) / scale.x), ((scale.y - 1) / scale.y), ((scale.z - 1) / scale.z));
        if (MyFloor)
        {
            MazeBase.GetComponent <Renderer>().material = MyFloor;
        }
    }
コード例 #3
0
    public void BottomFloorBuild(Vector3 pos, Vector3 scale)
    {
        MazeObject = InitBuild(pos, scale);

        SearchArray(2);
        GameObject MazeBase;

        if (MyFloorPrefab)
        {
            MazeBase = Instantiate(MyFloorPrefab);
        }
        else
        {
            MazeBase = GameObject.CreatePrimitive(PrimitiveType.Cube);
        }
        MazeBase.transform.parent     = MazeObject.transform;
        MazeBase.transform.localScale = new Vector3(((scale.x) / scale.x), ((scale.y) / scale.y), ((scale.z) / scale.z));
        if (MyFloor)
        {
            MazeBase.GetComponent <Renderer>().material = MyFloor;
        }


        if (y == 1)
        {
            MazeBase.transform.localPosition = new Vector3(0, -1, 0);
        }
        else if (x == 1)
        {
            MazeBase.transform.localPosition = new Vector3(-1, 0, 0);
        }
        else if (z == 1)
        {
            MazeBase.transform.localPosition = new Vector3(0, 0, -1);
        }
    }