Beispiel #1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            #region KURSORY i okno
            StaticHelpers.StaticHelper.DeviceManager = graphics;
            WindowController.window = (Form)Form.FromHandle(this.Window.Handle);
            MouseCursorController.LoadCustomCursor(@"Content/Cursors/TronNormal.ani");
            MouseCursorController.LoadCustomCursor(@"Content/Cursors/TronBusy.ani");
            MouseCursorController.LoadCustomCursor(@"Content/Cursors/TronAlternate.ani");
            MouseCursorController.LoadCustomCursor(@"Content/Cursors/gam1232.ani");

            MouseCursorController.stage = Controlers.CursorEnum.CursorStage.Normal;
            #endregion

            #region Light Shadow
            light = new LightsAndShadows.Light(0.7f, 0.4f, new Vector3(-2800, 4000, -2800));
            shadow = new LightsAndShadows.Shadow();
            LoadModelsFromFile._light = light;
            #endregion
            #region PresentationParameters
            PresentationParameters pp = graphics.GraphicsDevice.PresentationParameters;
            pp.DepthStencilFormat = DepthFormat.Depth24Stencil8;

            #endregion
            #region PointsForLaser
            pointsForLasers.Add(new List<PointInTime>());
            pointsForLasers[0].Add(new PointInTime(new Vector3(100, 40, 100), 0));
            pointsForLasers[0].Add(new PointInTime(new Vector3(1600, 40, 300), 20000));
            pointsForLasers[0].Add(new PointInTime(new Vector3(3000, 40, 260), 40000));
            pointsForLasers[0].Add(new PointInTime(new Vector3(1300, 40, 900), 60000));
            pointsForLasers[0].Add(new PointInTime(new Vector3(400, 40, 1500), 80000));
            pointsForLasers[0].Add(new PointInTime(new Vector3(1299, 40, 1900), 100000));
            pointsForLasers[0].Add(new PointInTime(new Vector3(100, 40, 3000), 120000));

            #endregion
            #region Curve
            curvesForLaser.Add(new Curve3D(pointsForLasers[0],CurveLoopType.Oscillate));
            #endregion
            #region Laser

            #endregion

            hiDefShadowEffect = Content.Load<Effect>("Effects/Shadows");
            animHiDefShadowEffect = Content.Load<Effect>("Effects/AnimatedShadow");
            device = GraphicsDevice;
            device.DepthStencilState = DepthStencilState.Default;
            shadow.RenderTarget = new RenderTarget2D(device, 4096, 4096, false, pp.BackBufferFormat, DepthFormat.Depth24Stencil8);

            spriteBatch = new SpriteBatch(GraphicsDevice);
            StaticHelpers.StaticHelper._spr_font = Content.Load<SpriteFont>("Fonts/FPS");// you have on your project

            StaticHelpers.StaticHelper.Content = Content;
            StaticHelpers.StaticHelper.Device = device;
            endGamePicture = Content.Load<Texture2D>("Textures/t³okoñcowe");
            #region Tekstury
            List<Texture2D> texture = new List<Texture2D>();
            //alphy do terenu
            texture.Add(Content.Load<Texture2D>("HeighMaps/texturemap_grass")); // alpha pomiedzy trawa 0 i trawa1
            texture.Add(Content.Load<Texture2D>("HeighMaps/texturemap_grass1")); // alpha pomiedzy 1 2
            texture.Add(Content.Load<Texture2D>("HeighMaps/texturemap_sand"));
            texture.Add(Content.Load<Texture2D>("HeighMaps/texturemap_forest_cover"));
            texture.Add(Content.Load<Texture2D>("HeighMaps/texturemap_stone")); // alpha pomiedzy 4 5
            texture.Add(Content.Load<Texture2D>("HeighMaps/texturemap_grass1")); // alpha pomiedzy 5 6
            texture.Add(Content.Load<Texture2D>("HeighMaps/texturemap_snow")); // alpha pomiedzy ciemne7 i jasne 8
            //0 - 6

            //tekstury terenu
            texture.Add(Content.Load<Texture2D>("Textures/Ground/grass0")); //
            texture.Add(Content.Load<Texture2D>("Textures/Ground/grass"));  // to mo¿na wyci¹æ
            texture.Add(Content.Load<Texture2D>("Textures/Ground/grass1")); // to mo¿na wyci¹æ
            texture.Add(Content.Load<Texture2D>("Textures/Ground/sand"));  //
            texture.Add(Content.Load<Texture2D>("Textures/Ground/forest_cover")); //
            texture.Add(Content.Load<Texture2D>("Textures/Ground/rock"));  //
            texture.Add(Content.Load<Texture2D>("Textures/Ground/dirt"));  // to mo¿na wyci¹æ
            texture.Add(Content.Load<Texture2D>("Textures/Ground/rock"));  // to mo¿na wyci¹æ
            //7 - 14
            //heighmapa terenu
            texture.Add(Content.Load<Texture2D>("HeighMaps/terrain"));
            //15
            //tekstura od zaznaczenia
            texture.Add(Content.Load<Texture2D>("Textures/select2"));
            //16
            //mapy rozmieszczenia obiektow i bilboardow (w zaleznosci ile czego bedzie to sobie pododajesz)
            texture.Add(Content.Load<Texture2D>("HeighMaps/grassMap"));
            texture.Add(Content.Load<Texture2D>("Textures/Bilboard/tree"));
            texture.Add(Content.Load<Texture2D>("HeighMaps/iguyMap"));
            texture.Add(Content.Load<Texture2D>("Textures/Bilboard/igua"));
            texture.Add(Content.Load<Texture2D>("HeighMaps/szuwaryMap"));
            texture.Add(Content.Load<Texture2D>("Textures/Bilboard/szuwary"));
            //17 - 22

            //mapy rozmieszczenia obiektow (w zaleznosci ile czego bedzie to sobie pododajesz)
            texture.Add(Content.Load<Texture2D>("HeighMaps/koamienMap"));
            texture.Add(Content.Load<Texture2D>("HeighMaps/trawaMap"));
            texture.Add(Content.Load<Texture2D>("HeighMaps/kzak1Map"));
            //23 - 25
            texture.Add(Content.Load<Texture2D>("Textures/circle"));
            #endregion

            camera = new FreeCamera(
            new Vector3(texture[4].Width * 1 / 2, texture[4].Width * 1 / 20, texture[4].Width * 1 / 2),
            MathHelper.ToRadians(0), // Turned around 153 degrees
            MathHelper.ToRadians(-45), // Pitched up 13 degrees
            GraphicsDevice);

            quadTree.Add(new QuadTree(Vector2.Zero, texture, device, 3, Content, (FreeCamera)camera));

            water = new Water(device, Content, texture[4].Width, 3);
            foreach (QuadTree q in quadTree)
            {
                q.Cull = true;
            }
            StaticHelpers.StaticHelper.heights = quadTree[0].Vertices.heightDataToControl;
            StaticHelpers.StaticHelper.width = (int)Math.Sqrt(quadTree[0].Vertices.heightDataToControl.Length);
            StaticHelpers.StaticHelper.length = (int)Math.Sqrt(quadTree[0].Vertices.heightDataToControl.Length);

            PathFinderManager.PathFinderManagerInitialize(128);

            #region loadFromFile

            Controlers.LoadModelsFromFile.Load();
            foreach (InteractiveModel i in LoadModelsFromFile.listOfAllInteractiveModelsFromFile)
            {

                // Console.WriteLine(models.GetType().BaseType.Name);
                if (i.GetType().BaseType == typeof(Building) || i.GetType().BaseType == typeof(Material) || i.GetType().BaseType == typeof(EnviroModels) || i.GetType().BaseType==typeof(AllieBuilding))
                {

                    IModel.Add(i);
                }
                else
                {
                    if (i.GetType() == typeof(Beetle))
                    {
                        ((Beetle)i).Ants = models;
                        ((Beetle)i).removeMyself();
                    }
                    else if (i.GetType() == typeof(Spider))
                    {
                        ((Spider)i).Ants = models;
                        ((Spider)i).removeMyself();

                    }
                    models.Add(i);
                }
            }
            #endregion
            PathFinderManager.blockAllNodes(IModel);
            //for (int i = 0; i < PathFinderManager.GridSize; i += 1)
            //{
            //    for (int J = 0; J < PathFinderManager.GridSize; J += 1)
            //    {
            //        if (PathFinderManager.tileList[i, J].walkable == false || PathFinderManager.tileList[i, J].haveMineral == true || PathFinderManager.tileList[i, J].haveBuilding == true)
            //        {
            //            inter.Add(new InteractiveModel(new LoadModel(Content.Load<Model>("Models/log2"),new Vector3(PathFinderManager.tileList[i,J].centerPosition.X,StaticHelpers.StaticHelper.GetHeightAt(PathFinderManager.tileList[i,J].centerPosition.X,PathFinderManager.tileList[i,J].centerPosition.Y),PathFinderManager.tileList[i,J].centerPosition.Y),Vector3.Zero,new Vector3(1f,0.3f,1f),device,light)));
            //        }
            //    }
            //}

            /////////////// nie wiem czy to powinno byæ czy nie wiêc zakomentowa³em tylko
            //
            //            mapR = new MapRender(texture[15], 3);
            //            Console.WriteLine(GraphicsDevice.Viewport.Bounds);

            //e.Ant = models[0];
            // e.Enemy = spider;
            //  e.Ants = Enemys;

            WindowController.setWindowSize(1366, 768, false);
            //models.Add(new AntPeasant(new LoadModel(StaticHelpers.StaticHelper.Content.Load<Model>("Models/mrowka_01"), Vector3.Zero, Vector3.Zero, new Vector3(0.3f), StaticHelpers.StaticHelper.Device, light)));
            // models.Add(new TownCenter(new LoadModel(StaticHelpers.StaticHelper.Content.Load<Model>("Models/domek"), Vector3.Zero, Vector3.Zero, new Vector3(0.23f), StaticHelpers.StaticHelper.Device, light)));
            ////models.Add(new Queen(new LoadModel(StaticHelpers.StaticHelper.Content.Load<Model>("Models/grasshopper"), new Vector3(300,40,300), Vector3.Zero, new Vector3(0.23f), StaticHelpers.StaticHelper.Device, StaticHelpers.StaticHelper.Content,light)));
            ////models[models.Count - 1].Model.switchAnimation("Idle");

            List<String> aa = new List<string>();
            aa.Add("s1");
            aa.Add("s2");
            aa.Add("Gater");
            SoundController.SoundController.content = Content;
            SoundController.SoundController.Initialize(aa);

            List<String> PlayList = new List<string>();
            PlayList.Add("Kwai");
            PlayList.Add("MarketGarden");
            PlayList.Add("Escape");
            SoundController.SoundController.InitializeBackground(PlayList);

            // models[models.Count - 1].Model.switchAnimation("Idle");

            // models.Add(new Cancer(new LoadModel(Content.Load<Model>("Models/crab"), new Vector3(0, 40, 0), new Vector3(0), new Vector3(0.4f), GraphicsDevice,  light), models));

              models.Add(new Cancer(new LoadModel(Content.Load<Model>("Models/crab"), new Vector3(1375, 40, 2500), new Vector3(0), new Vector3(0.4f), GraphicsDevice, Content, light), models));

              models[models.Count - 1].Model.switchAnimation("Idle");

             models.Add(new SunDew(new LoadModel(Content.Load<Model>("Models/rosiczka"), new Vector3(1574, 40, 2100), new Vector3(0), new Vector3(0.8f), GraphicsDevice, Content, light), models));
            models[models.Count - 1].Model.switchAnimation("Idle");
            models.Add(new SunDew(new LoadModel(Content.Load<Model>("Models/rosiczka"), new Vector3(2400, 40, 805), new Vector3(0), new Vector3(0.8f), GraphicsDevice, Content, light), models));
            models[models.Count - 1].Model.switchAnimation("Idle");
            models.Add(new SunDew(new LoadModel(Content.Load<Model>("Models/rosiczka"), new Vector3(1700, 40, 1111), new Vector3(0), new Vector3(0.8f), GraphicsDevice, Content, light), models));
            models[models.Count - 1].Model.switchAnimation("Idle");
            // models.Add(new Spider(new LoadModel(Content.Load<Model>("Models/spider"), new Vector3(250, 40, 250), new Vector3(0), new Vector3(0.4f), GraphicsDevice, Content, light), models));
            // models[models.Count - 1].Model.switchAnimation("Idle");

            ////models.Add(new Grasshopper(new LoadModel(Content.Load<Model>("Models/grasshopper"), new Vector3(50, 40, 50), new Vector3(0), new Vector3(0.4f), GraphicsDevice, Content, light), models));
            ////models[models.Count - 1].Model.switchAnimation("Idle");

            // models.Add(new StrongAnt(new LoadModel(Content.Load<Model>("Models/strongAnt"),new Vector3(120,40,20),new Vector3(0),new Vector3(0.4f),GraphicsDevice,Content,light)));
            //// models[models.Count - 1].Model.switchAnimation("Idle");

            // models.Add(new AntPeasant(new LoadModel(Content.Load<Model>("Models/ant"), new Vector3(100, 40, 10), new Vector3(0), new Vector3(0.4f), GraphicsDevice, Content, light)));

               // Console.WriteLine("QuadNode: " + QuadNodeController.QuadNodeList.Count);

            BBoxRender.InitializeBBoxDebuger(device);

               // IModel.Add(new BeetleBuilding(new LoadModel(Content.Load<Model>("Models/h4"), new Vector3(700, 60, 900), new Vector3(0), new Vector3(0.4f), GraphicsDevice, light)));
              //  IModel.Add(new GrassHopperBuilding(new LoadModel(Content.Load<Model>("Models/h3"), new Vector3(900, 40, 1100), new Vector3(0), new Vector3(0.4f), GraphicsDevice, light)));

            Console.WriteLine(QuadNodeController.QuadNodeList2.Count);

            #region trigger end game
            theEnd = new Trigger((new LoadModel(Content.Load<Model>("Models/endNode"), new Vector3(1375, 40, 2500), new Vector3(0), new Vector3(4f), GraphicsDevice, light)));
            IModel.Add(theEnd);
            #endregion

            IModel.Add(new Laser((new LoadModel(Content.Load<Model>("Models/laser"), new Vector3(0, 40, 0), new Vector3(0), new Vector3(2f), GraphicsDevice, light)), curvesForLaser[0]));
            timeTriggers.Add(new LaserTrigger((Laser)IModel[IModel.Count - 1], 100));

            control = new Logic.Control(texture[11], quadTree[0]);
            gui = new MainGUI(StaticHelpers.StaticHelper.Content, control,models);

            control.Models_Colision = IModel;

            Player.addMaterial(new Wood(),200);
            Player.addMaterial(new Stone(), 200);
            Player.addMaterial(new Hyacynt(), 200);
            Player.addMaterial(new Dicentra(), 200);
            Player.addMaterial(new Chelidonium(), 200);

            miniMap = new MiniMap(models);
            foreach(InteractiveModel m in IModel) {
                if (m is Laser || m is GrassHopperBuilding || m is BeetleBuilding)
                    miniMap.addObjects(m);
                }
            intro = new List<Texture2D>();
            intro.Add( Content.Load<Texture2D>("Textures/1"));
            intro.Add(Content.Load<Texture2D>("Textures/2"));
            intro.Add(Content.Load<Texture2D>("Textures/3"));
            intro.Add(Content.Load<Texture2D>("Textures/4"));

            _intro = intro[0];
        }
