public BillboardSystem AddBackgroundSystem(string Path)
        {
            BillboardSystem NewParticleSystem = new BillboardSystem("Animations/Background Sprites/" + Path, 20000, 1, BlendState.NonPremultiplied, true, content, GraphicsDevice);

            ActiveAnimationBackground.ListBackground.Add(new AnimationBackground3DBillboard(NewParticleSystem));
            return(NewParticleSystem);
        }
        private void CreatePropAtMousePosition(int MouseX, int MouseY)
        {
            if (lstItemChoices.SelectedNode != null)
            {
                TreeNode        SelectedNode         = lstItemChoices.SelectedNode;
                BillboardSystem ActiveParticleSystem = lstItemChoices.SelectedNode.Tag as BillboardSystem;

                if (ActiveParticleSystem == null && lstItemChoices.SelectedNode.Parent != null)
                {
                    SelectedNode         = lstItemChoices.SelectedNode.Parent;
                    ActiveParticleSystem = lstItemChoices.SelectedNode.Parent.Tag as BillboardSystem;
                }
                if (ActiveParticleSystem != null)
                {
                    Vector3 NearScreenPoint = new Vector3(MouseX, MouseY, 0);
                    Vector3 FarScreenPoint  = new Vector3(MouseX, MouseY, 1);
                    Vector3 NearWorldPoint  = AnimationBackgroundViewer.GraphicsDevice.Viewport.Unproject(NearScreenPoint,
                                                                                                          AnimationBackgroundViewer.ActiveAnimationBackground.Projection,
                                                                                                          AnimationBackgroundViewer.ActiveAnimationBackground.View, Matrix.Identity);
                    Vector3 FarWorldPoint = AnimationBackgroundViewer.GraphicsDevice.Viewport.Unproject(FarScreenPoint,
                                                                                                        AnimationBackgroundViewer.ActiveAnimationBackground.Projection,
                                                                                                        AnimationBackgroundViewer.ActiveAnimationBackground.View, Matrix.Identity);

                    Vector3 Direction = FarWorldPoint - NearWorldPoint;

                    float   zFactor        = -NearWorldPoint.Y / Direction.Y;
                    Vector3 ZeroWorldPoint = NearWorldPoint + Direction * zFactor;

                    ActiveParticleSystem.AddParticle(ZeroWorldPoint);
                    SelectedNode.Nodes.Add("Prop " + (SelectedNode.Nodes.Count + 1));
                }
            }
        }
        public VegetationSystem CopyVegetationSystem(GameObject srcGameObj, Terrain terrain)
        {
            GameObject vegetationSystemObject = GameObject.Instantiate(srcGameObj);

            vegetationSystemObject.transform.SetParent(terrain.transform);

            VegetationSystem vegetationSystem = vegetationSystemObject.GetComponent <VegetationSystem>();

            if (vegetationSystem == null)
            {
                vegetationSystem = vegetationSystemObject.AddComponent <VegetationSystem>();
            }

            if (package != null)
            {
                vegetationSystem.AddVegetationPackage(package, true);
            }

            if (vegetationSystemObject.GetComponent <TerrainSystem>() == null)
            {
                vegetationSystemObject.AddComponent <TerrainSystem>();
            }

            BillboardSystem billboardSystem = vegetationSystemObject.GetComponent <BillboardSystem>();

            if (billboardSystem == null)
            {
                billboardSystem = vegetationSystemObject.AddComponent <BillboardSystem>();
            }
            billboardSystem.VegetationSystem = vegetationSystem;

            PersistentVegetationStorage srcStorage = vegetationSystemObject.GetComponent <PersistentVegetationStorage>();

            if (srcStorage != null)
            {
                GameObject.DestroyImmediate(srcStorage);
            }

            PersistentVegetationStorage persistentVegetationStorage = vegetationSystemObject.AddComponent <PersistentVegetationStorage>();

            persistentVegetationStorage.VegetationSystem = vegetationSystem;
            vegetationSystem.AutoselectTerrain           = false;
            vegetationSystem.currentTerrain = terrain;
            //vegetationSystem.AutomaticWakeup = true;

            PersistentVegetationStoragePackage persistentVegetationStoragePackage = ScriptableObject.CreateInstance <PersistentVegetationStoragePackage>();

            persistentVegetationStorage.PersistentVegetationStoragePackage         = persistentVegetationStoragePackage;
            persistentVegetationStorage.AutoInitPersistentVegetationStoragePackage = true;

            vegetationSystem.SetSleepMode(false);

            return(vegetationSystem);
        }
            public TemporaryBackgroundPolygonObject(BillboardSystem ActiveParticleSystem, int Index)
            {
                this.Index = Index;
                this.ActiveParticleSystem = ActiveParticleSystem;
                _Rotation = Vector3.Zero;
                _Size     = Vector3.One;
                Center    = Position;

                ArrayOriginalVector = new Vector3[4];
                for (int V = 0; V < 4; V++)
                {
                    ArrayOriginalVector[V] = ActiveParticleSystem.ArrayParticles[Index * 4 + V].Position;
                }
            }
        private void btnRemoveSprite_Click(object sender, EventArgs e)
        {
            BillboardSystem ActiveParticleSystem = lstItemChoices.SelectedNode.Tag as BillboardSystem;

            if (ActiveParticleSystem != null)
            {
                int SelectedNodeIndex = lstItemChoices.SelectedNode.Index;
                lstItemChoices.Nodes.RemoveAt(SelectedNodeIndex);
                AnimationBackgroundViewer.RemoveBackgroundSystem(SelectedNodeIndex);
            }
            else if (ActiveParticleSystem == null && lstItemChoices.SelectedNode.Parent != null)
            {
                TreeNode SelectedNode      = lstItemChoices.SelectedNode.Parent;
                int      SelectedNodeIndex = SelectedNode.Index;
                ActiveParticleSystem = SelectedNode.Tag as BillboardSystem;

                ActiveParticleSystem.RemoveParticle(SelectedNodeIndex);
                lstItemChoices.Nodes.RemoveAt(SelectedNodeIndex);
            }
        }
 private void lstItemChoices_AfterSelect(object sender, TreeViewEventArgs e)
 {
     if (lstItemChoices.SelectedNode != null)
     {
         if (lstItemChoices.SelectedNode.Parent == null)
         {
             pgAnimationProperties.SelectedObject = lstItemChoices.SelectedNode.Tag;
         }
         else
         {
             BillboardSystem ActiveParticleSystem = lstItemChoices.SelectedNode.Parent.Tag as BillboardSystem;
             if (ActiveParticleSystem.RotateTowardCamera)
             {
                 pgAnimationProperties.SelectedObject = new AnimationBackground3D.TemporaryBackgroundRotatedObject(ActiveParticleSystem, lstItemChoices.SelectedNode.Index);
             }
             else
             {
                 pgAnimationProperties.SelectedObject = new AnimationBackground3D.TemporaryBackgroundPolygonObject(ActiveParticleSystem, lstItemChoices.SelectedNode.Index);
             }
         }
     }
 }
