Example #1
0
    private LeafIndex GetLeafIndex(Mesh mesh, BranchIndex fromBranchIndex, GameObjectInfo objectInfo)
    {
        LeafIndex index = new LeafIndex();

        /*
         * 存储信息:
         * 索引值和器官类型
         * 用于后续判断不同时期的两个器官索引是否为相同索引
         */
        index.Index    = GetIndexWithSameType(OrganType.Leaf, fromBranchIndex);
        index.LeafMesh = mesh;

        /*
         * 存储空间信息:
         * 半径、旋转方向
         * 用于后续绘制
         */
        index.Radius   = objectInfo.Radius;
        index.Rotation = objectInfo.Rotation;

        /*
         * 存储上下文信息:
         * 从属枝干
         */
        index.From = fromBranchIndex;

        /*
         * 病虫害信息:
         * 细胞纹理
         */
        index.CelluarTex = CellularTexMemory.GetInstance().GetCellularTex(0);

        return(index);
    }
    public static CellularTexMemory GetInstance()
    {
        if (instance == null)
        {
            instance = new CellularTexMemory();
        }

        return(instance);
    }