Beispiel #2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            PresentationParameters pp = graphics.GraphicsDevice.PresentationParameters;
            pp.DepthStencilFormat = DepthFormat.Depth24Stencil8;
            pp.BackBufferHeight = 600;
            pp.BackBufferWidth = 800;

            device = GraphicsDevice;
            spriteBatch = new SpriteBatch(GraphicsDevice);
            _spr_font = Content.Load<SpriteFont>("Fonts/FPS");// you have on your project

            List<Texture2D> texture = new List<Texture2D>();
            texture.Add(Content.Load<Texture2D>("Textures/Ground/grass"));
            texture.Add(Content.Load<Texture2D>("Textures/Ground/sand"));
            texture.Add(Content.Load<Texture2D>("Textures/Ground/rock"));
            texture.Add(Content.Load<Texture2D>("Textures/Ground/snow"));
            texture.Add(Content.Load<Texture2D>("HeighMaps/terrain"));
            texture.Add(Content.Load<Texture2D>("Textures/Bilboard/tree"));
            texture.Add(Content.Load<Texture2D>("HeighMaps/treeMap"));
            texture.Add(Content.Load<Texture2D>("HeighMaps/colorHeigh"));
            texture.Add(Content.Load<Texture2D>("Textures/lisc"));
            texture.Add(Content.Load<Texture2D>("Textures/Ground/grass"));
            texture.Add(Content.Load<Texture2D>("Textures/muszle"));
            texture.Add(Content.Load<Texture2D>("Textures/select2"));

            camera = new FreeCamera(
            new Vector3(texture[4].Width * 1 / 2, texture[4].Width * 1 / 3, texture[4].Width * 1 / 2),
            MathHelper.ToRadians(0), // Turned around 153 degrees
            MathHelper.ToRadians(-45), // Pitched up 13 degrees
            GraphicsDevice);

            quadTree = new QuadTree(Vector3.Zero, texture, device, 3, Content, (FreeCamera)camera);
            quadTree.Cull = true;
            quadTree.shadow.RenderTarget = new RenderTarget2D(device, pp.BackBufferWidth, pp.BackBufferHeight, true, device.DisplayMode.Format, DepthFormat.Depth24Stencil8);
            water = new Water(device, Content, texture[4].Width, 3);

            lastMouseState = Mouse.GetState();

            BoundingSphereRenderer.InitializeGraphics(device, 33);

            CreatorController.content = Content;
            CreatorController.device = device;
            CreatorController.models.AddRange(models);

               // CreatorController.models.Add(m);
        }