示例#7
0
        public override void Load(ContentManager Content, GraphicsDevice g)
        {
            VehiculeDrawablePart = new BillboardSystem("Units/Racing/Sprites/Back", 2, 1, BlendState.NonPremultiplied, true, Content, g);
            VehiculeDrawablePart.Parameters["Size"].SetValue(new Vector2(188 * 0.1f, 112 * 0.1f));
            VehiculeDrawablePart.AddParticle(Vector3.Zero);

            DicVehiculeSpritePerAngle.Add(0, Content.Load <Texture2D>("Units/Racing/Sprites/Back"));
            DicVehiculeSpritePerAngle.Add(5, Content.Load <Texture2D>("Units/Racing/Sprites/Back5"));
            DicVehiculeSpritePerAngle.Add(10, Content.Load <Texture2D>("Units/Racing/Sprites/Back10"));
            DicVehiculeSpritePerAngle.Add(25, Content.Load <Texture2D>("Units/Racing/Sprites/Back25"));
            DicVehiculeSpritePerAngle.Add(35, Content.Load <Texture2D>("Units/Racing/Sprites/Back35"));
            DicVehiculeSpritePerAngle.Add(45, Content.Load <Texture2D>("Units/Racing/Sprites/Back45"));
            DicVehiculeSpritePerAngle.Add(65, Content.Load <Texture2D>("Units/Racing/Sprites/Back45"));
            DicVehiculeSpritePerAngle.Add(90, Content.Load <Texture2D>("Units/Racing/Sprites/Back45"));

            DicVehiculeSpritePerAngle.Add(-5, FlipTexture2D(DicVehiculeSpritePerAngle[5]));
            DicVehiculeSpritePerAngle.Add(-10, FlipTexture2D(DicVehiculeSpritePerAngle[10]));
            DicVehiculeSpritePerAngle.Add(-25, FlipTexture2D(DicVehiculeSpritePerAngle[25]));
            DicVehiculeSpritePerAngle.Add(-35, FlipTexture2D(DicVehiculeSpritePerAngle[35]));
            DicVehiculeSpritePerAngle.Add(-45, FlipTexture2D(DicVehiculeSpritePerAngle[45]));
            DicVehiculeSpritePerAngle.Add(-65, FlipTexture2D(DicVehiculeSpritePerAngle[65]));
            DicVehiculeSpritePerAngle.Add(-90, FlipTexture2D(DicVehiculeSpritePerAngle[90]));
        }
        public static IEnumerator Apply(CoordRect rect, Terrain terrain, object dataBox, Func <float, bool> stop = null)
        {
            Profiler.BeginSample("VS Apply");

                        #if VEGETATION_STUDIO
            //clear cache
            VegetationSystem vetSys = terrain.gameObject.GetComponentInChildren <VegetationSystem>();
            for (int i = 0; i < vetSys.VegetationCellList.Count; i++)
            {
                vetSys.VegetationCellList[i].ClearCache();
            }

            vetSys.UnityTerrainData = new UnityTerrainData(terrain, false, false);

            //refresh billboards
            BillboardSystem billboardSystem = vetSys.GetComponent <BillboardSystem>();
            billboardSystem.RefreshBillboards();

            Profiler.EndSample();
                        #endif

            yield return(null);
        }
