当前位置: 首页>>代码示例>>C#>>正文


C# Voxel.SetRotation方法代码示例

本文整理汇总了C#中Voxel.SetRotation方法的典型用法代码示例。如果您正苦于以下问题:C# Voxel.SetRotation方法的具体用法?C# Voxel.SetRotation怎么用?C# Voxel.SetRotation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Voxel的用法示例。


在下文中一共展示了Voxel.SetRotation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Start

    void Start()
    {
        Voxel v = new Voxel();

        // Theme:      5 bits
        // Block:      5 bits
        // Variant:    6 bits
        // Rotation x: 2 bits
        // Rotation y: 2 bits
        // Rotation z: 2 bits

        string theme = "11111";
        string block = "11111";
        string variant = "111111";
        string rotX = "11";
        string rotY = "01";
        string rotZ = "00";
        string data = theme + block + variant + rotX + rotY + rotZ;
        v.data = Convert.ToInt32(data, 2);
        Debug.Log("Raw data: "+v.data);
        Debug.Log("Binary data: "+ v.GetBinaryString());

        // Change theme from space to western
        Debug.Log("Theme: "+v.GetTheme());
        Debug.Log("Set theme: Theme.DEFAULT");
        v.SetTheme(Theme.DEFAULT);
        Debug.Log("Binary data: "+v.GetBinaryString());
        Debug.Log("Theme: "+v.GetTheme());

        Debug.Log("BlockID: "+v.GetBlockType());
        Debug.Log("Set block ID: 0");
        v.SetBlockType(0);
        Debug.Log("Binary data: "+v.GetBinaryString());
        Debug.Log("BlockID NEW: "+v.GetBlockType());

        Debug.Log("Variant before: "+v.GetVariant());
        Debug.Log("Set variant: 2");
        v.SetVariant(2);
        Debug.Log("Binary data: "+v.GetBinaryString());
        Debug.Log("Variant after: "+v.GetVariant());

        Debug.Log("Rotation before: "+v.GetRotation().eulerAngles);
        Debug.Log("Set rotation: 270, 0, 0");
        v.SetRotation(Quaternion.Euler(270f, 0f, 0f));
        Debug.Log("Binary data: "+v.GetBinaryString());
        Debug.Log("Rotation after: "+v.GetRotation().eulerAngles);
    }
开发者ID:mandarinx,项目名称:buildahouse,代码行数:47,代码来源:BitTester.cs

示例2: UpdateNeighbour

    private void UpdateNeighbour(Voxel v, Point3 worldCoord)
    {
        BlockInfo bi =
            SurfaceManager.GetSurface(
                SurfaceManager.GetID(
                    GetNeighbours(worldCoord)));

        v.SetRotation(bi.rotation);

        int hash = ChunkManager.GetHash(worldCoord.ToChunkCoord());

        Transform chunkContainer = null;
        foreach (Transform child in transform) {
            if (child.name == hash.ToString()) {
                chunkContainer = child;
                break;
            }
        }

        if (chunkContainer == null) {
            PlaceBlock(worldCoord, hash, bi);
            return;
        }

        Mesh mesh = Resources.Load("Meshes/Dev/"+bi.meshName) as Mesh;
        string name = Name(worldCoord);

        foreach (Transform block in chunkContainer) {
            if (block.name == name) {
                block.GetComponent<MeshFilter>().sharedMesh = mesh;
                block.transform.localRotation = bi.rotation;
            }
        }
    }
开发者ID:mandarinx,项目名称:buildahouse,代码行数:34,代码来源:BlockManager.cs


注:本文中的Voxel.SetRotation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。