Example #1
0
        void InitializeScene()
        {
            ResetScene();

            Entities.Add("Sky", new Sky());
            MainLight = new Sunlight();
            MainTerrain = new TerrainVoxel();
            /*
            MainTerrain = new TerrainHeightmap("Textures/level1_hm.png", 0, 100.0f);
            float width = (MainTerrain as TerrainHeightmap).GetWidth();
            float height = (MainTerrain as TerrainHeightmap).MaximumHeight;
            MainTerrain.Transformation.SetScale(new Vector3(1, height / width, 1) * width);
            */

            MainPlayer = new Camera();

            Entities.Add("MainCamera", MainPlayer);
            Entities.Add("Terrain", MainTerrain);
            Entities.Add("Light", MainLight);
            Entities.Add("Plane", new Model("Plane"));
            Entities.Add("AmbientLight", new Light(LightType.Ambient, new Vector3(0.15f, 0.35f, 0.55f), Vector3.Zero, false));
            Entities.Add("TestTree", new Model("Palm02"));
            Entities["TestTree"].Transformation.SetPosition(Vector3.Forward * 10.0f);
            Entities.Add("TestTree2", new Model("JungleOverhang"));
            Entities["TestTree2"].Transformation.SetPosition(Vector3.Forward * 10.0f + Vector3.Right * 7.6f);

            //AddEntity("Grass", new GrassPlacement());
            AddEntity("Forest", new ForestManager());
            //CreateForest();

            //Entities.Add("Grass", new ShapePlacement());

            /*
            Model testGeom = new Model("test_level");
            testGeom.Transformation.SetPosition(Vector3.Up*20.0f);
            Entities.Add("scene_geom1", testGeom);

            Model testGeom2 = new Model("cgWarehouse002story");
            testGeom2.Transformation.SetPosition(Vector3.Up * 21.0f);
            Entities.Add("scene_geom2", testGeom2);
            */
            AnimatedModel model = new AnimatedModel("Allosaurus");

            model.Transformation.SetPosition(Vector3.Forward*10+Vector3.Up*68);
            model.Model.GetAnimationLayer().SetActiveAnimation("AllosaurusIdle", true);//.SetAnimationLayer("AllosaurusIdle", 1.0f);
            model.Model.SetCustomMatrix(Matrix.CreateScale(0.09f)*Matrix.CreateRotationX(-MathHelper.PiOver2));
            //model.UpdateAnimation();
            Entities.Add("TestCharacter", model);

            AnimatedModel model2 = new AnimatedModel("AlphaRaptor");

            model2.Transformation.SetPosition(Vector3.Forward * -5 + Vector3.Up * 62);
            model2.Model.GetAnimationLayer().SetActiveAnimation("AlphaRaptorIdle", true);//.SetAnimationLayer("AlphaRaptorIdle", 1.0f);
            model2.Model.SetCustomMatrix(Matrix.CreateScale(0.12f) * Matrix.CreateRotationX(-MathHelper.PiOver2));
            //model.UpdateAnimation();
            Entities.Add("TestCharacter2", model2);

            Raptor raptor = new Raptor(ResourceManager.Inst.GetDinosaurDatablock("Coelophysis"));
            Entities.Add("Raptor", raptor);

            Chest weaponCrate = new Chest("Weapon Box", "WeaponBox");
            weaponCrate.Transformation.SetPosition(Vector3.Up * 30.0f);
            Entities.Add("weaponCrate", weaponCrate);
            CreateTeams();

            //Entities.Add("Light2", new Light(LightType.Directional, new Vector3(0.2797f, 0.344f, 0.43f), Vector3.Up, false));

            Initialize();
        }
Example #2
0
        void InitializeScene()
        {
            ResetScene();

            Entities.Add("Sky", new Sky());
            MainLight = new Sunlight();
            MainTerrain = new TerrainVoxel();

            /*
            MainTerrain = new TerrainHeightmap("Textures/Island_HM.png", 0, 100.0f);
            float width = (MainTerrain as TerrainHeightmap).GetWidth();
            float height = (MainTerrain as TerrainHeightmap).MaximumHeight;
            MainTerrain.Transformation.SetScale(new Vector3(1, height / width, 1) * width);
            */

            Entities.Add("MainCamera", new Camera());

            Entities.Add("Terrain", MainTerrain);
            Entities.Add("Light", MainLight);
            Entities.Add("AmbientLight", new Light(LightType.Ambient, new Vector3(0.15f, 0.35f, 0.55f), Vector3.Zero, false));

            CreateLandmarks();

            AddEntity("Grass", new ClusterManager(new string[]{"Bush", "Fern", "Phila01", "ElephantEar", "BirdsNest", "PalmPlant", "TropicalPlant"}, 20, true));//120, true));

            /*
            ForestManager grassMgr = new ForestManager(new string[] { "Bush", "Fern", "Phila01", "ElephantEar", "BirdsNest", "PalmPlant", "TropicalPlant" }, 8192);
            grassMgr.alignToSurface = true;
            AddEntity("Grass", grassMgr);
            */
            AddEntity("Forest", new ForestManager(new string[] { "Cecropia", "Palm02", "QueensPalm01", "Tree01", "Tree02", "Palm01", "BeachPalm"}, 3000));
            /*
            Raptor raptor = new Raptor(ResourceManager.Inst.GetDinosaurDatablock("Allosaurus"));
            raptor.SetSpawnPosition(FindEntity("Tent").Transformation.GetPosition());
            AddEntity("Raptor", raptor);
            */
            CreateTeams();

            //Entities.Add("Light2", new Light(LightType.Directional, new Vector3(0.2797f, 0.344f, 0.43f), Vector3.Up, false));

            Initialize();
            GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced);
        }
Example #3
0
        void InitializeScene()
        {
            Vector3[] directions = new Vector3[] { Vector3.Left, Vector3.Right, Vector3.Forward, Vector3.Backward, Vector3.Up };
            foreach (Vector3 dir in directions)
            {
                Entities.Add(new Opponent(dir * 0.5f));
            }
            Entities.Add(new Sky());
            MainLight = new Sunlight();
            MainTerrain = new Terrain();
            MainPlayer = new Player(Vector3.Up * 0.25f);

            Entities.Add(MainPlayer);
            Entities.Add(MainTerrain);
            Entities.Add(MainLight);
            for (int i = 0; i < 50; i++)
            {
                Tree tree = new Tree();
                tree.setNum(i % 8);
                Entities.Add(tree);
            }

            Random randomHelper = new Random();
            for (int i = 0; i < NUM_GEMS; i++)
            {
                Entities.Add(new Gem(randomHelper));
                Entities.Add(new Health(randomHelper));
            }

            Entities.Add(new Light(LightType.Directional, new Vector3(0.1797f, 0.744f, 1.12f), Vector3.Right, false));
        }