示例#9
0
        public Unit(HexPoint point, AbstractPlayerData player, UnitData data)
        {
            _point = point;
            _player = player;
            _data = data;

            Strength = 10;

            _unitAI = _data.DefaultUnitAI;

            UpdateSpotting();

            InitTransitions();
            InitFormation();

            _entity = new UnitEntity(player, this, _data.ModelName);
            _entity.Point = point;
            _entity.Scale = new Vector3(_data.ModelScale);

            _unitActionBillboard = new BillboardSystem<UnitAction>(MainApplication.Instance.GraphicsDevice, MainApplication.Instance.Content);
            _unitActionBillboard.AddEntity(UnitAction.Idle, Provider.GetAtlas("UnitActionAtlas").GetTexture("Idle"), new Vector2(2, 2));
            _unitActionBillboard.AddEntity(UnitAction.Move, Provider.GetAtlas("UnitActionAtlas").GetTexture("Move"), new Vector2(2, 2));
            _unitActionBillboard.AddEntity(UnitAction.BuildFarm, Provider.GetAtlas("UnitActionAtlas").GetTexture("BuildFarm"), new Vector2(2, 2));
            _unitActionBillboard.AddEntity(UnitAction.BuildRoad, Provider.GetAtlas("UnitActionAtlas").GetTexture("BuildRoad"), new Vector2(2, 2));
            _unitActionBillboard.AddEntity(UnitAction.Found, Provider.GetAtlas("UnitActionAtlas").GetTexture("Found"), new Vector2(2, 2));

            UpdateUnitAction();

            // path mesh
            _pathMesh = new Mesh(MainApplication.Instance.GraphicsDevice, "paths");

            if( TextureManager.Instance.Device == null )
                TextureManager.Instance.Device = MainApplication.Instance.GraphicsDevice;

            TextureManager.Instance.Add("paths", MainApplication.Instance.Content.Load<Texture2D>("Content/Textures/Ground/paths"));
            _pathMesh.LoadContent(MainApplication.Instance.Content);
        }
