// place for bounding sphere tree #endregion #region methods public Scene() { DirectionalLights = new LightDirectional[ResourceManager.DIRECTIONAL_MAX_LIGHTS]; for (int i = 0; i < ResourceManager.DIRECTIONAL_MAX_LIGHTS; ++i) { DirectionalLights[i] = null; } PointLights = new List <LightPoint>(); ObjectsDictionary = new Dictionary <uint, GameObject>(); ObjectsQT = new QuadTree(ObjectsDictionary, 3000.0f); runtimeAdded = new List <GameObject>(); runtimeRemoved = new List <GameObject>(); globalShadowsRenderTarget = new RenderTarget2D( TrashSoupGame.Instance.GraphicsDevice, TrashSoupGame.Instance.Window.ClientBounds.Width / BLUR_FACTOR, TrashSoupGame.Instance.Window.ClientBounds.Height / BLUR_FACTOR, false, TrashSoupGame.Instance.GraphicsDevice.PresentationParameters.BackBufferFormat, TrashSoupGame.Instance.GraphicsDevice.PresentationParameters.DepthStencilFormat, TrashSoupGame.Instance.GraphicsDevice.PresentationParameters.MultiSampleCount, RenderTargetUsage.DiscardContents ); tempRenderTarget01 = new RenderTarget2D( TrashSoupGame.Instance.GraphicsDevice, TrashSoupGame.Instance.Window.ClientBounds.Width / BLUR_FACTOR, TrashSoupGame.Instance.Window.ClientBounds.Height / BLUR_FACTOR, false, TrashSoupGame.Instance.GraphicsDevice.PresentationParameters.BackBufferFormat, TrashSoupGame.Instance.GraphicsDevice.PresentationParameters.DepthStencilFormat, TrashSoupGame.Instance.GraphicsDevice.PresentationParameters.MultiSampleCount, RenderTargetUsage.DiscardContents ); deferredOrthoMatrix = Matrix.CreateOrthographicOffCenter(0.0f, (float)TrashSoupGame.Instance.Window.ClientBounds.Width, (float)TrashSoupGame.Instance.Window.ClientBounds.Height, 0, 0, 1); ifRenderShadows = true; // TEMPORARY!!!!!!!!!! CurrentPostEffect = ResourceManager.Instance.PostEffects["Default"]; /////////////////////////////////// }
public void ReadXml(System.Xml.XmlReader reader) { reader.MoveToContent(); reader.ReadStartElement(); ResourceManager.Instance.CurrentScene.ObjectsDictionary = new Dictionary <uint, GameObject>(); ResourceManager.Instance.CurrentScene.PointLights = new List <LightPoint>(); DirectionalLights = new LightDirectional[ResourceManager.DIRECTIONAL_MAX_LIGHTS]; if (reader.Name == "SceneParams") { Params = new SceneParams(0, "null"); (Params as IXmlSerializable).ReadXml(reader); } if (reader.Name == "AmbientLight") { AmbientLight = new LightAmbient(0, "null"); (AmbientLight as IXmlSerializable).ReadXml(reader); } int ctr = 0; reader.ReadStartElement("DirectionalLights"); while (reader.NodeType != System.Xml.XmlNodeType.EndElement) { if (reader.Name == "DirectionalLight") { reader.ReadStartElement(); if (reader.Name != "null") { LightDirectional obj = new LightDirectional(0, ""); (obj as IXmlSerializable).ReadXml(reader); DirectionalLights[ctr] = obj; ++ctr; } else { reader.ReadElementString("null", ""); reader.ReadEndElement(); ++ctr; } } } reader.ReadEndElement(); reader.ReadStartElement("PointLights"); while (reader.NodeType != System.Xml.XmlNodeType.EndElement) { if (reader.Name == "PointLight") { reader.ReadStartElement(); LightPoint pl = new LightPoint(0, ""); ResourceManager.Instance.CurrentScene.PointLights.Add(pl); (pl as IXmlSerializable).ReadXml(reader); if (pl.CastShadows) { pl.SetupShadowRender(); } reader.ReadEndElement(); } else { reader.ReadElementString("null", ""); } } reader.ReadEndElement(); reader.ReadStartElement("ObjectsDictionary"); while (reader.NodeType != System.Xml.XmlNodeType.EndElement) { if (reader.Name == "GameObject") { reader.ReadStartElement(); GameObject obj = null; uint key = (uint)reader.ReadElementContentAsInt("GameObjectKey", ""); if (ResourceManager.Instance.CurrentScene.ObjectsDictionary.TryGetValue(key, out obj)) { Debug.Log("GameObject successfully loaded - " + obj.Name); GameObject tmp = null; (tmp as IXmlSerializable).ReadXml(reader); } else { obj = new GameObject(0, ""); ResourceManager.Instance.CurrentScene.ObjectsDictionary.Add(key, obj); (obj as IXmlSerializable).ReadXml(reader); Debug.Log("New Gameobject successfully loaded - " + obj.Name); } } reader.ReadEndElement(); } reader.ReadEndElement(); if (reader.Name == "Camera") { Cam = new Camera(0, "null", Vector3.Zero, Vector3.Zero, Vector3.Zero, Vector3.Zero, MathHelper.Pi / 3.0f, 1.0f, 0.1f, 2000.0f); reader.ReadStartElement(); (Cam as IXmlSerializable).ReadXml(reader); } ObjectsDictionary = ResourceManager.Instance.CurrentScene.ObjectsDictionary; PointLights = ResourceManager.Instance.CurrentScene.PointLights; reader.ReadEndElement(); }
public void LoadContent(Game game) { LoadTextures(); LoadEffects(); AudioManager.Instance.LoadContent(); TrashSoupGame.Instance.ReloadSpriteBatch(); //LoadCues(); // because it pisses me off - Mav //AudioManager.Instance.PlayCue(GetCueFromCueList("Track1")); //default music from tutorial, just to check that everything works xD // FOR TETIN AddModel("Models/Test/TestBox"); AddModel("Models/Test/TestCube"); AddModel("Models/Test/TestTerrain"); AddModel("Models/Test/TestGuy"); AddModel("Models/Test/TestSphere"); AddModel("Models/Test/TestSphere_LOD1"); AddModel("Models/Test/TestSphere_LOD2"); AddModel("Models/Test/TestMirror"); AddModel("Models/Weapons/Signs/StopSign"); AddModel("Models/Weapons/Stones/brick"); AddModel("Models/Enviro/Ground/street_cross"); AddModel("Models/Weapons/Stones/brick_destructible/4"); AddModel("Models/Test/TestSquarePlane"); AddModel("Models/Test/TestSquarePlane"); AddModel("Models/MainCharacter/MainCharacter"); AddAnimation("Animations/MainCharacter/attack_Hweapon_1"); AddAnimation("Animations/MainCharacter/attack_Hweapon_2"); AddAnimation("Animations/MainCharacter/attack_Hweapon_3"); AddAnimation("Animations/MainCharacter/attack_Hweapon_4"); AddAnimation("Animations/MainCharacter/attack_Mweapon_1"); AddAnimation("Animations/MainCharacter/attack_Mweapon_2"); AddAnimation("Animations/MainCharacter/attack_Mweapon_3"); AddAnimation("Animations/MainCharacter/attack_Mweapon_4"); AddAnimation("Animations/MainCharacter/attack_Mweapon_5"); AddAnimation("Animations/MainCharacter/block_1"); AddAnimation("Animations/MainCharacter/bow_1"); AddAnimation("Animations/MainCharacter/boxing_1"); AddAnimation("Animations/MainCharacter/boxing_2"); AddAnimation("Animations/MainCharacter/boxing_3"); AddAnimation("Animations/MainCharacter/boxing_4"); AddAnimation("Animations/MainCharacter/charge_Hweapon"); // AddAnimation("Animations/MainCharacter/charge_SMweapon"); // AddAnimation("Animations/MainCharacter/custom_kick"); // AddAnimation("Animations/MainCharacter/custom_slash"); // AddAnimation("Animations/MainCharacter/custom_whirl"); AddAnimation("Animations/MainCharacter/dodge_1"); AddAnimation("Animations/MainCharacter/dying_1"); AddAnimation("Animations/MainCharacter/idle_1"); AddAnimation("Animations/MainCharacter/idle_2"); AddAnimation("Animations/MainCharacter/idle_Fists"); AddAnimation("Animations/MainCharacter/idle_Hweapon"); AddAnimation("Animations/MainCharacter/idle_SMweapon"); AddAnimation("Animations/MainCharacter/injuries_1"); AddAnimation("Animations/MainCharacter/injuries_2"); AddAnimation("Animations/MainCharacter/jump"); AddAnimation("Animations/MainCharacter/run_2"); AddAnimation("Animations/MainCharacter/dying_1"); AddAnimation("Animations/MainCharacter/run_Hweapon"); // AddAnimation("Animations/MainCharacter/run_SMweapon"); AddAnimation("Animations/MainCharacter/walk_1"); AddAnimation("Animations/MainCharacter/walk_Hweapon"); AddAnimation("Animations/MainCharacter/walki_SMweapon"); AddAnimation("Animations/Enemies/Rat_attack"); AddAnimation("Animations/Enemies/Rat_dying"); AddAnimation("Animations/Enemies/Rat_idle"); AddAnimation("Animations/Enemies/Rat_run"); AddAnimation("Animations/Enemies/Rat_walk"); AddAnimation("Animations/Test/walking_1"); AddAnimation("Animations/Test/idle_1"); AddAnimation("Animations/Test/jump_1"); AddModel("Models/Enviro/Railing/Railing_1"); //Wika i Kasia // loading materials List <Material> testPlayerMats = new List <Material>(); Material testPlayerMat = new Material("testPlayerMat", LoadEffect(@"Effects\NormalEffect"), LoadTexture(@"Textures\Test\cargo")); testPlayerMats.Add(testPlayerMat); testPlayerMat.NormalMap = LoadTexture(@"Textures\Test\cargo_NRM"); testPlayerMat.Glossiness = 40.0f; testPlayerMat.Transparency = 1.0f; testPlayerMat.RecieveShadows = true; if (!this.Materials.ContainsKey(testPlayerMat.Name)) { this.Materials.Add(testPlayerMat.Name, testPlayerMat); } List <Material> testPlayerMats2 = new List <Material>(); Material testPlayerMat2 = new Material("testPlayerMat2", this.Effects[@"Effects\CubeNormalEffect"], LoadTexture(@"Textures\Test\cargo")); testPlayerMats2.Add(testPlayerMat2); testPlayerMat2.NormalMap = LoadTexture(@"Textures\Test\cargo_NRM"); testPlayerMat2.CubeMap = LoadTextureCube(@"Textures\Skyboxes\Dusk"); testPlayerMat2.Glossiness = 40.0f; testPlayerMat2.ReflectivityColor = new Vector3(1.0f, 0.0f, 1.0f); testPlayerMat2.ReflectivityBias = 0.7f; testPlayerMat2.Transparency = 0.25f; testPlayerMat2.RecieveShadows = true; if (!this.Materials.ContainsKey(testPlayerMat2.Name)) { this.Materials.Add(testPlayerMat2.Name, testPlayerMat2); } List <Material> testMirrorMats = new List <Material>(); Material testMirrorMat2 = new MirrorMaterial("testMirrorMat2", this.Effects[@"Effects\NormalEffect"]); testMirrorMats.Add(testMirrorMat2); testMirrorMat2.DiffuseMap = LoadTexture(@"Textures\Home\Furnitures\mirror_D"); testMirrorMat2.NormalMap = LoadTexture(@"Textures\Home\Furnitures\mirror_N"); testMirrorMat2.Glossiness = 100.0f; testMirrorMat2.ReflectivityBias = 0.0f; if (!this.Materials.ContainsKey(testMirrorMat2.Name)) { this.Materials.Add(testMirrorMat2.Name, testMirrorMat2); } Material testMirrorMat = new MirrorMaterial("testMirrorMat", this.Effects[@"Effects\MirrorEffect"]); testMirrorMats.Add(testMirrorMat); testMirrorMat.DiffuseMap = LoadTexture(@"Textures\Home\Furnitures\mirror_glass"); testMirrorMat.Glossiness = 100.0f; testMirrorMat.ReflectivityBias = 0.0f; if (!this.Materials.ContainsKey(testMirrorMat.Name)) { this.Materials.Add(testMirrorMat.Name, testMirrorMat); } List <Material> testWaterMats = new List <Material>(); Material testWaterMat = new WaterMaterial("testWaterMat", this.Effects[@"Effects\WaterEffect"]); testWaterMats.Add(testWaterMat); testWaterMat.DiffuseMap = LoadTexture(@"Textures\Test\dirtywater"); testWaterMat.NormalMap = LoadTexture(@"Textures\Test\water"); testWaterMat.Glossiness = 200.0f; testWaterMat.ReflectivityBias = 0.6f; if (!this.Materials.ContainsKey(testWaterMat.Name)) { this.Materials.Add(testWaterMat.Name, testWaterMat); } //List<Material> playerMats = LoadBasicMaterialsFromModel(Models["Models/MainCharacter/MainCharacter"], this.Effects[@"Effects\NormalEffect"]); //foreach(Material mat in playerMats) //{ // mat.RecieveShadows = true; //} //List<Material> ratMats = LoadBasicMaterialsFromModel(Models["Models/MainCharacter/MainCharacter"], this.Effects[@"Effects\NormalEffect"]); List <Material> ratMats = new List <Material>(); Material ratMat01 = new Material("PlayerMat", this.Effects[@"Effects\NormalEffect"]); ratMat01.DiffuseMap = LoadTexture(@"Models\Enemies\Mutant_body_D"); ratMat01.NormalMap = LoadTexture(@"Models\Enemies\Mutant_body_N"); ratMats.Add(ratMat01); Material ratMat02 = new Material("PlayerMatHair", this.Effects[@"Effects\NormalEffect"]); ratMat02.DiffuseMap = LoadTexture(@"Models\Enemies\Mutant_head_D"); ratMat02.NormalMap = LoadTexture(@"Models\Enemies\Mutant_head_N"); ratMats.Add(ratMat02); List <Material> deSign = LoadBasicMaterialsFromModel(Models["Models/Enviro/Ground/street_cross"], this.Effects[@"Effects\NormalEffect"]); List <Material> bb = LoadBasicMaterialsFromModel(Models["Models/Weapons/Stones/brick"], Effects[@"Effects\NormalEffect"]); List <Material> testTerMats = new List <Material>(); Material testTerMat = new Material("testTerMat", this.Effects[@"Effects\NormalEffect"], LoadTexture(@"Textures\Test\metal01_d")); testTerMat.NormalMap = LoadTexture(@"Textures\Test\water"); testTerMat.SpecularColor = new Vector3(0.1f, 0.1f, 0.0f); testTerMat.Glossiness = 10.0f; testTerMat.RecieveShadows = true; testTerMat.Unlit = true; if (!this.Materials.ContainsKey(testTerMat.Name)) { this.Materials.Add(testTerMat.Name, testTerMat); } if (!testTerMats.Contains(testTerMat)) { testTerMats.Add(testTerMat); } List <Material> testSBMats = new List <Material>(); SkyboxMaterial testSBMat = new SkyboxMaterial("testSBMat", this.Effects[@"Effects\SkyboxEffect"]); testSBMat.CubeMap = LoadTextureCube(@"Textures\Skyboxes\Dawn"); testSBMat.CubeMap1 = LoadTextureCube(@"Textures\Skyboxes\Daylight"); testSBMat.CubeMap2 = LoadTextureCube(@"Textures\Skyboxes\Dusk"); testSBMat.CubeMap3 = LoadTextureCube(@"Textures\Skyboxes\Night"); testSBMat.Probes = new Vector4(0.0f, 0.0f, 0.0f, 1.0f); testSBMat.SpecularColor = new Vector3(0.0f, 0.0f, 0.0f); testSBMat.Glossiness = 100.0f; if (!this.Materials.ContainsKey(testSBMat.Name)) { this.Materials.Add(testSBMat.Name, testSBMat); } if (!testSBMats.Contains(testSBMat)) { testSBMats.Add(testSBMat); } //WIKA I KASIA Testowanie modeli List <Material> awsomeTestMats = new List <Material>(); Material awsomeTestMat = new Material("awsomeTestMat", this.Effects[@"Effects\NormalEffect"], LoadTexture(@"Textures\Enviro\Railing\Railing_D")); awsomeTestMats.Add(awsomeTestMat); awsomeTestMats.Add(awsomeTestMat); awsomeTestMat.NormalMap = LoadTexture(@"Textures\Enviro\Railing\Railing_N"); awsomeTestMat.Glossiness = 40.0f; awsomeTestMat.ReflectivityColor = new Vector3(1.0f, 0.0f, 1.0f); awsomeTestMat.ReflectivityBias = 0.0f; awsomeTestMat.Transparency = 1.0f; awsomeTestMat.RecieveShadows = true; if (!this.Materials.ContainsKey(awsomeTestMat.Name)) { this.Materials.Add(awsomeTestMat.Name, awsomeTestMat); } // loading gameobjects GameObject testBox = new GameObject(1, "Player"); testBox.MyTransform = new Transform(testBox, new Vector3(2.0f, 3.0f, -5.0f), new Vector3(0.0f, 0.0f, 1.0f), new Vector3(0.0f, 0.0f, 0.0f), 0.0075f); CustomModel skModel = new CustomModel(testBox, new Model[] { Models["Models/MainCharacter/MainCharacter"], null, null }, ratMats); Animator playerAnimator = new Animator(testBox, skModel.LODs[0]); playerAnimator.AddAnimationClip(LoadAnimationFromModel(skModel.LODs[0], LoadAnimation("Animations/MainCharacter/run_2"), "Animations/MainCharacter/run_2")); playerAnimator.AddAnimationClip(LoadAnimationFromModel(skModel.LODs[0], LoadAnimation("Animations/MainCharacter/idle_Hweapon"), "Animations/MainCharacter/idle_Hweapon")); playerAnimator.AddAnimationClip(LoadAnimationFromModel(skModel.LODs[0], LoadAnimation("Animations/MainCharacter/idle_Fists"), "Animations/MainCharacter/idle_Fists")); playerAnimator.AddAnimationClip(LoadAnimationFromModel(skModel.LODs[0], LoadAnimation("Animations/MainCharacter/idle_SMweapon"), "Animations/MainCharacter/idle_SMweapon")); playerAnimator.AddAnimationClip(LoadAnimationFromModel(skModel.LODs[0], LoadAnimation("Animations/MainCharacter/dodge_1"), "Animations/MainCharacter/dodge_1")); playerAnimator.AddAnimationClip(LoadAnimationFromModel(skModel.LODs[0], LoadAnimation("Animations/MainCharacter/boxing_4"), "Animations/MainCharacter/boxing_4")); playerAnimator.AddAnimationClip(LoadAnimationFromModel(skModel.LODs[0], LoadAnimation("Animations/MainCharacter/boxing_1"), "Animations/MainCharacter/boxing_1")); playerAnimator.AddAnimationClip(LoadAnimationFromModel(skModel.LODs[0], LoadAnimation("Animations/MainCharacter/boxing_2"), "Animations/MainCharacter/boxing_2")); playerAnimator.AddAnimationClip(LoadAnimationFromModel(skModel.LODs[0], LoadAnimation("Animations/MainCharacter/boxing_3"), "Animations/MainCharacter/boxing_3")); playerAnimator.AddAnimationClip(LoadAnimationFromModel(skModel.LODs[0], LoadAnimation("Animations/MainCharacter/attack_Hweapon_1"), "Animations/MainCharacter/attack_Hweapon_1")); playerAnimator.AddAnimationClip(LoadAnimationFromModel(skModel.LODs[0], LoadAnimation("Animations/MainCharacter/attack_Hweapon_2"), "Animations/MainCharacter/attack_Hweapon_2")); playerAnimator.AddAnimationClip(LoadAnimationFromModel(skModel.LODs[0], LoadAnimation("Animations/MainCharacter/attack_Hweapon_3"), "Animations/MainCharacter/attack_Hweapon_3")); playerAnimator.AddAnimationClip(LoadAnimationFromModel(skModel.LODs[0], LoadAnimation("Animations/MainCharacter/attack_Hweapon_4"), "Animations/MainCharacter/attack_Hweapon_4")); playerAnimator.AddAnimationClip(LoadAnimationFromModel(skModel.LODs[0], LoadAnimation("Animations/MainCharacter/attack_Mweapon_1"), "Animations/MainCharacter/attack_Mweapon_1")); playerAnimator.AddAnimationClip(LoadAnimationFromModel(skModel.LODs[0], LoadAnimation("Animations/MainCharacter/attack_Mweapon_2"), "Animations/MainCharacter/attack_Mweapon_2")); playerAnimator.AddAnimationClip(LoadAnimationFromModel(skModel.LODs[0], LoadAnimation("Animations/MainCharacter/attack_Mweapon_3"), "Animations/MainCharacter/attack_Mweapon_3")); playerAnimator.AddAnimationClip(LoadAnimationFromModel(skModel.LODs[0], LoadAnimation("Animations/MainCharacter/attack_Mweapon_4"), "Animations/MainCharacter/attack_Mweapon_4")); playerAnimator.AddAnimationClip(LoadAnimationFromModel(skModel.LODs[0], LoadAnimation("Animations/MainCharacter/attack_Mweapon_5"), "Animations/MainCharacter/attack_Mweapon_5")); playerAnimator.AddAnimationClip(LoadAnimationFromModel(skModel.LODs[0], LoadAnimation("Animations/MainCharacter/building"), "Animations/MainCharacter/building")); playerAnimator.AddAnimationClip(LoadAnimationFromModel(skModel.LODs[0], LoadAnimation("Animations/MainCharacter/dying_1"), "Animations/MainCharacter/dying_1")); playerAnimator.AddAnimationClip(LoadAnimationFromModel(skModel.LODs[0], LoadAnimation("Animations/MainCharacter/block_1"), "Animations/MainCharacter/block_1")); playerAnimator.AddAnimationClip(LoadAnimationFromModel(skModel.LODs[0], LoadAnimation("Animations/MainCharacter/grzebanie"), "Animations/MainCharacter/grzebanie")); testBox.Components.Add(skModel); testBox.MyAnimator = playerAnimator; PlayerController pc = new PlayerController(testBox); testBox.Components.Add(pc); testBox.Dynamic = true; HideoutStash testStash = new HideoutStash(testBox); testStash.CurrentTrash = 1000; testBox.Components.Add(testStash); Equipment eq = new Equipment(testBox); eq.JunkCount = 10; testBox.Components.Add(eq); testBox.MyPhysicalObject = new PhysicalObject(testBox, 1.0f, 0.05f, false); testBox.MyCollider = new BoxCollider(testBox); //Add a box collider to test collisions // loading gameobjects GameObject rat = new GameObject(50, "Rat"); rat.MyTransform = new Transform(rat, new Vector3(0.0f, 0.0f, 10.0f), new Vector3(0.0f, 0.0f, 1.0f), new Vector3(0.0f, 0.0f, 0.0f), 0.01f); CustomModel ratModel = new CustomModel(rat, new Model[] { LoadModel("Models/Enemies/Mutant01"), null, null }, ratMats); rat.Components.Add(ratModel); Animator ratAnimator = new Animator(rat, ratModel.LODs[0]); ratAnimator.AddAnimationClip(LoadAnimationFromModel(ratModel.LODs[0], LoadAnimation("Animations/Enemies/Mutant_attack"), "Rat_TAnim")); ratAnimator.AvailableStates.Add("Walk", new AnimatorState("Walk", ratAnimator.GetAnimationPlayer("Rat_TAnim"), AnimatorState.StateType.SINGLE)); ratAnimator.CurrentState = ratAnimator.AvailableStates["Walk"]; rat.MyAnimator = ratAnimator; rat.Components.Add(new Enemy(rat)); rat.MyCollider = new SphereCollider(rat); rat.MyPhysicalObject = new PhysicalObject(rat); rat.Components.Add(new Food(rat)); GameObject testTer = new GameObject(2, "Terrain"); testTer.MyTransform = new Transform(testTer, new Vector3(0.0f, 0.0f, 0.0f), new Vector3(0.0f, 0.0f, 1.0f), new Vector3(0.0f, 0.0f, 0.0f), 1.0f); CustomModel terModel = new CustomModel(testTer, new Model[] { Models["Models/Test/TestTerrain"], null, null }, testTerMats); terModel.LodControlled = false; testTer.Components.Add(terModel); GameObject testBox2 = new GameObject(3, "StreettestBox2"); testBox2.MyTransform = new Transform(testBox2, new Vector3(0.0f, -0.1f, 112.0f), new Vector3(0.0f, 0.0f, 1.0f), new Vector3(0.0f, 0.0f, 0.0f), 10.0f); testBox2.Components.Add(new CustomModel(testBox2, new Model[] { LoadModel("Models/Enviro/Ground/street_straight"), null, null }, testPlayerMats)); //Billboard billboard = new Billboard(testBox2); //Material bbmat = new Material("billboard", Effects[@"Effects\BillboardEffect"], LoadTexture(@"Textures\Enviro\Nature\Sun")); //billboard.Mat = bbmat; //billboard.Size = new Vector2(1.0f, 1.0f); //testBox2.Components.Add(billboard); testBox2.MyCollider = new BoxCollider(testBox2, false); testBox2.MyPhysicalObject = new PhysicalObject(testBox2, 1.0f, 1.0f, false); //testBox2.Dynamic = true; //testBox2.MyCarrierSocket = new Socket(testBox, testBox2, null, "mixamorig:RightHand"); GameObject testBox3 = new GameObject(5, "testBox3"); testBox3.MyTransform = new Transform(testBox3, new Vector3(0.0f, 0.0f, 0.0f), new Vector3(0.0f, 0.0f, 1.0f), new Vector3(0.0f, 0.0f, 0.0f), 0.7f); testBox3.Components.Add(new CustomModel(testBox3, new Model[] { LoadModel("Models/Weapons/Maczuga/Mace"), null, null }, testPlayerMats)); testBox3.MyCollider = new BoxCollider(testBox3, true); testBox3.Dynamic = true; testBox3.Components.Add(new Gameplay.Weapons.Hammer(testBox3)); GameObject fuckYou = new GameObject(1144, "Fists"); fuckYou.MyTransform = new Transform(fuckYou, Vector3.Zero, Vector3.Up, new Vector3(0.0f, 0.0f, 11.017704f), 1.0f); fuckYou.MyCollider = new BoxCollider(fuckYou, true); fuckYou.Components.Add(new Gameplay.Weapons.Fists(fuckYou)); pc.Equipment.PickUpWeapon(testBox3); //ParticleSystem ps = new ParticleSystem(testBox3); //ps.Textures.Add(ResourceManager.Instance.LoadTexture("Textures/Particles/Particle_metal01")); //ps.Textures.Add(ResourceManager.Instance.LoadTexture("Textures/Particles/Particle_metal02")); //ps.Textures.Add(ResourceManager.Instance.LoadTexture("Textures/Particles/Particle_wood01")); //ps.Textures.Add(ResourceManager.Instance.LoadTexture("Textures/Particles/Particle_wood02")); //ps.Textures.Add(ResourceManager.Instance.LoadTexture("Textures/Particles/Particle_wood03")); //ps.ParticleCount = 170; //ps.ParticleSize = new Vector2(0.5f, 0.5f); //ps.LifespanSec = 5.0f; //ps.Wind = new Vector3(0.0f, 0.1f, 0.0f); //ps.FadeInTime = 0.0f; //ps.Offset = new Vector3(MathHelper.PiOver2); //ps.Speed = 10.0f; ////ps.DelayMs = 5000.0f; //ps.LoopMode = ParticleSystem.ParticleLoopMode.CONTINUOUS; //ps.PositionOffset = new Vector3(0.0f, 0.0f, 0.0f) * testBox3.MyTransform.Scale; //testBox3.Components.Add(ps); GameObject testMirror = new GameObject(6, "testMirror"); testMirror.MyTransform = new Transform(testMirror, new Vector3(-10.0f, 2.0f, -10.0f), new Vector3(0.0f, 0.0f, 1.0f), new Vector3(0.0f, -MathHelper.PiOver2, 0.0f), 0.5f); testMirror.Components.Add(new CustomModel(testMirror, new Model[] { LoadModel("Models/Home/Furnitures/mirror"), null, null }, testMirrorMats)); testMirror.MyCollider = new BoxCollider(testMirror, false); GameObject testWater = new GameObject(7, "tesWtater"); testWater.MyTransform = new Transform(testWater, new Vector3(0.0f, -1.5f, 0.0f), new Vector3(0.0f, 1.0f, 0.0f), new Vector3(0.0f, 0.0f, 0.0f), 10.0f); testWater.Components.Add(new CustomModel(testWater, new Model[] { Models["Models/Test/TestSquarePlane"], null, null }, testWaterMats)); GameObject skyBox = new GameObject(4, "skyBox"); skyBox.MyTransform = new Transform(skyBox, new Vector3(0.0f, 0.0f, 0.0f), new Vector3(0.0f, 1.0f, 0.0f), new Vector3(0.0f, 0.0f, 0.0f), 2000.0f); CustomModel sbModel = new CustomModel(skyBox, new Model[] { Models["Models/Test/TestCube"], null, null }, testSBMats); sbModel.LodControlled = false; skyBox.Components.Add(sbModel); //DaytimeChange dc = new DaytimeChange(skyBox); //dc.LightDayID = 0; //dc.LightNightID = 1; //dc.SunID = 3; //dc.SunriseMinutes = 60 * 6; //dc.SunsetMinutes = 60 * 20; //dc.StateChangeMinutes = 120; //dc.HorizonOffset = 500.0f; //dc.TextureNames = new string[] { @"Textures\Skyboxes\Dawn", @"Textures\Skyboxes\Daylight", @"Textures\Skyboxes\Dusk", @"Textures\Skyboxes\Night" }; //skyBox.Components.Add(dc); // moje na pagi GameObject cegla = new GameObject(14, "cegla"); cegla.MyTransform = new Transform(cegla, new Vector3(5.0f, 0.0f, 0.0f), new Vector3(0.0f, 0.0f, 1.0f), new Vector3(0.0f, 0.0f, 0.0f), 1.0f); //cegla.Components.Add(new CustomModel(cegla, new Model[] { Models["Models/Weapons/Stones/brick"], null, null }, bb)); //cegla.MyCollider = new BoxCollider(cegla); Fortification fort = new Fortification(cegla); fort.CurrentID = 0; fort.MyType = Fortification.FortificationType.WOOD1_WIRE_SNARES; cegla.Components.Add(fort); //GameObject pt = new GameObject(355, "PlayerTime"); //PlayerTime ptc = new PlayerTime(pt); //ptc.Multiplier = 3600; //pt.Components.Add(ptc); //Wika i Kasia testowanie modeli GameObject awsomeTest = new GameObject(8, "testground"); awsomeTest.MyTransform = new Transform(awsomeTest, new Vector3(-12.0f, 1.0f, -5.0f), new Vector3(0.0f, 0.0f, 1.0f), new Vector3(MathHelper.PiOver2, 0.0f, 0.0f), 1.0f); awsomeTest.Components.Add(new CustomModel(awsomeTest, new Model[] { Models["Models/Enviro/Railing/Railing_1"], null, null }, awsomeTestMats)); awsomeTest.MyCollider = new BoxCollider(awsomeTest, false); GameObject playerTime = new GameObject(1000, "PlayerTime"); PlayerTime pt = new PlayerTime(playerTime); pt.InitHours = 20; playerTime.Components.Add(pt); GameObject testTransition = new GameObject(501, "Transition"); AreaTransition at = new AreaTransition(testTransition); at.NextScenePath = "../../../../TrashSoupContent/Scenes/save2.xml"; testTransition.Components.Add(at); testTransition.MyTransform = new Transform(testTransition, new Vector3(-10.0f, 0.0f, 10.0f), Vector3.Up, Vector3.Zero, 5.0f); testTransition.MyCollider = new SphereCollider(testTransition, true); // adding lights LightAmbient amb = new LightAmbient(100, "LightAmbient", new Vector3(0.1f, 0.1f, 0.1f)); LightDirectional ldr = new LightDirectional(101, "LightDirectional1", new Vector3(1.0f, 0.9f, 0.8f), new Vector3(1.0f, 0.8f, 0.8f), new Vector3(-1.0f, -1.0f, -1.0f), true); LightDirectional ldrn = new LightDirectional(102, "LightDirectional2", new Vector3(0.1f, 0.1f, 0.15f), new Vector3(0.0f, 0.1f, 0.2f), new Vector3(1.0f, 1.0f, 1.0f), true); //LightPoint lp1 = new LightPoint(110, "LightPoint1", new Vector3(0.0f, 1.0f, 1.0f), new Vector3(1.0f, 1.0f, 1.0f), 1.0f, false); //lp1.MyTransform = new Transform(lp1, new Vector3(0.0f, 1.0f, 0.0f), new Vector3(0.0f, 1.0f, 0.0f), new Vector3(0.0f, 0.0f, 0.0f), 10.0f); //lp1.MyCollider = new SphereCollider(lp1, true); //lp1.MyPhysicalObject = new PhysicalObject(lp1, 0.0f, 0.0f, false); //lp1.SetupShadowRender(); // loading scene CurrentScene = new Scene(new SceneParams(0, "test", new Vector2(0.0f, 0.1f), new DateTime(2015, 5, 28, 12, 0, 0, 0, new System.Globalization.GregorianCalendar(), DateTimeKind.Unspecified), 60.0f, 3000.0f, 35.0f, 50.0f, true, false, true, false, true)); Camera cam = null; if (TrashSoupGame.Instance.EditorMode) { //Editor camera CurrentScene.EditorCam = new EditorCamera(1, "editorCam", Vector3.Transform(new Vector3(0.0f, 10.0f, -50.0f), Matrix.CreateRotationX(MathHelper.PiOver4 * 1.5f)), new Vector3(0.0f, 5.0f, 5.0f), new Vector3(0.0f, 10.0f, 0.0f), new Vector3(0.0f, 1.0f, 0.0f), MathHelper.Pi / 3.0f, 0.1f, 2000.0f); } //Game camera cam = new Camera(1, "playerCam", Vector3.Transform(new Vector3(0.0f, 1.0f, -0.1f), Matrix.CreateRotationX(MathHelper.PiOver4 * 1.5f)) + new Vector3(0.0f, 0.4f, 0.0f), new Vector3(0.0f, 0.0f, 0.0f), new Vector3(0.0f, 1.5f, 0.0f), new Vector3(0.0f, 1.0f, 0.0f), MathHelper.Pi / 3.0f, (float)TrashSoupGame.Instance.Window.ClientBounds.Width / (float)TrashSoupGame.Instance.Window.ClientBounds.Height, 0.1f, 4000.0f); cam.Components.Add(new CameraBehaviourComponent(cam, testBox)); CurrentScene.Cam = cam; //testTer.LightsAffecting.Add(lp1); // adding items to scene //testBox.AddChild(testBox3); CurrentScene.AddObject(skyBox); CurrentScene.AddObject(testTer); CurrentScene.AddObject(testBox); CurrentScene.AddObject(testBox2); CurrentScene.AddObject(testMirror); CurrentScene.AddObject(testWater); CurrentScene.AddObject(testBox3); CurrentScene.AddObject(awsomeTest);//Wika i kasia CurrentScene.AddObject(rat); CurrentScene.AddObject(cegla); CurrentScene.AddObject(playerTime); CurrentScene.AddObject(testTransition); //CurrentScene.AddObject(pt); CurrentScene.AddObject(fuckYou); CurrentScene.AmbientLight = amb; CurrentScene.DirectionalLights[0] = ldr; CurrentScene.DirectionalLights[1] = ldrn; //CurrentScene.PointLights.Add(lp1); foreach (GameObject go in this.CurrentScene.ObjectsDictionary.Values) { go.Initialize(); } }