コード例 #1
0
        public HuntingSystem(Camera camera, GraphicsDevice device, GraphicsDeviceManager graphics, RenderTarget2D rt, Model rabitModel, Effect effect, GameObjects.Static.Environment trees, Skybox skybox, ContentManager Content)
        {
            this.Content      = Content;
            this.camera       = camera;
            this.device       = device;
            this.graphics     = graphics;
            this.trees        = trees;
            this.skybox       = skybox;
            this.renderTarget = rt;
            this.shadowEffect = effect;

            colisionSystem  = new ColisionSystem();
            huntingWataha   = new GameObjects.Movable.Wataha(camera);
            this.rabitModel = rabitModel;
            spawns          = new List <Vector3>();
            rabits          = new List <Animal>();
            sheeps          = new List <Animal>();
            boars           = new List <Animal>();
            GenerateVectors();
        }
コード例 #2
0
ファイル: ColisionSystem.cs プロジェクト: AD-7/PBL_Game
        public bool IsEnvironmentCollision(Wolf player, Wataha.GameObjects.Static.Environment env, Wataha.GameObjects.Movable.Wataha wataha)
        {
            int i = 0;

            foreach (ModelMesh mesh in env.model.Meshes)
            {
                if (!mesh.Name.Contains("Plane"))
                {
                    if (mesh.Name.Contains("House") || mesh.Name.Contains("Bound") || mesh.Name.Contains("Blockade") || mesh.Name.Contains("defaultobject") || mesh.Name.Contains("well") || mesh.Name.Contains("Plotek") || mesh.Name.Contains("Barell"))
                    {
                        if (player.collider.Intersects(env.colliders[i]))
                        {
                            foreach (Wolf w in wataha.wolves)
                            {
                                w.ifColisionTerrain = true;
                                w.ProccedCollisionBuilding();
                            }

                            return(true);
                        }
                    }
                    else
                    {
                        if (player.collider.Intersects(env.colliders[i]))
                        {
                            foreach (Wolf w in wataha.wolves)
                            {
                                w.ifColisionTerrain = true;
                                w.ProccedCollisionTree();
                            }

                            return(true);
                        }
                    }
                    i++;
                }
            }
            return(false);
        }
