Exemplo n.º 1
0
        public void Load()
        {
            _camera = new Camera();
              _camera.PositionSpeed = 5;
              _camera.Move(_camera.Up, 400);
              _camera.Move(_camera.Backward, 1500);
              _camera.Move(_camera.Backward, 300);

              _terrain = StaticModelManager.GetModel("Terrain");
              _terrain.Scale = new Vector(500, 20, 500);
              //_terrain.RotationAmmounts = new Vector(0, 0, 0);
              _terrain.Position = new Vector(0, 0, 0);

              _sprites = new Sprite(TextureManager.Get("Menu"));
              _sprites.Scale.X = 50;
              _sprites.Scale.Y = 50;
              _sprites2 = new Sprite(TextureManager.Get("Menu"));
              _sprites2.Scale.X = 50;
              _sprites2.Scale.Y = 50;
              _sprites3 = new Sprite(TextureManager.Get("Menu"));
              _sprites3.Scale.X = 50;
              _sprites3.Scale.Y = 50;

              _isReady = true;
        }
Exemplo n.º 2
0
        public void Load()
        {
            // Creates a camera and sets the initial positions
              _camera = new Camera();
              _camera.PositionSpeed = 5;
              _camera.Move(_camera.Up, 400);
              _camera.Move(_camera.Backward, 1500);
              _camera.Move(_camera.Backward, 300);

              // Gets a copy of the "Terrain" model and tracks the number of hardware instances of each component
              _terrain = StaticModelManager.GetModel("Terrain");
              _terrain.Scale = new Vector(500, 20, 500);
              _terrain.Orientation = new Quaternion(0, 0, 0, 0);
              _terrain.Position = new Vector(0, 0, 0);

              // Gets a copy of the "RedRanger" model and tracks the number of hardware instances of each component
              _redRanger = StaticModelManager.GetModel("RedRanger");
              _redRanger.Orientation = new Quaternion(0, 1, 0, 0);
              //_redRanger.RotationAngle = 180f;
              _redRanger.Scale = new Vector(5, 5, 5);
              _redRanger.Position = new Vector(_terrain.Position.X + 200, _terrain.Position.Y + 130, _terrain.Position.Z);

              // Gets a copy of the "YellowRanger" model and tracks the number of hardware instances of each component
              _yellowRanger = StaticModelManager.GetModel("YellowRanger");
              _yellowRanger.Orientation = new Quaternion(0, 1, 1, 0);
              _yellowRanger.Scale = new Vector(10, 10, 10);
              _yellowRanger.Position = new Vector(_terrain.Position.X + 100, _terrain.Position.Y + 130, _terrain.Position.Z);

              // Gets a copy of the "BlackRanger" model and tracks the number of hardware instances of each component
              _blackRanger = StaticModelManager.GetModel("BlackRanger");
              _blackRanger.Orientation = new Quaternion(1, 1, 0, 0);
              _blackRanger.Scale = new Vector(10, 10, 10);
              _blackRanger.Position = new Vector(_terrain.Position.X + 0, _terrain.Position.Y + 130, _terrain.Position.Z);

              // Gets a copy of the "BlueRanger" model and tracks the number of hardware instances of each component
              _blueRanger = StaticModelManager.GetModel("BlueRanger");
              _blueRanger.Orientation = new Quaternion(0, 1, 2, 0);
              _blueRanger.Scale = new Vector(10, 10, 10);
              _blueRanger.Position = new Vector(_terrain.Position.X - 200, _terrain.Position.Y + 130, _terrain.Position.Z);

              // Gets a copy of the "PinkRanger" model and tracks the number of hardware instances of each component
              _pinkRanger = StaticModelManager.GetModel("PinkRanger");
              _pinkRanger.Orientation = new Quaternion(0, 1, 0, 0);
              _pinkRanger.Scale = new Vector(10, 10, 10);
              _pinkRanger.Position = new Vector(_terrain.Position.X - 100, _terrain.Position.Y + 130, _terrain.Position.Z);

              // Gets a copy of the "RedRangerSeven" model and tracks the number of hardware instances of each component
              _RedRangerTwo = StaticModelManager.GetModel("RedRangerSeven");
              _RedRangerTwo.Orientation = new Quaternion(0, 1, 0, 0);
              _RedRangerTwo.Scale = new Vector(20, 20, 20);
              _RedRangerTwo.Position = new Vector(_terrain.Position.X - 500, _terrain.Position.Y + 130, _terrain.Position.Z + 700);

              _isReady = true;
        }
