Exemplo n.º 1
0
    void Awake()
    {
        gridCanvas = GetComponentInChildren <Canvas>();
        cellMesh   = GetComponentInChildren <CellMesh>();

        cells = new SquareCellScript[height * width];

        for (int y = 0, i = 0; y < height; y++)
        {
            for (int x = 0; x < width; x++)
            {
                CreateCell(x, y, i++);
            }
        }
    }
Exemplo n.º 2
0
        public void AgregateCellMesh(double shrinkFactor = 1.00)
        {
            if (shrinkFactor > 1 || shrinkFactor < 0.01)
            {
                throw new PolyFrameworkException("shrink factor must be between 0.01 and 1.00");
            }
            // The standard rhino mesh offset is not good for sharp corners
            // need to write a new offset algorithm
            foreach (var face in Faces)
            {
                if (face.FMesh.Faces.Count == 0 || face.FMesh == null)
                {
                    face.FaceMesh();
                }
                CellMesh.Append(face.FMesh);
            }
            CellMesh.Weld(Math.PI);
            CellMesh.UnifyNormals();

            CellMesh.Normals.ComputeNormals();
            CellMesh.Normals.UnitizeNormals();
            //CellMesh.FaceNormals.ComputeFaceNormals();


            CellMesh.Flip(true, true, true);
            if (Exterior)
            {
                CellMesh.Transform(Transform.Scale(Centroid, 1 + (1 - shrinkFactor) / 2));
            }
            else
            {
                CellMesh.Transform(Transform.Scale(Centroid, shrinkFactor));
            }

            //CellMesh = CellMesh.Offset(0.05);
        }
Exemplo n.º 3
0
 //Get components, instantiate lists, and create the Cell grid
 private void Awake()
 {
     cellMesh = GetComponentInChildren<CellMesh>();
     NewGame();
 } //End Awake()