示例#10
0
文件: Game1.cs 项目: AD-7/PBL_Game
        protected override void Update(GameTime gameTime)
        {
            InputSystem.oldKeybordState = InputSystem.newKeybordState;
            InputSystem.newKeybordState = Keyboard.GetState();
            float delta = (float)gameTime.ElapsedGameTime.TotalMilliseconds / 1000;

            IsMouseVisible = true;

            if (!hud.huntingSystem.active)
            {
                if (gameInMainMenu)
                {
                    //Resources.Meat = 0;
                    mainMenu.Update();

                    if (mainMenu.ExitButtonEvent())
                    {
                        Exit();
                    }
                    if (mainMenu.NewGameButtonEvent())
                    {
                        gameInMainMenu   = false;
                        IsMouseVisible   = false;
                        mainMenu.ifIntro = true;
                    }
                    if (mainMenu.LoadButtonEvent())
                    {
                        gameInMainMenu = false;
                        IsMouseVisible = false;
                        LoadContent();
                        LoadGame();
                    }
                }
                else if (mainMenu.ifIntro)
                {
                    mainMenu.intro.Update(gameTime);
                    if (mainMenu.intro.IntroEvent())
                    {
                        mainMenu.ifIntro = false;
                        this.LoadContent();
                    }

                    if (InputSystem.newKeybordState.IsKeyDown(Keys.Space))
                    {
                        mainMenu.ifIntro = false;
                        this.LoadContent();
                    }
                }
                else
                {
                    if (InputSystem.newKeybordState.IsKeyDown(Keys.Escape) && InputSystem.oldKeybordState.IsKeyUp(Keys.Escape) && !hud.ifPaused && !hud.ifGameOver)
                    {
                        IsMouseVisible = true;
                        hud.ifPaused   = true;
                        return;
                    }

                    if (!hud.ifPaused && !hud.ifGameOver && !hud.ifQuestPanel)
                    {
                        if (InputSystem.newKeybordState.IsKeyDown(Keys.E))
                        {
                            AudioSystem.playGrowl(2);
                        }

                        if (InputSystem.newKeybordState.IsKeyDown(Keys.F) && InputSystem.oldKeybordState.IsKeyUp(Keys.F) && QuestSystem.currentGiver != null && QuestSystem.currentGiver.actualQuest != QuestSystem.currentQuest)
                        {
                            hud.ifQuestPanel = true;
                        }

                        if (questSystem.ChceckNearestQuestGiver(wataha.wolves[0]))
                        {
                        }
                        else
                        {
                            hud.ifQuestPanel = false;
                        }

                        if (hud.marketPanel.CheckIfWolfIsClose(wataha.wolves[0], barrell))
                        {
                            hud.marketPanel.infoActive = true;
                        }
                        else
                        {
                            hud.marketPanel.infoActive = false;
                            hud.marketPanel.active     = false;
                        }

                        if (hud.marketPanel.infoActive && InputSystem.newKeybordState.IsKeyDown(Keys.F) && InputSystem.oldKeybordState.IsKeyUp(Keys.F))
                        {
                            hud.marketPanel.active = true;
                        }

                        foreach (Wolf w in wataha.wolves)
                        {
                            colisionSystem.IsEnvironmentCollision(w, trees, wataha);
                            if (!(QuestSystem.questGivers[1].actualQuest == null && QuestSystem.questGivers[1].questCompleted.Count == QuestSystem.questGivers[1].questsList.Count))
                            {
                                colisionSystem.IsEnvironmentCollision(w, blockade, wataha);
                            }
                            colisionSystem.IsEnvironmentCollision(w, blockade2, wataha);
                            colisionSystem.IsEnvironmentCollision(w, croft, wataha);
                            colisionSystem.IsEnvironmentCollision(w, barrell, wataha);
                        }
                        foreach (Animal rabit in rabits)
                        {
                            colisionSystem.IsEnvironmentCollision(rabit, trees);
                        }

                        if (QuestSystem.currentQuest is SheepQuest)
                        {
                            foreach (Animal sheep in ((SheepQuest)QuestSystem.currentQuest).sheeps)
                            {
                                colisionSystem.IsEnvironmentCollision(sheep, trees);
                            }
                        }

                        wataha.Update(gameTime);
                        questSystem.Update(gameTime, wataha.wolves[0]);
                        foreach (Animal rabit in rabits)
                        {
                            rabit.Update(gameTime);
                        }

                        if (QuestSystem.currentQuest is SheepQuest)
                        {
                            foreach (Animal sheep in ((SheepQuest)QuestSystem.currentQuest).sheeps)
                            {
                                sheep.Update(gameTime);
                            }
                        }



                        Vector3[] positions2 = new Vector3[QuestSystem.questGivers.Count];
                        int       i          = 0;
                        foreach (QuestGiver q in QuestSystem.questGivers)
                        {
                            if (QuestSystem.currentQuest == null && q.actualQuest != null && (q.questsGiverNeedToStart == null || (q.questsGiverNeedToStart != null && q.questsGiverNeedToStart.actualQuest == null)))
                            {
                                positions2[i] = new Vector3(QuestSystem.questGivers[i].position.X,
                                                            QuestSystem.questGivers[i].position.Y + 5.0f,
                                                            QuestSystem.questGivers[i].position.Z);
                            }
                            else
                            {
                                positions2[i] = new Vector3(QuestSystem.questGivers[i].position.X,
                                                            QuestSystem.questGivers[i].position.Y + 1000.0f,
                                                            QuestSystem.questGivers[i].position.Z);
                            }
                            i++;
                        }

                        billboardTest2 = new BillboardSystem(GraphicsDevice, Content, Content.Load <Texture2D>("Pictures/questionMark"), new Vector2(0.001f), positions2);
                        trees.Update(gameTime);
                        barrell.Update(gameTime);
                        blockade.Update(gameTime);
                        blockade2.Update(gameTime);
                    }
                    else
                    {
                        if (!hud.ifGameOver)
                        {
                            if (!hud.ifSaveInfo)
                            {
                                if (hud.ResumeButtonEvent())
                                {
                                    hud.ifPaused = false;
                                }
                                if (hud.SaveButtonEvent())
                                {
                                    SaveSystem saver = new SaveSystem(hud.wataha.wolves.ElementAt(0), hud.wataha.wolves.ElementAt(1), hud.wataha.wolves.ElementAt(2));
                                    saver.SaveGame();
                                    hud.ifSaveInfo = true;
                                }
                                if (hud.BackToMainMenuButtonEvent())
                                {
                                    hud.ifPaused   = false;
                                    gameInMainMenu = true;
                                }
                                if (hud.ExitButtonEvent())
                                {
                                    Exit();
                                }
                            }
                            else
                            {
                                hud.InfoSaveOkEvent();
                            }
                        }
                        else
                        {
                            if (hud.InfoGameOverOkEvent())
                            {
                                hud.ifPaused   = false;
                                hud.ifGameOver = false;
                                gameInMainMenu = true;
                            }
                        }
                    }

                    Vector3 offset       = new Vector3(MathHelper.ToRadians(2.0f));
                    Vector3 randAngle    = Vector3.Up + randVec3(-offset, offset);
                    Vector3 randPosition = randVec3(new Vector3(-1.5f), new Vector3(1.5f));
                    float   randSpeed    = (float)rand.NextDouble() * 2 + 10;

                    ps.AddParticle(randPosition, randAngle, randSpeed);
                    ps.Update();

                    hud.Update(gameTime);


                    GameObject.changeDay(gameTime);
                }
            }

            else
            {
                hud.huntingSystem.Update(gameTime);
            }

            base.Update(gameTime);
        }