コード例 #3
0
ファイル: Game1.cs プロジェクト: AD-7/PBL_Game
        protected override void LoadContent()
        {
            Trace.WriteLine("LaodCOntentStart");

            device = GraphicsDevice;

            Content.RootDirectory = "Content";
            //graphics.IsFullScreen = false;
            graphics.PreferredBackBufferHeight = device.DisplayMode.Height;
            graphics.PreferredBackBufferWidth  = device.DisplayMode.Width;
            graphics.IsFullScreen    = false;
            graphics.GraphicsProfile = GraphicsProfile.HiDef;
            //graphics.SynchronizeWithVerticalRetrace = false;
            //IsFixedTimeStep = false;
            graphics.ApplyChanges();

            Trace.WriteLine("LoadContentGrahic");


            camera = new Camera();
            Trace.WriteLine("Camera");

            colisionSystem = new ColisionSystem();
            Trace.WriteLine("systemKolizi");

            questSystem = new QuestSystem();
            Trace.WriteLine("quest");



            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            world       = Matrix.CreateRotationX(MathHelper.ToRadians(-90));

            simpleEffect = Content.Load <Effect>("Effects/Light");
            ps           = new ParticleSystem(GraphicsDevice, Content, Content.Load <Texture2D>("Pictures/fire2"), 400, new Vector2(0.0001f, 0.00001f), 0.3f, Vector3.Zero, 0.1f);


            Vector3[] positions  = new Vector3[6];
            Vector3[] positions2 = new Vector3[1];
            positions[0]   = new Vector3(2, 0, 2);
            positions[1]   = new Vector3(10, 0, -10);
            positions[2]   = new Vector3(8, 0, -20);
            positions[3]   = new Vector3(20, 0, -30);
            positions[4]   = new Vector3(40, 0, -10);
            positions[5]   = new Vector3(50, 0, -20);
            positions2[0]  = new Vector3(1000);
            billboardTest  = new BillboardSystem(GraphicsDevice, Content, Content.Load <Texture2D>("Pictures/grass"), new Vector2(0.001f), positions);
            billboardTest2 = new BillboardSystem(GraphicsDevice, Content, Content.Load <Texture2D>("Pictures/questionMark"), new Vector2(0.001f), positions2);

            Trace.WriteLine("bilbord");


            world = world * Matrix.CreateTranslation(new Vector3(0, 0, 0));

            Matrix world3 = Matrix.CreateTranslation(new Vector3(0, 0, 0));

            skybox = new Skybox("Skyboxes/skybox", Content);

            Trace.WriteLine("skybox");

            wataha = new GameObjects.Movable.Wataha(camera);

            Matrix world2 = Matrix.CreateRotationX(MathHelper.ToRadians(-90));

            world2 *= Matrix.CreateRotationY(MathHelper.ToRadians(180));

            world2 *= Matrix.CreateTranslation(new Vector3(0, 12f, camera.CamPos.Z - 5));
            world2 *= Matrix.CreateScale(0.2f);

            Matrix worldw2 = Matrix.CreateRotationX(MathHelper.ToRadians(-90));

            worldw2 *= Matrix.CreateRotationY(MathHelper.ToRadians(180));
            worldw2 *= Matrix.CreateTranslation(new Vector3(14, 12f, camera.CamPos.Z - 12));
            worldw2 *= Matrix.CreateScale(0.2f);
            Matrix worldw3 = Matrix.CreateRotationX(MathHelper.ToRadians(-90));

            worldw3 *= Matrix.CreateRotationY(MathHelper.ToRadians(180));
            worldw3 *= Matrix.CreateTranslation(new Vector3(-10, 12f, camera.CamPos.Z - 7));
            worldw3 *= Matrix.CreateScale(0.2f);

            Matrix world5 = Matrix.CreateRotationX(MathHelper.ToRadians(-90));

            //world5 *= Matrix.CreateRotationY(MathHelper.ToRadians(180));
            world5 *= Matrix.CreateTranslation(new Vector3(0, 5, 0));
            world5 *= Matrix.CreateScale(0.2f);

            Dictionary <String, String> animationsW2 = new Dictionary <string, string>();

            animationsW2.Add("Idle", "wilk2");
            animationsW2.Add("Atak", "wilk2A");
            Dictionary <String, String> animationsW3 = new Dictionary <string, string>();

            animationsW3.Add("Idle", "wilk3");
            animationsW3.Add("Atak", "wilk3A");
            Dictionary <String, String> animationsW4 = new Dictionary <string, string>();

            animationsW4.Add("Idle", "wilk4");
            animationsW4.Add("Atak", "wilk4A");
            wolf  = new Wolf(Content.Load <Model>("Wolf"), animationsW2, Content, world2, 3.0f, camera, 12, 10, 10, "Kimiko");
            wolf2 = new Wolf(Content.Load <Model>("Wolf2"), animationsW3, Content, worldw2, 3.0f, camera, 7, 3, 11, "Yua");
            wolf3 = new Wolf(Content.Load <Model>("Wolf3"), animationsW4, Content, worldw3, 3.0f, camera, 8, 5, 8, "Hatsu");


            for (int i = 0; i < 0; i++)
            {
                GenerateRabits(wolf, Content.Load <Model>("RabitIdle/Rabbitstand1_000001"));
            }



            trees        = new GameObjects.Static.Environment(Content.Load <Model>("tres"), world3, 2);
            huntingTrees = new GameObjects.Static.Environment(Content.Load <Model>("huntingTrees"), world3, 2);
            blockade     = new GameObjects.Static.Environment(Content.Load <Model>("B1"), world3, 8);
            Matrix worldb2 = Matrix.CreateTranslation(new Vector3(0, 0, 0));

            blockade2 = new GameObjects.Static.Environment(Content.Load <Model>("B2"), worldb2, 10);
            croft     = new GameObjects.Static.Environment(Content.Load <Model>("croft"), worldb2, 35);
            barrell   = new GameObjects.Static.Environment(Content.Load <Model>("barrell"), worldb2, 5);
            reflekt   = new Reflekt(world5, Content.Load <Model>("cube"), Content, Content.Load <TextureCube>("Skyboxes/skybox"));


            wolf.SetModelEffect(simpleEffect, true);
            wolf2.SetModelEffect(simpleEffect, true);
            wolf3.SetModelEffect(simpleEffect, true);
            trees.SetModelEffect(simpleEffect, true);
            huntingTrees.SetModelEffect(simpleEffect, true);
            blockade.SetModelEffect(simpleEffect, true);
            blockade2.SetModelEffect(simpleEffect, true);
            croft.SetModelEffect(simpleEffect, true);
            barrell.SetModelEffect(simpleEffect, true);


            foreach (String key in wolf.animations.Keys)
            {
                wolf.animations[key].generateTags();
                wolf.animations[key].SetEffect(simpleEffect, true);
            }
            foreach (String key in wolf2.animations.Keys)
            {
                wolf2.animations[key].generateTags();
                wolf2.animations[key].SetEffect(simpleEffect, true);
            }
            foreach (String key in wolf3.animations.Keys)
            {
                wolf3.animations[key].generateTags();
                wolf3.animations[key].SetEffect(simpleEffect, true);
            }

            wataha.wolves.Add(wolf);
            wataha.wolves.Add(wolf2);
            wataha.wolves.Add(wolf3);



            Matrix worldw4 = Matrix.CreateRotationX(MathHelper.ToRadians(-90));

            // worldw4 *= Matrix.CreateRotationY(MathHelper.ToRadians(180));
            worldw4 *= Matrix.CreateTranslation(new Vector3(-8.0f, 0.5f, -20.0f));
            QuestSystem.questGivers.Add(new QuestGiver(Content.Load <Model>("lumberjack/lumberJack2"), worldw4, null));

            worldw4  = new Matrix();
            worldw4  = Matrix.CreateRotationX(MathHelper.ToRadians(-90));
            worldw4 *= Matrix.CreateRotationY(MathHelper.ToRadians(-90));
            worldw4 *= Matrix.CreateTranslation(new Vector3(52.0f, 2.1f, -100.0f));
            QuestSystem.questGivers.Add(new QuestGiver(Content.Load <Model>("lumberjack/lumberJack"), worldw4, QuestSystem.questGivers[0]));

            worldw4  = new Matrix();
            worldw4  = Matrix.CreateRotationY(MathHelper.ToRadians(-90));
            worldw4 *= Matrix.CreateTranslation(new Vector3(40.0f, 2.1f, -330.0f));
            QuestSystem.questGivers.Add(new QuestGiver(Content.Load <Model>("lumberjack/lumberJack3"), worldw4, QuestSystem.questGivers[1]));



            QuestSystem.questGivers[0].questsList.Add(new GoHuntingQuest(0, "Hunting", "First, you should provide meat!\nGo hunt using panel on the right side.", 1, 1, 1, 10, 0, 0, QuestSystem.questGivers[0]));
            QuestSystem.questGivers[0].questsList.Add(new BuyFangsQuest(1, "Market", "Excellent! Now you know how to hunt.\n In the west there is a market.\n Go and exchange meat for at least 1 white fang.", 5, 5, 5, 0, 5, 0, barrell));
            QuestSystem.questGivers[0].questsList.Add(new PointAtoBQuest(2, "Deliver letter", "Now you are able to get all resources.\nPlease deliver that letter \n to my brother blacksmith.\n He can help you find your brothers.", 5, 6, 8, 5, 0, 0, QuestSystem.questGivers[1]));

            QuestSystem.questGivers[1].questsList.Add(new UpgradeQuest(3, "Skills", "Thank you my dear wolves.\nThe letter is very important for me.\n Of course, I can help you!\nBut first, you should train!\n(Upgrade you wolves using their small pictures\non the right panel)", 8, 6, 9, 15, 1, 1, QuestSystem.questGivers[1], wataha));
            QuestSystem.questGivers[1].questsList.Add(new FindToolsQuest(4, "Missing tools", "Ohhh, during the Storm, my tools were lost.\nCould you help me and find 4 of them?\n They should be near in the forest.  ", 9, 8, 9, 50, 2, 1, QuestSystem.questGivers[1], Content, wataha.wolves[0], simpleEffect));
            QuestSystem.questGivers[1].questsList.Add(new DeliverQuest(5, "Repair dull chainsaw", "We need help with getting resoucers\nfor repair our saw.\nPlese bring to me 12 white fang\nand 7 gold fang.\nIf you do that I will clean barricade on the north.", 4, 6, 5, 60, 0, 0, QuestSystem.questGivers[1], 7, 12, 0));


            QuestSystem.questGivers[2].questsList.Add(new SheepQuest(6, "Sheep is escaped", "Help me!!\nMy sheep was run out from craft.\nCan you move them back?", 13, 9, 11, 100, 10, 5, QuestSystem.questGivers[2], croft, Content, wataha.wolves[0]));

            QuestSystem.questGivers[0].Init();
            QuestSystem.questGivers[1].Init();
            QuestSystem.questGivers[2].Init();


            foreach (QuestGiver q in QuestSystem.questGivers)
            {
                q.SetModelEffect(simpleEffect, true);
            }



            PresentationParameters pp = device.PresentationParameters;

            renderTarget = new RenderTarget2D(device, 2048, 2048, false,
                                              SurfaceFormat.Single, DepthFormat.Depth24, 0, RenderTargetUsage.PlatformContents);

            renderTarget2 = new RenderTarget2D(GraphicsDevice,
                                               GraphicsDevice.PresentationParameters.BackBufferWidth,
                                               GraphicsDevice.PresentationParameters.BackBufferHeight,
                                               false,
                                               GraphicsDevice.PresentationParameters.BackBufferFormat,
                                               DepthFormat.Depth24, 0, RenderTargetUsage.PlatformContents);

            Matrix worldH = Matrix.CreateRotationX(MathHelper.ToRadians(-90));

            worldH *= Matrix.CreateRotationY(MathHelper.ToRadians(180));

            worldH *= Matrix.CreateTranslation(new Vector3(0, 15.0f, camera.CamPos.Z - 5));
            worldH *= Matrix.CreateScale(0.2f);


            HuntingSystem tmp = new HuntingSystem(camera, device, graphics, renderTarget, Content.Load <Model>("RabitIdle/Rabbitstand1_000001"), simpleEffect, huntingTrees, skybox, Content);

            tmp.huntingWolf = new Wolf(Content.Load <Model>("Wolf2"), animationsW2, Content, worldH, 3.0f, camera, 0, 0, 0, "S");
            tmp.huntingWolf.SetModelEffect(simpleEffect, true);


            hud = new HUDController(spriteBatch, device, Content, wataha, tmp);
            Resources.Whitefangs = 0;
            Resources.Goldfangs  = 0;
            mainMenu             = new MainMenu(spriteBatch, Content, device);

            Trace.WriteLine("LoadContentEnd");
        }
