Ejemplo n.º 1
0
        // GET: Model3D/Edit/5
        public ActionResult Edit(int id)
        {
            IModel3DService test   = new Model3DServices();
            model3d         edited = test.GetById(id);

            return(View(edited));
        }
Ejemplo n.º 2
0
 public ActionResult Edit(model3d m)
 {
     try
     {
         IModel3DService test = new Model3DServices();
         test.Update(m);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
Ejemplo n.º 3
0
        void reset()
        {
            gameover    = false;
            gameruntime = 0;
            score       = 0;

            // Initialise robot1 object
            robot = new model3d(Content, "r2d2v2", 2f, new Vector3(0, 0, 0), new Vector3(0, 0, 0), 0.002f, 0.06f, 10);

            // Load the 3D models for the static objects in the game from the ContentManager
            for (int i = 0; i < numberofgrounds; i++)
            {
                ground[i] = new staticmesh(Content, "long_ground", 10f, new Vector3(0, -40, 0), new Vector3(0, 0, 0));
                if (i > 0)
                {
                    ground[i].position.Z += ground[i - 1].position.Z + 800 * ground[i - 1].size;
                }
            }

            for (int i = 0; i < numberofwalls; i++)
            {
                leftwall[i]  = new staticmesh(Content, "wall", 10f, new Vector3(-1000, -40, 0), new Vector3(0, 0, 0));
                rightwall[i] = new staticmesh(Content, "wall", 10f, new Vector3(1000, -40, 0), new Vector3(0, 0, 0));
                if (i > 0)
                {
                    leftwall[i].position.Z += leftwall[i - 1].position.Z + 800 * leftwall[i - 1].size;
                    rightwall[i].position.Z = leftwall[i].position.Z;
                }
            }

            for (int i = 0; i < numberoftrees; i++)
            {
                if (i % 2 == 0)
                {
                    tree[i] = new staticmesh(Content, "tree", (float)(randomiser.Next(20) + 1) / 10,
                                             new Vector3(randomiser.Next(1600) - 800, 0, randomiser.Next(40000) + 1000),
                                             new Vector3(0, randomiser.Next(7), 0));
                }
                else
                {
                    tree[i] = new staticmesh(Content, "lamppost", (float)(randomiser.Next(20) + 1) / 3,
                                             new Vector3(randomiser.Next(1600) - 800, 0, randomiser.Next(40000) + 1000),
                                             new Vector3(0, randomiser.Next(7), 0));
                    tree[i].position.Y = tree[i].size * 40;
                }
            }
        }
Ejemplo n.º 4
0
        // Reset values for the start of a new game
        void reset()
        {
            gameover = false;

            // Load the 3D models for the static objects in the game from the ContentManager
            ground = new staticmesh(Content, "sground", 100f, new Vector3(0, -40, 0), new Vector3(0, 0, 0));

            // Initialise robot1 object
            robot = new model3d(Content, "r2d2v2", 2f, new Vector3(1000, 0, 1000), new Vector3(0, 0, 0), 0.002f, 0.05f, 10);

            for (int i = 0; i < numberoftrees; i++)
            {
                if (i % 2 == 0)
                {
                    tree[i] = new staticmesh(Content, "tree", (float)(randomiser.Next(20) + 1) / 10,
                                             new Vector3(randomiser.Next(6000) - 3000, 0, randomiser.Next(6000) - 3000),
                                             new Vector3(0, randomiser.Next(7), 0));
                    tree[i].position.Y = tree[i].radius / 2;
                }
                else
                {
                    tree[i] = new staticmesh(Content, "lamppost", (float)(randomiser.Next(20) + 1) / 3,
                                             new Vector3(randomiser.Next(6000) - 3000, 0, randomiser.Next(6000) - 3000),
                                             new Vector3(0, randomiser.Next(7), 0));
                    tree[i].position.Y = tree[i].size * 40;
                }
            }

            tree[50] = new staticmesh(Content, "tank", (float)(randomiser.Next(20) + 1) / 10,
                                      new Vector3(randomiser.Next(6000), 140, randomiser.Next(6000)),
                                      new Vector3(0, randomiser.Next(7), 0));
            tree[50].position.Y = tree[50].radius;
            tree[51]            = new staticmesh(Content, "ship", (float)(randomiser.Next(20) + 1) / 10,
                                                 new Vector3(randomiser.Next(6000) - 3000, 1000, randomiser.Next(6000) - 3000),
                                                 new Vector3(0, randomiser.Next(7), 0));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            if (File.Exists(@"highscore.txt"))
            {
                String line;
                StreamReader sr = new StreamReader(@"highscore.txt");
                line = sr.ReadLine();
                sr.Close();
                line = line.Trim();
                for (int i = 0; i < numberofhighscores; i++)
                    highscore[i] = (int)Convert.ToDecimal(line);

            }

            cameraposition = new Vector3(1000, 100, 10);
            cameralookat = new Vector3(0, 400, 0);
            aspectratio = (float)displaywidth / (float)displayheight;

            ground = new staticmesh(Content, "sground", 100f, new Vector3(0, -40, 0), new Vector3(0, 0, 0));
            robot = new model3d(Content, "r2d2v2", 2f, new Vector3(1000, 0, 1000), new Vector3(0, 0, 0), 0.05f, 0.5f, 10);

            for (int i = 0; i < numberoftrees; i++)
            {
                if (i % 2 == 0)
                    trees[i] = new staticmesh(Content, "tree", (float)(randomiser.Next(20) + 1) / 10,
                        new Vector3(randomiser.Next(6000) - 3000, 0, randomiser.Next(6000) - 3000),
                        new Vector3(0, randomiser.Next(7), 0));
                else
                {
                    trees[i] = new staticmesh(Content, "lamppost", (float)(randomiser.Next(20) + 1) / 3,
                        new Vector3(randomiser.Next(6000) - 3000, 0, randomiser.Next(6000) - 3000),
                        new Vector3(0, randomiser.Next(70), 0));

                    trees[i].position.Y = trees[i].size * 40;
                }
            }

            background = new graphics2d(Content, "Background for Menus", displaywidth, displayheight);
            mousepointer1 = new sprites2d(Content, "X-Games-Cursor", 0, 0, 0.15f, Color.White, true, randomiser);
            mousepointer2 = new sprites2d(Content, "X-Games-Cursor-Highlight", 0, 0, 0.15f, Color.White, true,randomiser);

            menuoptions[0, 0] = new sprites2d(Content, "Start-Normal", displaywidth / 2, 200, 1, Color.White, true,randomiser);
            menuoptions[0, 1] = new sprites2d(Content, "Start-Selected", displaywidth / 2, 200, 1,Color.White, true,randomiser);
            menuoptions[1, 0] = new sprites2d(Content, "Options-Normal", displaywidth / 2, 300, 1, Color.White, true,randomiser);
            menuoptions[1, 1] = new sprites2d(Content, "options-Selected", displaywidth / 2, 300, 1, Color.White, true,randomiser);
            menuoptions[2, 0] = new sprites2d(Content, "High-Score-Normal", displaywidth / 2, 400, 1, Color.White, true,randomiser);
            menuoptions[2, 1] = new sprites2d(Content, "High-Score-Selected", displaywidth / 2, 400, 1, Color.White, true,randomiser);
            menuoptions[3, 0] = new sprites2d(Content, "Exit-Normal", displaywidth / 2, 500, 1, Color.White, true,randomiser);
            menuoptions[3, 1] = new sprites2d(Content, "Exit-Selected", displaywidth / 2, 500, 1, Color.White, true,randomiser);

            for (int i = 0; i < numberofoptions; i++)
                menuoptions[i, 0].updateobject();

            mainfont = Content.Load<SpriteFont>("mainfont");
        }
Ejemplo n.º 6
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here
            mainfont = Content.Load <SpriteFont>("quartz4");  // Load the quartz4 font

            background = new graphic2d(Content, "Background for Menus", displaywidth, displayheight);

            up     = new sprite2d(Content, "up", 105, displayheight - 180, 0.3f, Color.White, true);
            down   = new sprite2d(Content, "down", 105, displayheight - 50, 0.3f, Color.White, true);
            left   = new sprite2d(Content, "left", 50, displayheight - 115, 0.3f, Color.White, true);
            right  = new sprite2d(Content, "right", 160, displayheight - 115, 0.3f, Color.White, true);
            left2  = new sprite2d(Content, "left", displaywidth - 180, displayheight - 100, 0.3f, Color.White, true);
            right2 = new sprite2d(Content, "right", displaywidth - 60, displayheight - 100, 0.3f, Color.White, true);

            menuoptions[0] = new sprite2d(Content, "player1", displaywidth / 2, 150, 1, Color.White, true);
            menuoptions[1] = new sprite2d(Content, "options", displaywidth / 2, 220, 1, Color.White, true);
            menuoptions[2] = new sprite2d(Content, "highscore", displaywidth / 2, 290, 1, Color.White, true);
            menuoptions[3] = new sprite2d(Content, "exit", displaywidth / 2, 360, 1, Color.White, true);

            // Load the 3D models for the static objects in the game from the ContentManager
            ground = new staticmesh(Content, "sground", 100f, new Vector3(0, -40, 0), new Vector3(0, 0, 0));

            // Initialise robot1 object
            uservehicle = new model3d(Content, "tiefighter", 2f, new Vector3(1000, 0, 1000), new Vector3(0, 0, 0), 0.002f, 0.06f, 10);

            /*
             * tree[50] = new staticmesh(Content, "tank", (float)(randomiser.Next(20) + 1) / 10,
             *                      new Vector3(randomiser.Next(6000) - 3000, 200, randomiser.Next(6000) - 3000),
             *                          new Vector3(0, randomiser.Next(7), 0));
             * tree[51] = new staticmesh(Content, "ship", (float)(randomiser.Next(20) + 1) / 10,
             *                      new Vector3(randomiser.Next(6000) - 3000, 200, randomiser.Next(6000) - 3000),
             *                          new Vector3(0, randomiser.Next(7), 0));
             * tree[52] = new staticmesh(Content, "stars", 10,
             *                      new Vector3(randomiser.Next(6000) - 3000, 200, randomiser.Next(6000) - 3000),
             *                          new Vector3(0, randomiser.Next(7), 0));
             */

            // Load High Scores in
            using (IsolatedStorageFile savegamestorage = IsolatedStorageFile.GetUserStoreForApplication())
            {
                if (savegamestorage.FileExists("highscores.txt"))
                {
                    using (IsolatedStorageFileStream fs = savegamestorage.OpenFile("highscores.txt", System.IO.FileMode.Open))
                    {
                        using (StreamReader sr = new StreamReader(fs))
                        {
                            string line;
                            for (int i = 0; i < numberofhighscores; i++)
                            {
                                line          = sr.ReadLine();
                                highscores[i] = Convert.ToInt32(line);
                            }

                            sr.Close();
                        }
                    }
                }
            }
            // Sort high scores
            Array.Sort(highscores);
            Array.Reverse(highscores);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // Create a music track
            soundtrack = Content.Load <SoundEffect>("Behind-every-Idea");
            music      = soundtrack.CreateInstance();

            playergun = Content.Load <SoundEffect>("starting_pistol");
            zombiehit = Content.Load <SoundEffect>("Zombie Attacked");
            playerhit = Content.Load <SoundEffect>("Bite");

            //Make the track looped and if its stop then play it
            music.IsLooped = true;
            music.Volume   = 0.75f;
            if (music.State == SoundState.Playing)
            {
                music.Stop();
            }



            // TODO: use this.Content to load your game content here
            mainfont = Content.Load <SpriteFont>("quartz4");  // Load the quartz4 font

            background   = new graphic2d(Content, "ZombieBG", displaywidth, displayheight);
            background2  = new graphic2d(Content, "skyline", displaywidth, displayheight);
            backgroundGO = new graphic2d(Content, "gameoverbg", displaywidth, displayheight);

            up    = new sprite2d(Content, "up", 115, displayheight - 150, 0.25f, Color.White, true);
            down  = new sprite2d(Content, "down", 115, displayheight - 50, 0.25f, Color.White, true);
            left  = new sprite2d(Content, "left", 55, displayheight - 100, 0.25f, Color.White, true);
            right = new sprite2d(Content, "right", 175, displayheight - 100, 0.25f, Color.White, true);

            controlshowto = new sprite2d(Content, "Controls", 425, displayheight - 225, 0.65f, Color.White, true);

            firebut  = new sprite2d(Content, "fire", 700, displayheight - 100, 0.50f, Color.White, true);
            menuback = new sprite2d(Content, "right", displaywidth - 50, 50, 0.25f, Color.White, true);

            menuoptions[0] = new sprite2d(Content, "buttonstart", displaywidth / 2, 150, 0.50f, Color.White, true);
            menuoptions[1] = new sprite2d(Content, "buttonhowtoplay", displaywidth / 2, 220, 0.50f, Color.White, true);
            menuoptions[2] = new sprite2d(Content, "buttonhighscore", displaywidth / 2, 290, 0.50f, Color.White, true);
            menuoptions[3] = new sprite2d(Content, "buttonexit", displaywidth / 2, 360, 0.50f, Color.White, true);

            // Initialise robot1 object
            playerchar          = new model3d(Content, "player", 2f, new Vector3(0, 0, 0), new Vector3(0, 0, 0), 0.002f, 0.06f, 10);
            playerchar.bboxsize = new Vector3(25, 115, 25);


            // Load High Scores in
            using (IsolatedStorageFile savegamestorage = IsolatedStorageFile.GetUserStoreForApplication())
            {
                if (savegamestorage.FileExists("highscores.txt"))
                {
                    using (IsolatedStorageFileStream fs = savegamestorage.OpenFile("highscores.txt", System.IO.FileMode.Open))
                    {
                        using (StreamReader sr = new StreamReader(fs))
                        {
                            string line;
                            for (int i = 0; i < numberofhighscores; i++)
                            {
                                line          = sr.ReadLine();
                                highscores[i] = Convert.ToInt32(line);
                            }

                            sr.Close();
                        }
                    }
                }
            }
            // Sort high scores
            Array.Sort(highscores);
            Array.Reverse(highscores);
        }