Exemple #1
0
 public static int CompareTo(Static left, Static right) { return left.Id.CompareTo(right.Id); }
Exemple #2
0
 public static int CompareTo(Static left, string right) { return left.Id.CompareTo(right); }
        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;

        }