Exemplo n.º 3
0
        public PowerRangerDNA()
        {
            _camera = new Camera();
              _camera.PositionSpeed = 5;
              _camera.Move(_camera.Up, 400);
              _camera.Move(_camera.Backward, 1500);
              _camera.Move(_camera.Backward, 300);

              _skybox = new SkyBox();
              _skybox.Scale.X = 10000;
              _skybox.Scale.Y = 10000;
              _skybox.Scale.Z = 10000;
              _skybox.Left = TextureManager.Get("SkyboxLeft");
              _skybox.Right = TextureManager.Get("SkyboxRight");
              _skybox.Front = TextureManager.Get("SkyboxFront");
              _skybox.Back = TextureManager.Get("SkyboxBack");
              _skybox.Top = TextureManager.Get("SkyboxTop");

              _terrain = StaticModelManager.GetModel("Terrain");
              _terrain.Scale = new Vector(500, 20, 500);
              _terrain.RotationAmmounts = new Vector(0, 0, 0);
              _terrain.Position = new Vector(0, 0, 0);

              string[] colors = new string[] { "YellowRanger", "RedRanger", "BlueRanger", "BlackRanger", "PinkRanger" };

              Random random = new Random();
              _rangers = new StaticModel[300];
              for (int i = 0; i < _rangers.Length; i++)
              {
            _rangers[i] = StaticModelManager.GetModel(colors[random.Next(0, 5)]);
            _rangers[i].Position.X = i * 10 - 500;
            _rangers[i].Position.Y = _terrain.Position.Y + 130;
            _rangers[i].Position.Z = i * 10 - 530;
            _rangers[i].Scale = new Vector(5, 5, 5);
            _rangers[i].RotationAmmounts = new Vector(0, 1, 0);
            _rangers[i].RotationAngle = i * 2;
              }

              for (int i = 0; i < _rangers.Length; i+=2)
              {
            _rangers[i].Meshes.Remove("Body");
              }
        }
Exemplo n.º 4
0
        public void Load()
        {
            _camera = new Camera();
              _camera.PositionSpeed = 5;
              _camera.Move(_camera.Up, 400);
              _camera.Move(_camera.Backward, 1500);
              _camera.Move(_camera.Backward, 300);

              _skybox = new SkyBox();
              _skybox.Scale.X = 10000;
              _skybox.Scale.Y = 10000;
              _skybox.Scale.Z = 10000;
              _skybox.Left = TextureManager.Get("SkyboxLeft");
              _skybox.Right = TextureManager.Get("SkyboxRight");
              _skybox.Front = TextureManager.Get("SkyboxFront");
              _skybox.Back = TextureManager.Get("SkyboxBack");
              _skybox.Top = TextureManager.Get("SkyboxTop");

              _terrain = StaticModelManager.GetModel("Terrain");
              _terrain.Scale = new Vector(500, 20, 500);
              _terrain.Orientation = new Quaternion(0, 0, 0, 0);
              _terrain.Position = new Vector(0, 0, 0);

              _mountain = StaticModelManager.GetModel("Mountain");
              _mountain.Scale = new Vector(5000, 5000, 5000);
              _mountain.Orientation = new Quaternion(0, 0, 0, 0);
              _mountain.Position = new Vector(4000, 0, 1000);

              _mountain2 = StaticModelManager.GetModel("Mountain2");
              _mountain2.Scale = new Vector(3500, 3500, 3500);
              _mountain2.Orientation = new Quaternion(0, 0, 0, 0);
              _mountain2.Position = new Vector(0, 0, 2500);

              GenerateUnits();

              Renderer.Font = TextManager.GetFont("Calibri");

              // ONCE YOU ARE DONE LOADING, BE SURE TO SET YOUR READY
              // PROPERTY TO TRUE SO MY ENGINE DOESN'T SCREAM AT YOU
              _isReady = true;
        }