示例#11
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");
        }
示例#12
0
        public void LoadContent()
        {
            // big water surface to make the world a gigantic ocean
            TextureManager.Instance.Add("ground", _manager.Content.Load<Texture2D>("Content/Textures/Ground/ground"));
            _baseMesh.LoadContent(_manager.Content);
            _baseMesh.AddObject(new MeshedRectangle(new Vector3(0, -0.1f, 0), new Vector3(1000)));

            // cursor
            TextureManager.Instance.Add("cursors", _manager.Content.Load<Texture2D>("Content/Textures/Ground/cursors"));
            _cursorsMesh.LoadContent(_manager.Content);
            _cursorsMesh.AddObject(new HexagonMeshItem8X8(MapData.GetWorldPosition(20, 20), 63));

            _borderMesh.LoadContent(_manager.Content);

            // roads
            TextureManager.Instance.Add("roads", _manager.Content.Load<Texture2D>("Content/Textures/Ground/roads"));
            _roadMesh.LoadContent(_manager.Content);

            // farms
            TextureManager.Instance.Add("farms", _manager.Content.Load<Texture2D>("Content/Textures/Ground/farms"));
            _farmMesh.LoadContent(_manager.Content);

            // rivers
            TextureManager.Instance.Add("rivers", _manager.Content.Load<Texture2D>("Content/Textures/Ground/rivers"));
            _riverMesh.LoadContent(_manager.Content);

            // resources
            _resourceBillboards = new BillboardSystem<string>(_manager.GraphicsDevice, _manager.Content);

            Texture2D resourceBackground = _manager.Content.Load<Texture2D>("Content//Textures//UI//MainView//resourcesback64");
            foreach (Ressource r in Provider.Instance.Ressources.Values)
            {
                if (r.Image != null)
                    _resourceBillboards.AddEntity(r.Name, TextureUtils.Combine(_manager.GraphicsDevice, resourceBackground, r.Image), new Vector2(2, 2));
                else
                    throw new Exception("No image for " + r.Name + " found");
            }

            //_terrainBillboards = new BillboardSystem<EBillBoard>(_manager.GraphicsDevice, _manager.Content);
            //_terrainBillboards.AddEntity(EBillBoard.Wood1, "Content/Textures/Billboards/wood1", new Vector2(3, 3));
            //_terrainBillboards.AddEntity(EBillBoard.Wood2, "Content/Textures/Billboards/wood2", new Vector2(3, 3));
            //_terrainBillboards.AddEntity(EBillBoard.Wood3, "Content/Textures/Billboards/wood3", new Vector2(3, 3));

            //_terrainBillboards.AddEntity(EBillBoard.Pine1, "Content/Textures/Billboards/pine1", new Vector2(3, 3));
            //_terrainBillboards.AddEntity(EBillBoard.Pine2, "Content/Textures/Billboards/pine2", new Vector2(3, 3));

            hMesh.LoadContent(_manager.Content);
            //_billboards.AddEntity(EBillBoard.Jungle1, "Content/Textures/forest/wood1", new Vector2(3, 3));
            //_billboards.AddEntity(EBillBoard.Jungle2, "Content/Textures/forest/wood3", new Vector2(3, 3));
            //_billboards.AddEntity(EBillBoard.Jungle3, "Content/Textures/forest/wood5", new Vector2(3, 3));
        }
 public TemporaryBackgroundRotatedObject(BillboardSystem ActiveParticleSystem, int Index)
 {
     this.Index = Index;
     this.ActiveParticleSystem = ActiveParticleSystem;
 }
