コード例 #1
0
        void InitScene()
        {
            // load mesh
            meshManager = new XMeshManager(device);
            mesh        = meshManager.Open <Texturizer>(@"Resources\airplane 2.x");
            // initialize camera
            camera = new PerspectiveCamera(
                new Point3D(0, 0, -10),
                new Vector3D(0, 1, 0),
                new Vector3D(0, 1, 0),
                45);
            camera.NearPlaneDistance = .1;
            camera.FarPlaneDistance  = 500;

            // initialize camera transforms
            modelTransformGroup.Children.Add(modelZoom);
            modelTransformGroup.Children.Add(new RotateTransform3D(yAxisRotation));
            modelTransformGroup.Children.Add(new RotateTransform3D(xAxisRotation));
            modelTransformGroup.Children.Add(new RotateTransform3D(zAxisRotation));
        }
コード例 #2
0
 public void Start()
 {
     mat          = Texturizer.Generate(0.0f, 1.0f, 2.0f, seed);
     activeChunks = new Chunk[numChunks, numChunks];
     for (int y = 0; y < numChunks; y++)
     {
         for (int x = 0; x < numChunks; x++)
         {
             activeChunks[x, y] = new Chunk();
             activeChunks[x, y].Setup(x, y, seed, freq, mat);
             if (activeChunks[x, y].isNew)
             {
                 activeChunks[x, y].Generate();
             }
             else
             {
                 activeChunks[x, y].Load();
             }
         }
     }
 }
コード例 #3
0
ファイル: MainWindow.cs プロジェクト: fgeraci/CS195-Core
 /// <summary>
 /// Get the GUIContent for an EventStub.
 /// </summary>
 private GUIContent EventStubContent(EventStub evnt)
 {
     Texturizer texturizer = new Texturizer(evnt);
     this.texturizers.Add(texturizer);
     if (texturizer.HasTexture())
     {
         return new GUIContent(texturizer.GetTexture(), "Termination dependencies are highlighted");
     }
     else
     {
         return new GUIContent(evnt.Name, "Termination dependencies are highlighted");
     }
 }
コード例 #4
0
        public void CreateBricks()
        {
            GameObject _brickPrefab = GameObject.CreatePrimitive(PrimitiveType.Cube);

            //_brickPrefab.transform.localScale = transform.localScale;
            Destroy(_brickPrefab.GetComponent <BoxCollider>());

            if (t == null)
            {
                t = new Texturizer(Color.white);
            }

            int scaleX = 2;
            int scaleY = 2;

            int xMin = 1 - scaleX;
            int xMax = scaleX - 1;

            int yMin = 1 - scaleY;
            int yMax = scaleY - 1;

            int xOffset = scaleX + (scaleX - 1);
            int yOffset = scaleY + (scaleY - 1);

            //PlaceAllDoors(scaleX, scaleY);
            for (int y = 0; y < maze.nodes.GetLength(1); y++)
            {
                for (int x = 0; x < maze.nodes.GetLength(0); x++)
                {
                    UPoint startingOffset = new Vector3(x * xOffset, y * yOffset);

                    for (int yOff = yMin; yOff <= yMax; yOff++)
                    {
                        for (int xOff = xMin; xOff <= xMax; xOff++)
                        {
                            int links   = maze.nodes[x, y].links;
                            int newLink = 15;

                            if ((yOff == yMin && !maze.isFlagged(links, Maze.DOWN)) ||
                                (yOff == yMax && !maze.isFlagged(links, Maze.UP)) ||
                                (xOff == xMax && !maze.isFlagged(links, Maze.RIGHT)) ||
                                (xOff == xMin && !maze.isFlagged(links, Maze.LEFT)))
                            {
                                newLink = 0;
                            }//if
                            else if (maze.numLinks(links) < 4 && (
                                         (yOff == yMin && xOff == xMin) ||
                                         (yOff == yMax && xOff == xMin) ||
                                         (yOff == yMin && xOff == xMax) ||
                                         (yOff == yMax && xOff == xMax)))
                            {
                                newLink = 0;
                            }
                            else if (yOff == 0 && xOff == 0 && links == 0)
                            {
                                newLink = 0;
                            }//else if

                            UPoint placeAt = startingOffset + new Vector3(xOff, yOff);

                            //UPoint tilesIndex = startingOffset + new UPoint(scaleX - 1, scaleY - 1) + new UPoint(xOff, yOff);

                            t.setupTile(newLink);


                            GameObject tile = t.makeObject();
                            //tile.Initialize(tilesIndex.ix, tilesIndex.iy);
                            //tile.links = newLink;
                            tile.transform.position  = placeAt;
                            tile.transform.position += new Vector3(0, 0, 10);

                            tile.transform.parent = transform;
                            tile.name             = "Tile [" + x + "," + y + "]";

                            //if (x == 0 && y == 0 && maze.numLinks(links) == 1)
                            //{
                            //tile.tag = "ChestTile";
                            //}//if

                            //tiles[tilesIndex.ix, tilesIndex.iy] = tile;
                        } //for
                    }     //for
                }         //for
            }             //for

            _brickPrefab.SetActive(false);
        }//CreateBricks