Exemplo n.º 5
0
        public void Load()
        {
            // LOAD THE INITIAL GAME STATE HERE

            _score = 0;

            //Camera initial position
            _camera = new Camera();
            _camera.PositionSpeed = 15;
            _camera.Move(_camera.Up, _maxCamHeight);
            _camera.Move(_camera.Backward, 2600);
            //Camera initial orientation
            Quaternion lookAtCenter = Geometric.FreeLookAt(_camera.Position, new Vector3(0, 0, 0), new Vector3(0, 1, 0));
            _camera.Forward = Geometric.Quaternion_Rotate(lookAtCenter, _camera.Forward);
            _camera.Up = Geometric.Quaternion_Rotate(lookAtCenter, _camera.Up);
            //Camera -> FIRST THING TO DO IS INITIZIALIZE RENDERER WITH A Camera
            Renderer.CurrentCamera = _camera;

            //Setup cursor plane
            _cursorField = new Plane(0, 1, 0, 0);

            //Initializing lists
            _asteroids = new List<Asteroid>();
            _num_asteroids_on_screen = 0;
            _total_spawned_asteroids = 0;
            _bullets = new List<Bullet>();

            //The following loaded values have been chosen to keep limits symmetric and have a reasonable dynamic camera view for the game
            _spawnpoints = new Vector3[5];
            _spawnpoint_angles = new float[5];
            _spawnpoint_times = new float[5] { 0, 0, 0, 0, 0 };
            _spawnRange = Constants.pi_float / 6;
            _spawnpoints[0] = new Vector3(4000, 0, 1250);
            _spawnpoint_angles[0] = 3 * Constants.pi_float / 2 - Constants.pi_float / 6;
            _spawnpoints[1] = new Vector3(3000, 0, 3500);
            _spawnpoint_angles[1] = 2 * Constants.pi_float - Constants.pi_float / 4 - Constants.pi_float / 2;
            _spawnpoints[2] = new Vector3(0, 0, 4500);
            _spawnpoint_angles[2] = 3 * (Constants.pi_float / 2) - Constants.pi_float / 2;
            _spawnpoints[3] = new Vector3(-3000, 0, 3500);
            _spawnpoint_angles[3] = Constants.pi_float + Constants.pi_float / 4 - Constants.pi_float / 2;
            _spawnpoints[4] = new Vector3(-4000, 0, 1250);
            _spawnpoint_angles[4] = Constants.pi_float + Constants.pi_float / 6 - Constants.pi_float / 2;

            //Skybox setup (REMOVED)
            /*
            _skybox = new SkyBox();
            _skybox.Scale = new Vector3(20000, 20000, 20000);
            _skybox.Left = TextureManager.Get("SkyboxLeft");
            _skybox.Right = TextureManager.Get("SkyboxRight");
            _skybox.Front = TextureManager.Get("SkyboxFront");
            _skybox.Back = TextureManager.Get("SkyboxBack");
            _skybox.Top = TextureManager.Get("SkyboxTop");
            _skybox.Bottom = TextureManager.Get("SkyboxBottom");
             */

            //Models setup
            _playerCursor = new Static("cursor", "Crosshair_model");
            _playerCursor.StaticModel.Scale = new Vector3(200, 200, 200);
            _cursorAnimationRotation = 0;

            _planet = new StaticModel[2];
            _planet[0] = StaticModelManager.GetModel("Planet_model");
            _planet[0].Scale = new Vector3(15000, 1, 15000);
            _planet[0].Orientation = Geometric.Generate_Quaternion(0, 0, 0, 0);
            _planet[0].Position = new Vector3(0, -1000, 0);
            _planet[1] = StaticModelManager.GetModel("Planet_model");
            _planet[1].Scale = _planet[0].Scale;
            _planet[1].Orientation = _planet[0].Orientation;
            _planet[1].Position = new Vector3(0, -1000, _planet[0].Position.Z + _planet[0].Scale.Z);     //Because planet model is a 1x1 square

            _dreadnaught = new Dreadnaught("player");
            _dreadnaught.Position = new Vector3(0, 0, -1400);
            _dreadnaught.Orientation = Geometric.Generate_Quaternion(0, 0, 0, 0);
            _dreadnaught.Scale = new Vector3(10, 10, 10);

            //Setup font
            Renderer.Font = TextManager.GetFont("Calibri");

            // ONCE YOU ARE DONE LOADING, BE SURE TO SET YOUR READY 
            // PROPERTY TO TRUE SO MY ENGINE DOESN'T SCREAM AT YOU
            _isReady = true;

        }