示例#14
0
        /// <summary>
        /// Adds models to the game. Add camera to the game. We'll do more with this later.
        /// </summary>
        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            //Load camera.
            if (_cameraType == CameraType.TargetCamera)
            {
                _camera = new TargetCamera(
                    (new Vector3(0, 500, 500)) * 3,
                    Vector3.Zero, GraphicsDevice);
            }

            if (_cameraType == CameraType.FreeCamera)
            {
                _camera = new FreeCamera(
                    (new Vector3(500, 600, 1300)) * 1,
                    MathHelper.ToRadians(153),
                    MathHelper.ToRadians(5),
                    GraphicsDevice);
            }

            // Load Card texture.
            _cardTexture = Content.Load <Texture2D>("Cards\\Images\\cardlayout-2");

            // Load some fonts.
            _basicFont           = Content.Load <SpriteFont>("Fonts\\SpriteFont1");
            _rulesTextFont       = Content.Load <SpriteFont>("Fonts\\RulesTextFont");
            _rulesTextItalicFont = Content.Load <SpriteFont>("Fonts\\RulesTextItalicFont");
            _titleFont           = Content.Load <SpriteFont>("Fonts\\TitleFont");
            _typeFont            = Content.Load <SpriteFont>("Fonts\\TypeFont");
            _statFont            = Content.Load <SpriteFont>("Fonts\\StatFont");

            // Load models.
            _models.Add(
                new BasicModel(
                    Content.Load <Model>("blueship"),
                    Vector3.Zero,
                    Quaternion.Identity,
                    new Vector3(.01f),
                    GraphicsDevice));
            _movementDataReporter.PlayerShipSelected.Add("blueship", false);

            //Load sky box.
            _skybox = new Skybox(Content, GraphicsDevice, Content.Load <TextureCube>("Textures\\bluestreak"));


            //Load stars.
            Random r = new Random();

            Vector3[] postions      = new Vector3[30000];
            float     dispersalRate = 700000;
            float     height        = -400000;

            for (int i = 0; i < postions.Length; i++)
            {
                postions[i] = new Vector3((float)r.NextDouble() * dispersalRate - dispersalRate / 2, (float)r.NextDouble() * (height) - height / 2, (float)r.NextDouble() * dispersalRate - dispersalRate / 2);
                //postions[i] = new Vector3(10000, 400, 10000);
            }

            _stars = new BillboardSystem(GraphicsDevice, Content, Content.Load <Texture2D>("BillboardTextures\\flare-blue-purple1"), new Vector2(800), postions);


            // TEST DESERIALIZATION
            //_cards = CardCollection.Deserialize(File.ReadAllText("Content/Cards/Cards.json"));
            _cards = CardCollection.Deserialize(File.ReadAllText("Content/Cards/Cards.json"));

            FleetHackers.FleetHackersServer.FleetHackersServiceClient fhClient = new FleetHackers.FleetHackersServer.FleetHackersServiceClient();
            string result = fhClient.GetData(1223);             //this test works.

            //Appears we're experiencing some schema issues here. Will track down what the issue is.
            //cards = fhClient.GetCardData(new List<Card>());

            //cards = fhClient.GetCardData(cards); // This stuff needs fixing. JSON is disabled in the meantime.

            fhClient.Close();

            foreach (Card c in _cards)
            {
                Debug.WriteLine(c.Title);
                Debug.WriteLine(c.RulesText);
            }

            //initialize debug stuff
            DebugDraw._camera     = _camera;
            DebugDraw._lineDrawer = _lineDrawer;
        }
示例#15
0
 public AnimationBackground3DBillboard(ContentManager Content, BinaryReader BR, GraphicsDevice g)
     : base(BackgroundTypeName)
 {
     ActiveBillboardSystem = new BillboardSystem(BR, 20000, Content, g);
 }
示例#16
0
 public AnimationBackground3DBillboard(BillboardSystem ActiveBillboardSystem)
     : base(BackgroundTypeName)
 {
     this.ActiveBillboardSystem = ActiveBillboardSystem;
 }