コード例 #1
0
        public static bool GenerateLinearStairsAsset(CSGBrushMeshAsset brushMeshAsset, CSGLinearStairsDefinition definition)
        {
            definition.Validate();
            int subMeshCount = GetLinearStairsSubMeshCount(definition, definition.leftSide, definition.rightSide);

            if (subMeshCount == 0)
            {
                brushMeshAsset.Clear();
                return(false);
            }

            CSGBrushSubMesh[] subMeshes;
            if (brushMeshAsset.SubMeshCount != subMeshCount)
            {
                subMeshes = new CSGBrushSubMesh[subMeshCount];
                for (int i = 0; i < subMeshCount; i++)
                {
                    subMeshes[i] = new CSGBrushSubMesh();
                }
            }
            else
            {
                subMeshes = brushMeshAsset.SubMeshes;
            }

            if (!GenerateLinearStairsSubMeshes(subMeshes, definition, definition.leftSide, definition.rightSide, 0))
            {
                brushMeshAsset.Clear();
                return(false);
            }

            brushMeshAsset.SubMeshes = subMeshes;

            brushMeshAsset.CalculatePlanes();
            brushMeshAsset.SetDirty();
            return(true);
        }
コード例 #2
0
 public void Validate()
 {
     curveSegments = Mathf.Max(curveSegments, 2);
     stairs.Validate();
 }
コード例 #3
0
 protected override void OnValidateInternal()
 {
     definition.Validate(); base.OnValidateInternal();
 }