Exemplo n.º 6
0
        public SkyboxState()
        {
            // Creates a camera and sets the initial positions
              _camera = new Camera();
              _camera.PositionSpeed = 5;
              _camera.Move(_camera.Up, 400);
              _camera.Move(_camera.Backward, 1500);
              _camera.Move(_camera.Backward, 300);

              // Gets a copy of the "Terrain" model and tracks the number of hardware instances of each component
              _terrain = StaticModelManager.GetModel("Terrain");
              _terrain.Scale = new Vector(500, 20, 500);
              _terrain.RotationAmmounts = new Vector(0, 0, 0);
              _terrain.Position = new Vector(0, 0, 0);

              // Gets a copy of the "RedRanger" model and tracks the number of hardware instances of each component
              _redRanger = StaticModelManager.GetModel("RedRanger");
              _redRanger.RotationAmmounts = new Vector(0, 1, 0);
              _redRanger.RotationAngle = 180f;
              _redRanger.Scale = new Vector(5, 5, 5);
              _redRanger.Position = new Vector(_terrain.Position.X + 200, _terrain.Position.Y + 130, _terrain.Position.Z);

              // Gets a copy of the "YellowRanger" model and tracks the number of hardware instances of each component
              _yellowRanger = StaticModelManager.GetModel("YellowRanger");
              _yellowRanger.RotationAmmounts = new Vector(0, 1, 1);
              _yellowRanger.Scale = new Vector(10, 10, 10);
              _yellowRanger.Position = new Vector(_terrain.Position.X + 100, _terrain.Position.Y + 130, _terrain.Position.Z);

              // Gets a copy of the "BlackRanger" model and tracks the number of hardware instances of each component
              _blackRanger = StaticModelManager.GetModel("BlackRanger");
              _blackRanger.RotationAmmounts = new Vector(1, 1, 0);
              _blackRanger.Scale = new Vector(10, 10, 10);
              _blackRanger.Position = new Vector(_terrain.Position.X + 0, _terrain.Position.Y + 130, _terrain.Position.Z);

              // Gets a copy of the "BlueRanger" model and tracks the number of hardware instances of each component
              _blueRanger = StaticModelManager.GetModel("BlueRanger");
              _blueRanger.RotationAmmounts = new Vector(0, 1, 2);
              _blueRanger.Scale = new Vector(10, 10, 10);
              _blueRanger.Position = new Vector(_terrain.Position.X - 200, _terrain.Position.Y + 130, _terrain.Position.Z);

              // Gets a copy of the "PinkRanger" model and tracks the number of hardware instances of each component
              _pinkRanger = StaticModelManager.GetModel("PinkRanger");
              _pinkRanger.RotationAmmounts = new Vector(0, 1, 0);
              _pinkRanger.Scale = new Vector(10, 10, 10);
              _pinkRanger.Position = new Vector(_terrain.Position.X - 100, _terrain.Position.Y + 130, _terrain.Position.Z);

              // Gets a copy of the "RedRangerSeven" model and tracks the number of hardware instances of each component
              _RedRangerTwo = StaticModelManager.GetModel("RedRangerSeven");
              _RedRangerTwo.RotationAmmounts = new Vector(0, 1, 0);
              _RedRangerTwo.Scale = new Vector(20, 20, 20);
              _RedRangerTwo.Position = new Vector(_terrain.Position.X - 500, _terrain.Position.Y + 130, _terrain.Position.Z + 700);

              _skybox = new SkyBox();
              _skybox.Scale.X = 10000;
              _skybox.Scale.Y = 10000;
              _skybox.Scale.Z = 10000;
              _skybox.Left = TextureManager.Get("SkyboxLeft");
              _skybox.Right = TextureManager.Get("SkyboxRight");
              _skybox.Front = TextureManager.Get("SkyboxFront");
              _skybox.Back = TextureManager.Get("SkyboxBack");
              _skybox.Top = TextureManager.Get("SkyboxTop");
        }
