예제 #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 <float>(500, 20, 500);
            //_terrain.RotationAmmounts = new Vector<float>(0, 0, 0);
            _terrain.Position = new Vector <float>(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;
        }
예제 #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 <float>(500, 20, 500);
            _terrain.Orientation = new Quaternion <float>(0, 0, 0, 0);
            _terrain.Position    = new Vector <float>(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 <float>(0, 1, 0, 0);
            //_redRanger.RotationAngle = 180f;
            _redRanger.Scale    = new Vector <float>(5, 5, 5);
            _redRanger.Position = new Vector <float>(_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 <float>(0, 1, 1, 0);
            _yellowRanger.Scale       = new Vector <float>(10, 10, 10);
            _yellowRanger.Position    = new Vector <float>(_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 <float>(1, 1, 0, 0);
            _blackRanger.Scale       = new Vector <float>(10, 10, 10);
            _blackRanger.Position    = new Vector <float>(_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 <float>(0, 1, 2, 0);
            _blueRanger.Scale       = new Vector <float>(10, 10, 10);
            _blueRanger.Position    = new Vector <float>(_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 <float>(0, 1, 0, 0);
            _pinkRanger.Scale       = new Vector <float>(10, 10, 10);
            _pinkRanger.Position    = new Vector <float>(_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 <float>(0, 1, 0, 0);
            _RedRangerTwo.Scale       = new Vector <float>(20, 20, 20);
            _RedRangerTwo.Position    = new Vector <float>(_terrain.Position.X - 500, _terrain.Position.Y + 130, _terrain.Position.Z + 700);

            _isReady = true;
        }
예제 #3
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 <float>(500, 20, 500);
            _terrain.Orientation = new Quaternion <float>(0, 0, 0, 0);
            _terrain.Position    = new Vector <float>(0, 0, 0);

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

            _mountain2             = StaticModelManager.GetModel("Mountain2");
            _mountain2.Scale       = new Vector <float>(3500, 3500, 3500);
            _mountain2.Orientation = new Quaternion <float>(0, 0, 0, 0);
            _mountain2.Position    = new Vector <float>(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;
        }
예제 #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 <float>(500, 20, 500);
            _terrain.Orientation = new Quaternion <float>(0, 0, 0, 0);
            _terrain.Position    = new Vector <float>(0, 0, 0);

            _mushroomCloud             = StaticModelManager.GetModel("MushroomCloud");
            _mushroomCloud.Scale       = new Vector <float>(500, 20, 500);
            _mushroomCloud.Orientation = new Quaternion <float>(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 <float>(5000, 5000, 5000);
            _mountain.Orientation = new Quaternion <float>(0, 0, 0, 0);
            _mountain.Position    = new Vector <float>(4000, 0, 1000);

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

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

            System.Random random = new System.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 <float>(5, 5, 5);
                _rangers[i].Orientation   = new Quaternion <float>(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 <float>(25, 25, 25);
                _tuxes[i].Orientation   = new Quaternion <float>(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<string>("Body", (StaticMesh mesh, string key) => { return mesh.Id.CompareTo(key); });
            //  //_octree.Remove("Ranger" + i);
            //  _tuxes[i].Meshes.Remove<string>("Body", (StaticMesh mesh, string key) => { return mesh.Id.CompareTo(key); });
            //}

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

            _dodeca = StaticModelManager.GetModel("Dodecahedron");

            // ONCE YOU ARE DONE LOADING, BE SURE TO SET YOUR READY
            // PROPERTY TO TRUE SO MY ENGINE DOESN'T SCREAM AT YOU
            _isReady = true;
        }
예제 #5
0
        private void GenerateUnits()
        {
            _powerRangerCount = _rangedCount + _meleeCount + _kamakaziCount;
            _tuxCount         = _rangedCount + _meleeCount + _kamakaziCount;

            _octree =
                new Omnitree_Array <Unit, double>(
                    new double[] { -100000, -100000, -100000 },
                    new double[] { 100000, 100000, 100000 },
                    (Omnitree.Locate <Unit, double>)((Unit i, out double[] location) => { location = new double[] { i.Position.X, i.Position.Y, i.Position.Z }; }),
                    (double left, double right) =>
            {
                int comparison = left.CompareTo(right);
                if (comparison > 0)
                {
                    return(Comparison.Greater);
                }
                else if (comparison < 0)
                {
                    return(Comparison.Less);
                }
                else
                {
                    return(Comparison.Equal);
                }
            },
                    (double left, double right) => { return((left + right) * .5d); });

            lines = new AvlTree_Linked <Link <Vector <float>, Vector <float>, Color> >(Compare);

            explosions = new List_Array <Explosion>(1);

            _zackMelee      = new Unit[_meleeCount];
            _zackRanged     = new Unit[_rangedCount];
            _zackKamakazi   = new Unit[_kamakaziCount];
            _killemMelee    = new Unit[_meleeCount];
            _killemRanged   = new Unit[_rangedCount];
            _killemKamakazi = new Unit[_kamakaziCount];

            Random random = new Random();

            string[] colors = new string[] { "YellowRanger", "RedRanger", "BlueRanger", "BlackRanger", "PinkRanger" };
            #region Map 0
            if (_map == 0)
            {
                int maxXZack = -1500;
                int minXZack = -2000;

                int maxZZack = 0;
                int minZZack = -1500;

                int maxXKillem = 2000;
                int minXKillem = 1500;

                int maxZKillem = 0;
                int minZKillem = -1500;

                for (int i = 0; i < _meleeCount; i++)
                {
                    _zackMelee[i] = new ZackMelee("ZackMelee" + i, StaticModelManager.GetModel("BlackRanger"));
                    _zackMelee[i].StaticModel.Position.X = random.Next(minXZack, maxXZack);
                    if (_3d)
                    {
                        _zackMelee[i].StaticModel.Position.Y = _terrain.Position.Y + 10 + random.Next(0, 1000);
                    }
                    else
                    {
                        _zackMelee[i].StaticModel.Position.Y = _terrain.Position.Y + 10;
                    }
                    _zackMelee[i].StaticModel.Position.Z  = random.Next(minZZack, maxZZack);
                    _zackMelee[i].StaticModel.Scale       = new Vector <float>(5, 5, 5);
                    _zackMelee[i].StaticModel.Orientation = new Quaternion <float>(0, 1, 0, 0);
                    _octree.Add(_zackMelee[i]);

                    _killemMelee[i] = new KillemMelee("KillemMelee" + i, StaticModelManager.GetModel("Tux"));
                    _killemMelee[i].StaticModel.Position.X = random.Next(minXKillem, maxXKillem);
                    if (_3d)
                    {
                        _killemMelee[i].StaticModel.Position.Y = _terrain.Position.Y + 10 + random.Next(0, 1000);
                    }
                    else
                    {
                        _killemMelee[i].StaticModel.Position.Y = _terrain.Position.Y + 10;
                    }
                    _killemMelee[i].StaticModel.Position.Z  = random.Next(minZKillem, maxZKillem);
                    _killemMelee[i].StaticModel.Scale       = new Vector <float>(20, 20, 20);
                    _killemMelee[i].StaticModel.Orientation = new Quaternion <float>(0, 1, 0, -Constants.pi_float / 2);
                    _octree.Add(_killemMelee[i]);
                }

                for (int i = 0; i < _rangedCount; i++)
                {
                    _zackRanged[i] = new ZackRanged("ZackRanged" + i, StaticModelManager.GetModel("BlueRanger"));
                    _zackRanged[i].StaticModel.Position.X = random.Next(minXZack, maxXZack);
                    if (_3d)
                    {
                        _zackRanged[i].StaticModel.Position.Y = _terrain.Position.Y + 10 + random.Next(0, 1000);
                    }
                    else
                    {
                        _zackRanged[i].StaticModel.Position.Y = _terrain.Position.Y + 10;
                    }
                    _zackRanged[i].StaticModel.Position.Z  = random.Next(minZZack, maxZZack);
                    _zackRanged[i].StaticModel.Scale       = new Vector <float>(5, 5, 5);
                    _zackRanged[i].StaticModel.Orientation = new Quaternion <float>(0, 1, 0, 0);
                    _octree.Add(_zackRanged[i]);

                    _killemRanged[i] = new KillemRanged("KillemRanged" + i, StaticModelManager.GetModel("TuxGreen"));
                    _killemRanged[i].StaticModel.Position.X = random.Next(minXKillem, maxXKillem);
                    if (_3d)
                    {
                        _killemRanged[i].StaticModel.Position.Y = _terrain.Position.Y + 10 + random.Next(0, 1000);
                    }
                    else
                    {
                        _killemRanged[i].StaticModel.Position.Y = _terrain.Position.Y + 10;
                    }
                    _killemRanged[i].StaticModel.Position.Z  = random.Next(minZKillem, maxZKillem);
                    _killemRanged[i].StaticModel.Scale       = new Vector <float>(20, 20, 20);
                    _killemRanged[i].StaticModel.Orientation = new Quaternion <float>(0, 1, 0, -Constants.pi_float / 2);
                    _killemRanged[i].Id = "Ranger" + i;
                    _octree.Add(_killemRanged[i]);
                }

                for (int i = 0; i < _kamakaziCount; i++)
                {
                    _zackKamakazi[i] = new ZackKamakazi("ZackKamakazi" + i, StaticModelManager.GetModel("RedRanger"));
                    _zackKamakazi[i].StaticModel.Position.X = random.Next(minXZack, maxXZack);
                    if (_3d)
                    {
                        _zackKamakazi[i].StaticModel.Position.Y = _terrain.Position.Y + 10 + random.Next(0, 1000);
                    }
                    else
                    {
                        _zackKamakazi[i].StaticModel.Position.Y = _terrain.Position.Y + 10;
                    }
                    _zackKamakazi[i].StaticModel.Position.Z  = random.Next(minZZack, maxZZack);
                    _zackKamakazi[i].StaticModel.Scale       = new Vector <float>(5, 5, 5);
                    _zackKamakazi[i].StaticModel.Orientation = new Quaternion <float>(0, 1, 0, 0);
                    _octree.Add(_zackKamakazi[i]);

                    _killemKamakazi[i] = new KillemKamakazi("KillemKamakazi" + i, StaticModelManager.GetModel("TuxRed"));
                    _killemKamakazi[i].StaticModel.Position.X = random.Next(minXKillem, maxXKillem);
                    if (_3d)
                    {
                        _killemKamakazi[i].StaticModel.Position.Y = _terrain.Position.Y + 10 + random.Next(0, 1000);
                    }
                    else
                    {
                        _killemKamakazi[i].StaticModel.Position.Y = _terrain.Position.Y + 10;
                    }
                    _killemKamakazi[i].StaticModel.Position.Z  = random.Next(minZKillem, maxZKillem);
                    _killemKamakazi[i].StaticModel.Scale       = new Vector <float>(20, 20, 20);
                    _killemKamakazi[i].StaticModel.Orientation = new Quaternion <float>(0, 1, 0, -Constants.pi_float / 2);
                    _octree.Add(_killemKamakazi[i]);
                }
            }
            #endregion
            #region Map 1
            else if (_map == 1)
            {
                int maxXZack  = -800;
                int minXZack  = -1300;
                int maxZZack  = -800;
                int minZZack  = -1300;
                int maxXZack2 = 1300;
                int minXZack2 = 800;
                int maxZZack2 = 1300;
                int minZZack2 = 800;

                int maxXKillem  = -800;
                int minXKillem  = -1300;
                int maxZKillem  = 1300;
                int minZKillem  = 800;
                int maxXKillem2 = 1300;
                int minXKillem2 = 800;
                int maxZKillem2 = -800;
                int minZKillem2 = -1300;

                for (int i = 0; i < _meleeCount; i++)
                {
                    if (i < _meleeCount / 2)
                    {
                        _zackMelee[i] = new ZackMelee("ZackMelee" + i, StaticModelManager.GetModel("BlackRanger"));
                        _zackMelee[i].StaticModel.Position.X = random.Next(minXZack, maxXZack);
                        if (_3d)
                        {
                            _zackMelee[i].StaticModel.Position.Y = _terrain.Position.Y + 10 + random.Next(0, 1000);
                        }
                        else
                        {
                            _zackMelee[i].StaticModel.Position.Y = _terrain.Position.Y + 10;
                        }
                        _zackMelee[i].StaticModel.Position.Z  = random.Next(minZZack, maxZZack);
                        _zackMelee[i].StaticModel.Scale       = new Vector <float>(5, 5, 5);
                        _zackMelee[i].StaticModel.Orientation = new Quaternion <float>(0, 1, 0, 0);
                        _octree.Add(_zackMelee[i]);

                        _killemMelee[i] = new KillemMelee("KillemMelee" + i, StaticModelManager.GetModel("Tux"));
                        _killemMelee[i].StaticModel.Position.X = random.Next(minXKillem, maxXKillem);
                        if (_3d)
                        {
                            _killemMelee[i].StaticModel.Position.Y = _terrain.Position.Y + 10 + random.Next(0, 1000);
                        }
                        else
                        {
                            _killemMelee[i].StaticModel.Position.Y = _terrain.Position.Y + 10;
                        }
                        _killemMelee[i].StaticModel.Position.Z  = random.Next(minZKillem, maxZKillem);
                        _killemMelee[i].StaticModel.Scale       = new Vector <float>(20, 20, 20);
                        _killemMelee[i].StaticModel.Orientation = new Quaternion <float>(0, 1, 0, -Constants.pi_float / 2);
                        _octree.Add(_killemMelee[i]);
                    }
                    else
                    {
                        _zackMelee[i] = new ZackMelee("ZackMelee" + i, StaticModelManager.GetModel("BlackRanger"));
                        _zackMelee[i].StaticModel.Position.X = random.Next(minXZack2, maxXZack2);
                        if (_3d)
                        {
                            _zackMelee[i].StaticModel.Position.Y = _terrain.Position.Y + 10 + random.Next(0, 1000);
                        }
                        else
                        {
                            _zackMelee[i].StaticModel.Position.Y = _terrain.Position.Y + 10;
                        }
                        _zackMelee[i].StaticModel.Position.Z  = random.Next(minZZack2, maxZZack2);
                        _zackMelee[i].StaticModel.Scale       = new Vector <float>(5, 5, 5);
                        _zackMelee[i].StaticModel.Orientation = new Quaternion <float>(0, 1, 0, 0);
                        _octree.Add(_zackMelee[i]);

                        _killemMelee[i] = new KillemMelee("KillemMelee" + i, StaticModelManager.GetModel("Tux"));
                        _killemMelee[i].StaticModel.Position.X = random.Next(minXKillem2, maxXKillem2);
                        if (_3d)
                        {
                            _killemMelee[i].StaticModel.Position.Y = _terrain.Position.Y + 10 + random.Next(0, 1000);
                        }
                        else
                        {
                            _killemMelee[i].StaticModel.Position.Y = _terrain.Position.Y + 10;
                        }
                        _killemMelee[i].StaticModel.Position.Z  = random.Next(minZKillem2, maxZKillem2);
                        _killemMelee[i].StaticModel.Scale       = new Vector <float>(20, 20, 20);
                        _killemMelee[i].StaticModel.Orientation = new Quaternion <float>(0, 1, 0, -Constants.pi_float / 2);
                        _octree.Add(_killemMelee[i]);
                    }
                }

                for (int i = 0; i < _rangedCount; i++)
                {
                    if (i < _rangedCount / 2)
                    {
                        _zackRanged[i] = new ZackRanged("ZackRanged" + i, StaticModelManager.GetModel("BlueRanger"));
                        _zackRanged[i].StaticModel.Position.X = random.Next(minXZack, maxXZack);
                        if (_3d)
                        {
                            _zackRanged[i].StaticModel.Position.Y = _terrain.Position.Y + 10 + random.Next(0, 1000);
                        }
                        else
                        {
                            _zackRanged[i].StaticModel.Position.Y = _terrain.Position.Y + 10;
                        }
                        _zackRanged[i].StaticModel.Position.Z  = random.Next(minZZack, maxZZack);
                        _zackRanged[i].StaticModel.Scale       = new Vector <float>(5, 5, 5);
                        _zackRanged[i].StaticModel.Orientation = new Quaternion <float>(0, 1, 0, 0);
                        _octree.Add(_zackRanged[i]);

                        _killemRanged[i] = new KillemRanged("KillemRanged" + i, StaticModelManager.GetModel("TuxGreen"));
                        _killemRanged[i].StaticModel.Position.X = random.Next(minXKillem, maxXKillem);
                        if (_3d)
                        {
                            _killemRanged[i].StaticModel.Position.Y = _terrain.Position.Y + 10 + random.Next(0, 1000);
                        }
                        else
                        {
                            _killemRanged[i].StaticModel.Position.Y = _terrain.Position.Y + 10;
                        }
                        _killemRanged[i].StaticModel.Position.Z  = random.Next(minZKillem, maxZKillem);
                        _killemRanged[i].StaticModel.Scale       = new Vector <float>(20, 20, 20);
                        _killemRanged[i].StaticModel.Orientation = new Quaternion <float>(0, 1, 0, -Constants.pi_float / 2);
                        _killemRanged[i].Id = "Ranger" + i;
                        _octree.Add(_killemRanged[i]);
                    }
                    else
                    {
                        _zackRanged[i] = new ZackRanged("ZackRanged" + i, StaticModelManager.GetModel("BlueRanger"));
                        _zackRanged[i].StaticModel.Position.X = random.Next(minXZack2, maxXZack2);
                        if (_3d)
                        {
                            _zackRanged[i].StaticModel.Position.Y = _terrain.Position.Y + 10 + random.Next(0, 1000);
                        }
                        else
                        {
                            _zackRanged[i].StaticModel.Position.Y = _terrain.Position.Y + 10;
                        }
                        _zackRanged[i].StaticModel.Position.Z  = random.Next(minZZack2, maxZZack2);
                        _zackRanged[i].StaticModel.Scale       = new Vector <float>(5, 5, 5);
                        _zackRanged[i].StaticModel.Orientation = new Quaternion <float>(0, 1, 0, 0);
                        _octree.Add(_zackRanged[i]);

                        _killemRanged[i] = new KillemRanged("KillemRanged" + i, StaticModelManager.GetModel("TuxGreen"));
                        _killemRanged[i].StaticModel.Position.X = random.Next(minXKillem2, maxXKillem2);
                        if (_3d)
                        {
                            _killemRanged[i].StaticModel.Position.Y = _terrain.Position.Y + 10 + random.Next(0, 1000);
                        }
                        else
                        {
                            _killemRanged[i].StaticModel.Position.Y = _terrain.Position.Y + 10;
                        }
                        _killemRanged[i].StaticModel.Position.Z  = random.Next(minZKillem2, maxZKillem2);
                        _killemRanged[i].StaticModel.Scale       = new Vector <float>(20, 20, 20);
                        _killemRanged[i].StaticModel.Orientation = new Quaternion <float>(0, 1, 0, -Constants.pi_float / 2);
                        _killemRanged[i].Id = "Ranger" + i;
                        _octree.Add(_killemRanged[i]);
                    }
                }

                for (int i = 0; i < _kamakaziCount; i++)
                {
                    if (i < _kamakaziCount / 2)
                    {
                        _zackKamakazi[i] = new ZackKamakazi("ZackKamakazi" + i, StaticModelManager.GetModel("RedRanger"));
                        _zackKamakazi[i].StaticModel.Position.X = random.Next(minXZack, maxXZack);
                        if (_3d)
                        {
                            _zackKamakazi[i].StaticModel.Position.Y = _terrain.Position.Y + 10 + random.Next(0, 1000);
                        }
                        else
                        {
                            _zackKamakazi[i].StaticModel.Position.Y = _terrain.Position.Y + 10;
                        }
                        _zackKamakazi[i].StaticModel.Position.Z  = random.Next(minZZack, maxZZack);
                        _zackKamakazi[i].StaticModel.Scale       = new Vector <float>(5, 5, 5);
                        _zackKamakazi[i].StaticModel.Orientation = new Quaternion <float>(0, 1, 0, 0);
                        _octree.Add(_zackKamakazi[i]);

                        _killemKamakazi[i] = new KillemKamakazi("KillemKamakazi" + i, StaticModelManager.GetModel("TuxRed"));
                        _killemKamakazi[i].StaticModel.Position.X = random.Next(minXKillem, maxXKillem);
                        if (_3d)
                        {
                            _killemKamakazi[i].StaticModel.Position.Y = _terrain.Position.Y + 10 + random.Next(0, 1000);
                        }
                        else
                        {
                            _killemKamakazi[i].StaticModel.Position.Y = _terrain.Position.Y + 10;
                        }
                        _killemKamakazi[i].StaticModel.Position.Z  = random.Next(minZKillem, maxZKillem);
                        _killemKamakazi[i].StaticModel.Scale       = new Vector <float>(20, 20, 20);
                        _killemKamakazi[i].StaticModel.Orientation = new Quaternion <float>(0, 1, 0, -Constants.pi_float / 2);
                        _octree.Add(_killemKamakazi[i]);
                    }
                    else
                    {
                        _zackKamakazi[i] = new ZackKamakazi("ZackKamakazi" + i, StaticModelManager.GetModel("RedRanger"));
                        _zackKamakazi[i].StaticModel.Position.X = random.Next(minXZack2, maxXZack2);
                        if (_3d)
                        {
                            _zackKamakazi[i].StaticModel.Position.Y = _terrain.Position.Y + 10 + random.Next(0, 1000);
                        }
                        else
                        {
                            _zackKamakazi[i].StaticModel.Position.Y = _terrain.Position.Y + 10;
                        }
                        _zackKamakazi[i].StaticModel.Position.Z  = random.Next(minZZack2, maxZZack2);
                        _zackKamakazi[i].StaticModel.Scale       = new Vector <float>(5, 5, 5);
                        _zackKamakazi[i].StaticModel.Orientation = new Quaternion <float>(0, 1, 0, 0);
                        _octree.Add(_zackKamakazi[i]);

                        _killemKamakazi[i] = new KillemKamakazi("KillemKamakazi" + i, StaticModelManager.GetModel("TuxRed"));
                        _killemKamakazi[i].StaticModel.Position.X = random.Next(minXKillem2, maxXKillem2);
                        if (_3d)
                        {
                            _killemKamakazi[i].StaticModel.Position.Y = _terrain.Position.Y + 10 + random.Next(0, 1000);
                        }
                        else
                        {
                            _killemKamakazi[i].StaticModel.Position.Y = _terrain.Position.Y + 10;
                        }
                        _killemKamakazi[i].StaticModel.Position.Z  = random.Next(minZKillem2, maxZKillem2);
                        _killemKamakazi[i].StaticModel.Scale       = new Vector <float>(20, 20, 20);
                        _killemKamakazi[i].StaticModel.Orientation = new Quaternion <float>(0, 1, 0, -Constants.pi_float / 2);
                        _octree.Add(_killemKamakazi[i]);
                    }
                }
            }
            #endregion
            #region Map 2
            if (_map == 2)
            {
                int maxXZack = 250;
                int minXZack = -250;
                int maxZZack = 250;
                int minZZack = -250;

                int maxXKillem = 250;
                int minXKillem = -250;
                int maxZKillem = 250;
                int minZKillem = -250;

                for (int i = 0; i < _meleeCount; i++)
                {
                    _zackMelee[i] = new ZackMelee("ZackMelee" + i, StaticModelManager.GetModel("BlackRanger"));
                    _zackMelee[i].StaticModel.Position.X = random.Next(minXZack, maxXZack);
                    if (_3d)
                    {
                        _zackMelee[i].StaticModel.Position.Y = _terrain.Position.Y + 10 + random.Next(0, 1000);
                    }
                    else
                    {
                        _zackMelee[i].StaticModel.Position.Y = _terrain.Position.Y + 10;
                    }
                    _zackMelee[i].StaticModel.Position.Z  = random.Next(minZZack, maxZZack);
                    _zackMelee[i].StaticModel.Scale       = new Vector <float>(5, 5, 5);
                    _zackMelee[i].StaticModel.Orientation = new Quaternion <float>(0, 1, 0, 0);
                    _octree.Add(_zackMelee[i]);

                    _killemMelee[i] = new KillemMelee("KillemMelee" + i, StaticModelManager.GetModel("Tux"));
                    _killemMelee[i].StaticModel.Position.X = random.Next(minXKillem, maxXKillem);
                    if (_3d)
                    {
                        _killemMelee[i].StaticModel.Position.Y = _terrain.Position.Y + 10 + random.Next(0, 1000);
                    }
                    else
                    {
                        _killemMelee[i].StaticModel.Position.Y = _terrain.Position.Y + 10;
                    }
                    _killemMelee[i].StaticModel.Position.Z  = random.Next(minZKillem, maxZKillem);
                    _killemMelee[i].StaticModel.Scale       = new Vector <float>(20, 20, 20);
                    _killemMelee[i].StaticModel.Orientation = new Quaternion <float>(0, 1, 0, -Constants.pi_float / 2);
                    _octree.Add(_killemMelee[i]);
                }

                for (int i = 0; i < _rangedCount; i++)
                {
                    _zackRanged[i] = new ZackRanged("ZackRanged" + i, StaticModelManager.GetModel("BlueRanger"));
                    _zackRanged[i].StaticModel.Position.X = random.Next(minXZack, maxXZack);
                    if (_3d)
                    {
                        _zackRanged[i].StaticModel.Position.Y = _terrain.Position.Y + 10 + random.Next(0, 1000);
                    }
                    else
                    {
                        _zackRanged[i].StaticModel.Position.Y = _terrain.Position.Y + 10;
                    }
                    _zackRanged[i].StaticModel.Position.Z  = random.Next(minZZack, maxZZack);
                    _zackRanged[i].StaticModel.Scale       = new Vector <float>(5, 5, 5);
                    _zackRanged[i].StaticModel.Orientation = new Quaternion <float>(0, 1, 0, 0);
                    _octree.Add(_zackRanged[i]);

                    _killemRanged[i] = new KillemRanged("KillemRanged" + i, StaticModelManager.GetModel("TuxGreen"));
                    _killemRanged[i].StaticModel.Position.X = random.Next(minXKillem, maxXKillem);
                    if (_3d)
                    {
                        _killemRanged[i].StaticModel.Position.Y = _terrain.Position.Y + 10 + random.Next(0, 1000);
                    }
                    else
                    {
                        _killemRanged[i].StaticModel.Position.Y = _terrain.Position.Y + 10;
                    }
                    _killemRanged[i].StaticModel.Position.Z  = random.Next(minZKillem, maxZKillem);
                    _killemRanged[i].StaticModel.Scale       = new Vector <float>(20, 20, 20);
                    _killemRanged[i].StaticModel.Orientation = new Quaternion <float>(0, 1, 0, -Constants.pi_float / 2);
                    _killemRanged[i].Id = "Ranger" + i;
                    _octree.Add(_killemRanged[i]);
                }

                // CIRCLE: radius ^ 2 = x ^ 2 + z ^ 2
                float radiusSquared = 1000000f;

                for (int i = 0; i < _kamakaziCount; i++)
                {
                    float x = random.Next(-1000, 1000);

                    _zackKamakazi[i] = new ZackKamakazi("ZackKamakazi" + i, StaticModelManager.GetModel("RedRanger"));
                    _zackKamakazi[i].StaticModel.Position.X = x;
                    if (_3d)
                    {
                        _zackKamakazi[i].StaticModel.Position.Y = _terrain.Position.Y + 10 + random.Next(0, 1000);
                    }
                    else
                    {
                        _zackKamakazi[i].StaticModel.Position.Y = _terrain.Position.Y + 10;
                    }
                    _zackKamakazi[i].StaticModel.Position.Z  = Algebra.sqrt(radiusSquared - x * x);
                    _zackKamakazi[i].StaticModel.Scale       = new Vector <float>(5, 5, 5);
                    _zackKamakazi[i].StaticModel.Orientation = new Quaternion <float>(0, 1, 0, 0);
                    _octree.Add(_zackKamakazi[i]);

                    _killemKamakazi[i] = new KillemKamakazi("KillemKamakazi" + i, StaticModelManager.GetModel("TuxRed"));
                    _killemKamakazi[i].StaticModel.Position.X = x;
                    if (_3d)
                    {
                        _killemKamakazi[i].StaticModel.Position.Y = _terrain.Position.Y + 10 + random.Next(0, 1000);
                    }
                    else
                    {
                        _killemKamakazi[i].StaticModel.Position.Y = _terrain.Position.Y + 10;
                    }
                    _killemKamakazi[i].StaticModel.Position.Z  = -Algebra.sqrt(radiusSquared - x * x);
                    _killemKamakazi[i].StaticModel.Scale       = new Vector <float>(20, 20, 20);
                    _killemKamakazi[i].StaticModel.Orientation = new Quaternion <float>(0, 1, 0, -Constants.pi_float / 2);
                    _octree.Add(_killemKamakazi[i]);
                }
            }
            #endregion
            #region Map 3
            if (_map == 3)
            {
                int maxXZack = 2000;
                int minXZack = -2000;

                int maxZZack = 2000;
                int minZZack = -2000;

                int maxXKillem = 2000;
                int minXKillem = -2000;

                int maxZKillem = 2000;
                int minZKillem = -2000;

                for (int i = 0; i < _meleeCount; i++)
                {
                    _zackMelee[i] = new ZackMelee("ZackMelee" + i, StaticModelManager.GetModel("BlackRanger"));
                    _zackMelee[i].StaticModel.Position.X = random.Next(minXZack, maxXZack);
                    if (_3d)
                    {
                        _zackMelee[i].StaticModel.Position.Y = _terrain.Position.Y + 10 + random.Next(0, 1000);
                    }
                    else
                    {
                        _zackMelee[i].StaticModel.Position.Y = _terrain.Position.Y + 10;
                    }
                    _zackMelee[i].StaticModel.Position.Z  = random.Next(minZZack, maxZZack);
                    _zackMelee[i].StaticModel.Scale       = new Vector <float>(5, 5, 5);
                    _zackMelee[i].StaticModel.Orientation = new Quaternion <float>(0, 1, 0, 0);
                    _octree.Add(_zackMelee[i]);

                    _killemMelee[i] = new KillemMelee("KillemMelee" + i, StaticModelManager.GetModel("Tux"));
                    _killemMelee[i].StaticModel.Position.X = random.Next(minXKillem, maxXKillem);
                    if (_3d)
                    {
                        _killemMelee[i].StaticModel.Position.Y = _terrain.Position.Y + 10 + random.Next(0, 1000);
                    }
                    else
                    {
                        _killemMelee[i].StaticModel.Position.Y = _terrain.Position.Y + 10;
                    }
                    _killemMelee[i].StaticModel.Position.Z  = random.Next(minZKillem, maxZKillem);
                    _killemMelee[i].StaticModel.Scale       = new Vector <float>(20, 20, 20);
                    _killemMelee[i].StaticModel.Orientation = new Quaternion <float>(0, 1, 0, -Constants.pi_float / 2);
                    _octree.Add(_killemMelee[i]);
                }

                for (int i = 0; i < _rangedCount; i++)
                {
                    _zackRanged[i] = new ZackRanged("ZackRanged" + i, StaticModelManager.GetModel("BlueRanger"));
                    _zackRanged[i].StaticModel.Position.X = random.Next(minXZack, maxXZack);
                    if (_3d)
                    {
                        _zackRanged[i].StaticModel.Position.Y = _terrain.Position.Y + 10 + random.Next(0, 1000);
                    }
                    else
                    {
                        _zackRanged[i].StaticModel.Position.Y = _terrain.Position.Y + 10;
                    }
                    _zackRanged[i].StaticModel.Position.Z  = random.Next(minZZack, maxZZack);
                    _zackRanged[i].StaticModel.Scale       = new Vector <float>(5, 5, 5);
                    _zackRanged[i].StaticModel.Orientation = new Quaternion <float>(0, 1, 0, 0);
                    _octree.Add(_zackRanged[i]);

                    _killemRanged[i] = new KillemRanged("KillemRanged" + i, StaticModelManager.GetModel("TuxGreen"));
                    _killemRanged[i].StaticModel.Position.X = random.Next(minXKillem, maxXKillem);
                    if (_3d)
                    {
                        _killemRanged[i].StaticModel.Position.Y = _terrain.Position.Y + 10 + random.Next(0, 1000);
                    }
                    else
                    {
                        _killemRanged[i].StaticModel.Position.Y = _terrain.Position.Y + 10;
                    }
                    _killemRanged[i].StaticModel.Position.Z  = random.Next(minZKillem, maxZKillem);
                    _killemRanged[i].StaticModel.Scale       = new Vector <float>(20, 20, 20);
                    _killemRanged[i].StaticModel.Orientation = new Quaternion <float>(0, 1, 0, -Constants.pi_float / 2);
                    _killemRanged[i].Id = "Ranger" + i;
                    _octree.Add(_killemRanged[i]);
                }

                for (int i = 0; i < _kamakaziCount; i++)
                {
                    _zackKamakazi[i] = new ZackKamakazi("ZackKamakazi" + i, StaticModelManager.GetModel("RedRanger"));
                    _zackKamakazi[i].StaticModel.Position.X = random.Next(minXZack, maxXZack);
                    if (_3d)
                    {
                        _zackKamakazi[i].StaticModel.Position.Y = _terrain.Position.Y + 10 + random.Next(0, 1000);
                    }
                    else
                    {
                        _zackKamakazi[i].StaticModel.Position.Y = _terrain.Position.Y + 10;
                    }
                    _zackKamakazi[i].StaticModel.Position.Z  = random.Next(minZZack, maxZZack);
                    _zackKamakazi[i].StaticModel.Scale       = new Vector <float>(5, 5, 5);
                    _zackKamakazi[i].StaticModel.Orientation = new Quaternion <float>(0, 1, 0, 0);
                    _octree.Add(_zackKamakazi[i]);

                    _killemKamakazi[i] = new KillemKamakazi("KillemKamakazi" + i, StaticModelManager.GetModel("TuxRed"));
                    _killemKamakazi[i].StaticModel.Position.X = random.Next(minXKillem, maxXKillem);
                    if (_3d)
                    {
                        _killemKamakazi[i].StaticModel.Position.Y = _terrain.Position.Y + 10 + random.Next(0, 1000);
                    }
                    else
                    {
                        _killemKamakazi[i].StaticModel.Position.Y = _terrain.Position.Y + 10;
                    }
                    _killemKamakazi[i].StaticModel.Position.Z  = random.Next(minZKillem, maxZKillem);
                    _killemKamakazi[i].StaticModel.Scale       = new Vector <float>(20, 20, 20);
                    _killemKamakazi[i].StaticModel.Orientation = new Quaternion <float>(0, 1, 0, -Constants.pi_float / 2);
                    _octree.Add(_killemKamakazi[i]);
                }
            }
            #endregion
        }
예제 #6
0
 public Explosion()
 {
     _time      = 0;
     _explosion = StaticModelManager.GetModel("MushroomCloud");
 }