コード例 #1
0
        /// <summary>
        /// Updates the meshes and direction based on the used Adjacency type.
        /// </summary>
        private void UpdateMeshAndDirection()
        {
            MeshDirectionInfo info = new MeshDirectionInfo();

            switch (selectedAdjacencyType)
            {
            case AdjacencyType.Simple:
                info = simpleAdjacency.GetMeshAndDirection(adjacencyMap);
                break;

            case AdjacencyType.Advanced:
                info = advancedAdjacency.GetMeshAndDirection(adjacencyMap);
                break;

            case AdjacencyType.Offset:
                info = offsetAdjacency.GetMeshAndDirection(adjacencyMap);
                break;
            }

            if (filter == null)
            {
                filter = GetComponent <MeshFilter>();
            }

            filter.mesh = info.Mesh;

            transform.localRotation = Quaternion.Euler(transform.localRotation.eulerAngles.x, info.Rotation, transform.localRotation.eulerAngles.z);
        }