Exemplo n.º 7
0
    public void Load()
    {
      _camera = new Camera();
      _camera.PositionSpeed = 5;
      _camera.Move(_camera.Up, 400);
      _camera.Move(_camera.Backward, 1500);
      _camera.Move(_camera.Backward, 300);

      _skybox = new SkyBox();
      _skybox.Scale.X = 10000;
      _skybox.Scale.Y = 10000;
      _skybox.Scale.Z = 10000;
      _skybox.Left = TextureManager.Get("SkyboxLeft");
      _skybox.Right = TextureManager.Get("SkyboxRight");
      _skybox.Front = TextureManager.Get("SkyboxFront");
      _skybox.Back = TextureManager.Get("SkyboxBack");
      _skybox.Top = TextureManager.Get("SkyboxTop");

      _terrain = StaticModelManager.GetModel("Terrain");
      _terrain.Scale = new Vector(500, 20, 500);
      _terrain.Orientation = new Quaternion(0, 0, 0, 0);
      _terrain.Position = new Vector(0, 0, 0);

      _mushroomCloud = StaticModelManager.GetModel("MushroomCloud");
      _mushroomCloud.Scale = new Vector(500, 20, 500);
      _mushroomCloud.Orientation = new Quaternion(0, 0, 0, 0);
      _mushroomCloud.Position.X = 0;
      _mushroomCloud.Position.Y = _terrain.Position.Y + 30;
      _mushroomCloud.Position.Z = 0;
      _time = 0;
      _bool = false;

      _mountain = StaticModelManager.GetModel("Mountain");
      _mountain.Scale = new Vector(5000, 5000, 5000);
      _mountain.Orientation = new Quaternion(0, 0, 0, 0);
      _mountain.Position = new Vector(4000, 0, 1000);

      _mountain2 = StaticModelManager.GetModel("Mountain2");
      _mountain2.Scale = new Vector(3500, 3500, 3500);
      _mountain2.Orientation = new Quaternion(0, 0, 0, 0);
      _mountain2.Position = new Vector(0, 0, 2500);

      string[] colors = new string[] { "YellowRanger", "RedRanger", "BlueRanger", "BlackRanger", "PinkRanger" };

      Random random = new Random();
      _rangers = new StaticModel[80];
      for (int i = 0; i < _rangers.Length; i++)
      {
        _rangers[i] = StaticModelManager.GetModel(colors[random.Next(0, 5)]);
        _rangers[i].Position.X = -100;
        _rangers[i].Position.Y = _terrain.Position.Y + 10;
        _rangers[i].Position.Z = -i * 50;
        _rangers[i].Scale = new Vector(5, 5, 5);
        _rangers[i].Orientation = new Quaternion(0, 1, 0, 0);
        _rangers[i].Orientation.W = i * 2;
        _rangers[i].Id = "Ranger" + i;
        _octree.Add(_rangers[i]);
      }

      _tuxes = new StaticModel[80];
      for (int i = 0; i < _tuxes.Length; i++)
      {
        _tuxes[i] = StaticModelManager.GetModel("Tux");
        _tuxes[i].Position.X = 100;
        _tuxes[i].Position.Y = _terrain.Position.Y + 10;
        _tuxes[i].Position.Z = i * 50;
        _tuxes[i].Scale = new Vector(25, 25, 25);
        _tuxes[i].Orientation = new Quaternion(0, 1, 0, 0);
        _tuxes[i].Orientation.W = i * 2;
        _tuxes[i].Id = "Tux" + i;
        _octree.Add(_tuxes[i]);
      }

      for (int i = 0; i < _rangers.Length; i += 2)
      {
        _rangers[i].Meshes.Remove("Body");
        //_octree.Remove("Ranger" + i);
        _tuxes[i].Meshes.Remove("Body");
      }

      Renderer.Font = TextManager.GetFont("Calibri");

      // ONCE YOU ARE DONE LOADING, BE SURE TO SET YOUR READY 
      // PROPERTY TO TRUE SO MY ENGINE DOESN'T SCREAM AT YOU
      _isReady = true;
    }