Ejemplo n.º 1
0
        // Constructor
        public ObstacleHuts(Stage stage, string label, string meshFile)
            : base(stage, label, meshFile)
        {
            IsCollidable = true;

            random = new Random();

            for (int i = 0; i < southernObstacles.Length / 2; i++)
            {
                int x_south = southernObstacles[i, 0] * stage.Spacing;
                int z_south = southernObstacles[i, 1] * stage.Spacing;

                addObject(
                    new Vector3(x_south, stage.surfaceHeight(x_south, z_south), z_south),
                    new Vector3(0, 1, 0),
                    random.Next(5) * 0.01f);
            }
            for (int i = 0; i < northernObstacles.Length / 2; i++)
            {
                int x_north = northernObstacles[i, 0] * stage.Spacing;
                int z_north = northernObstacles[i, 1] * stage.Spacing;

                addObject(
                    new Vector3(x_north, stage.surfaceHeight(x_north, z_north), z_north),
                    new Vector3(0, 1, 0),
                    random.Next(5) * 0.01f);
            }
            for (int i = 0; i < westernObstacles.Length / 2; i++)
            {
                int x_west = westernObstacles[i, 0] * stage.Spacing;
                int z_west = westernObstacles[i, 1] * stage.Spacing;

                addObject(
                    new Vector3(x_west, stage.surfaceHeight(x_west, z_west), z_west),
                    new Vector3(0, 1, 0),
                    random.Next(5) * 0.01f);
            }
            for (int i = 0; i < easternObstacles.Length / 2; i++)
            {
                int x_east = easternObstacles[i, 0] * stage.Spacing;
                int z_east = easternObstacles[i, 1] * stage.Spacing;

                addObject(
                    new Vector3(x_east, stage.surfaceHeight(x_east, z_east), z_east),
                    new Vector3(0, 1, 0),
                    random.Next(5) * 0.01f);
            }
        }
Ejemplo n.º 2
0
        // Constructor
        public Huts(Stage stage, string label, string meshFile, int nHuts)
            : base(stage, label, meshFile)
        {
            int separationX = 0;
            int separationZ = 0;

            IsCollidable = true;

            random = new Random();
            // add nClouds random cloud instances
            for (int i = 0; i < nHuts; i++)
            {
                int x = (128 + random.Next(256) + separationX) * stage.Spacing;  // 128 .. 384
                int z = (128 + random.Next(256) + separationZ) * stage.Spacing;

                int coinFlip = random.Next(2);
                if (coinFlip == 0)
                {
                    separationX += 5; // Increase X range by 5
                }
                else
                {
                    separationZ += 5; // Else increase Z range by 5
                }

                addObject(
                    new Vector3(x, stage.surfaceHeight(x, z), z),
                    new Vector3(0, 1, 0),
                    random.Next(5) * 0.01f);
            }
        }
Ejemplo n.º 3
0
        // Constructor
        public Treasure(Stage stage, string label, string meshFile, int locX, int locZ)
            : base(stage, label, meshFile)
        {
            float scaledX = locX * stage.Spacing;
            float scaledZ = locZ * stage.Spacing;

            random = new Random();

            treasureObj = addObject(
                new Vector3(scaledX, stage.surfaceHeight(scaledX, scaledZ), scaledZ),
                new Vector3(0, 1, 0),
                random.Next(5) * 0.01f);
        }
Ejemplo n.º 4
0
        // Constructor
        public Bushes(Stage stage, string label, string meshFile, int nHuts)
            : base(stage, label, meshFile)
        {
            random = new Random();
            // add nClouds random cloud instances
            for (int i = 0; i < nHuts; i++)
            {
                int x = (32 + random.Next(449)) * stage.Spacing;  // 32 .. 480
                int z = (32 + random.Next(449)) * stage.Spacing;

                while (stage.surfaceHeight(x, z) > (175 * stage.Spacing)) // Mountainous region
                {
                    // keep rolling x and z until not mountainous
                    x = (32 + random.Next(449)) * stage.Spacing;
                    z = (32 + random.Next(449)) * stage.Spacing;
                }

                addObject(
                    new Vector3(x, stage.surfaceHeight(x, z), z),
                    new Vector3(0, 1, 0),
                    random.Next(5) * 0.01f);
            }
        }
Ejemplo n.º 5
0
 // Constructor
 public Cloud(Stage stage, string label, string meshFile, int nClouds)
     : base(stage, label, meshFile)
 {
     random = new Random();
     // add nClouds random cloud instances
     for (int i = 0; i < nClouds; i++)
     {
         int x = (128 + random.Next(256)) * stage.Spacing;              // 128 .. 384
         int z = (128 + random.Next(256)) * stage.Spacing;
         addObject(
             new Vector3(x, stage.surfaceHeight(x, z) + 4000, z),
             new Vector3(0, 1, 0), (random.Next(5)) * 0.01f,
             new Vector3(4 + random.Next(3), random.Next(4) + 1, 3 + random.Next(2)));
     }
 }
Ejemplo n.º 6
0
 // Constructor
 public Cloud(Stage stage, string label, string meshFile, int nClouds)
     : base(stage, label, meshFile)
 {
     random = new Random();
     // add nClouds random cloud instances
     for (int i = 0; i < nClouds; i++)
     {
         int   x     = (32 + random.Next(512 - 32)) * stage.Spacing;  // 128 .. 384
         int   z     = (32 + random.Next(512 - 32)) * stage.Spacing;
         float scale = 4 + random.Next(3);
         addObject(
             new Vector3(x, stage.surfaceHeight(x, z) + random.Next(8000, 10000), z),
             new Vector3(0, 1, 0), (random.Next(360)) * 0.0174533f,
             new Vector3(scale, scale, scale));
     }
 }
Ejemplo n.º 7
0
        public Treasure(Stage theStage, string label, string meshFile, string altMeshFile = null,
                        int xPos = 447, int zPos = 453, float boundingMultiplier = 1.05f)
            : base(theStage, label, meshFile, boundingMultiplier)
        {
            altMesh = altMeshFile;

            //Unnecessary to have random sizes for cars
            //float scale = (float)(0.5 + random.NextDouble());
            float scale = 1.5f;

            isCollidable = true;
            //random = new Random();
            int spacing = theStage.Spacing;

            addObject(new Vector3(xPos * spacing, theStage.surfaceHeight(xPos, zPos), zPos * spacing),
                      new Vector3(0, 1, 0), 0.0f,
                      new Vector3(scale, scale, scale));
        }