コード例 #4
0
ファイル: HUDController.cs プロジェクト: AD-7/PBL_Game
        public HUDController(SpriteBatch batch, GraphicsDevice device, ContentManager manager, Wataha.GameObjects.Movable.Wataha wataha, HuntingSystem hs)
        {
            this.huntingSystem = hs;
            this.wataha        = wataha;
            this.device        = device;
            this.spriteBatch   = batch;
            this.Content       = manager;

            pictures = new List <Texture2D>();

            ifQuestCompleted = false;

            font30        = Content.Load <SpriteFont>("Fonts/font1");
            arial18Italic = Content.Load <SpriteFont>("Fonts/arial/arial18");
            arial15Italic = Content.Load <SpriteFont>("Fonts/arial/arial15");
            arial20Italic = Content.Load <SpriteFont>("Fonts/arial/arial20");
            arial12Italic = Content.Load <SpriteFont>("Fonts/arial/arial12");
            broadwayFont  = Content.Load <SpriteFont>("Fonts/Broadway");

            pictures.Add(Content.Load <Texture2D>("Pictures/panel"));
            pictures.Add(Content.Load <Texture2D>("Pictures/meat"));
            pictures.Add(Content.Load <Texture2D>("Pictures/goldFangs"));
            pictures.Add(Content.Load <Texture2D>("Pictures/whiteFang"));
            pictures.Add(Content.Load <Texture2D>("Pictures/pauseScreen"));
            pictures.Add(Content.Load <Texture2D>("Pictures/resumeButton")); // 5
            pictures.Add(Content.Load <Texture2D>("Pictures/backToMainMenu"));
            pictures.Add(Content.Load <Texture2D>("Pictures/exitButton"));
            pictures.Add(Content.Load <Texture2D>("Pictures/rectangleForButtons")); //8
            pictures.Add(Content.Load <Texture2D>("Pictures/buttonPhoto"));
            pictures.Add(Content.Load <Texture2D>("Pictures/buttonPhoto2"));        //10
            pictures.Add(Content.Load <Texture2D>("Pictures/buttonPhoto3"));
            pictures.Add(Content.Load <Texture2D>("Pictures/actualQuestButton"));
            pictures.Add(Content.Load <Texture2D>("Pictures/saveGameButton"));
            pictures.Add(Content.Load <Texture2D>("Pictures/saveInfo"));         //14
            pictures.Add(Content.Load <Texture2D>("Pictures/saveInfoOk"));       //15
            pictures.Add(Content.Load <Texture2D>("Pictures/saveInfoOk2"));      //16
            pictures.Add(Content.Load <Texture2D>("Pictures/gameOver"));         //17
            pictures.Add(Content.Load <Texture2D>("Pictures/noMeat"));           //18
            pictures.Add(Content.Load <Texture2D>("Pictures/GoHuntingButton"));  //19
            pictures.Add(Content.Load <Texture2D>("Pictures/GoHuntingButton2")); //20
            pictures.Add(Content.Load <Texture2D>("Pictures/goHunt"));           //21

            actualSaveInfoOk       = pictures[15];
            actualGameOverInfoOk   = pictures[15];
            actualGoHuntingButton1 = pictures[19];
            actualGoHuntingButton2 = pictures[19];
            actualGoHuntingButton3 = pictures[19];

            wolfPanel = new WolfPanel(Content, arial20Italic, device.Viewport.Width, device.Viewport.Height);

            actualQuestPanel = new ActualQuestPanel(Content.Load <Texture2D>("Pictures/actualQuestPanel"), arial15Italic);
            QuestPanel       = new QuestPanel(Content, arial18Italic);
            marketPanel      = new MarketPanel(Content);

            screenWidth  = device.Viewport.Width;
            screenHeight = device.Viewport.Height;

            screenWidthOld     = 0;
            screenHeightOld    = 0;
            stringOffsetWidth  = 0;
            stringOffsetHeight = 0;

            huntingSystem.hudHunting = new HUDHunting(spriteBatch, device, Content);
        }