protected override void Update(GameTime gameTime) { if (/*GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed ||*/ Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } base.Update(gameTime); Time.Update(gameTime); Input.Update(); Audio.Update(); SceneManager.Update(); // check for scene change (can remove later) GameManager.Update(); foreach (GameObject go in GameObject.All) { go.Update(); } foreach (GameObject go in GameObject.All) { go.LateUpdate(); } PhysicsDrawer.Instance.Update(gameTime); PhysicsManager.Instance.Update(gameTime); // Instanciating HardwareRendering.Update(); ParticleRendering.Update(); }
// --------------------- BASE METHODS ------------------ /// <summary> /// Initialization of the particle-system /// </summary> public override void Awake() { _smokePlumeParticles = new ParticleSystem3D { Settings = new Settings { TextureName = "vault_smoke", MaxParticles = 1500, ParticlesPerRound = 1, Duration = 3.0f, // Create a wind effect by tilting the gravity vector sideways. Gravity = new Vector3(-5, -2.5f, 0), EndVelocity = 0.75f, MinHorizontalVelocity = 0, MaxHorizontalVelocity = 5, MinVerticalVelocity = 2.5f, MaxVerticalVelocity = 15, MinColor = new Color(0, 0, 0, 255), MaxColor = new Color(128, 128, 128, 128), MinRotateSpeed = -1, MaxRotateSpeed = 1, MinStartSize = 1, MaxStartSize = 2, MinEndSize = 2, MaxEndSize = 5 } }; _smokePlumeParticles.Awake(); ParticleRendering.AddInstance(_smokePlumeParticles, true); }
// --------------------- BASE METHODS ------------------ /// <summary> /// Initialization of the particle-system /// </summary> public override void Awake() { _cashDropParticles = new ParticleSystem3D { Settings = new Settings { TextureName = "base_cash_drop", MaxParticles = 2, ParticlesPerRound = 1, Duration = 5.0f, // Create a wind effect by tilting the gravity vector sideways. Gravity = new Vector3(-0.5f, -0.2f, 0), EndVelocity = 0.75f, MinHorizontalVelocity = 0, MaxHorizontalVelocity = 1.0f, MinVerticalVelocity = 2.5f, MaxVerticalVelocity = 3.0f, MinRotateSpeed = 0, MaxRotateSpeed = 0, MinStartSize = 1, MaxStartSize = 3, MinEndSize = 2, MaxEndSize = 5 } }; _cashDropParticles.Awake(); ParticleRendering.AddInstance(_cashDropParticles); }
protected override void LoadContent() { _spriteBatch = new SpriteBatch(GraphicsDevice); UserInterface.sB = _spriteBatch; Graphics.Start(); HardwareRendering.Start(); ParticleRendering.Start(); //start other big components Input.Start(); //load prefabs and scene Prefabs.Start(); UserInterface.Start(); GameMode.Start(); SceneManager.Start(); SceneManager.LoadScene(loadMenu ? "LevelMenu" : "LevelGame"); Audio.Start(); PostProcessingManager.Instance.Start(_spriteBatch); if (ShowFps) { _font = File.Load <SpriteFont>("Other/font/debug"); } // add skybox //Skybox.Start(); }
// --------------------- BASE METHODS ------------------ /// <summary> /// Initialization of the particle-system /// </summary> public override void Awake() { _cashParticles = new ParticleSystem3D { Settings = new Settings { TextureName = "cash", MaxParticles = 1800, Duration = 8.0f, // Create a wind effect by tilting the gravity vector sideways. Gravity = new Vector3(-1.0f, -5.5f, 0), EndVelocity = 0.75f, MinHorizontalVelocity = 0, MaxHorizontalVelocity = 5, MinVerticalVelocity = 2.5f, MaxVerticalVelocity = 10.0f, MinRotateSpeed = -1, MaxRotateSpeed = 1, MinStartSize = 1.0f, MaxStartSize = 1.01f, MinEndSize = 1.02f, MaxEndSize = 1.03f } }; _cashParticles.Awake(); ParticleRendering.AddInstance(_cashParticles); }
public static void LoadScene(string sceneName, int sceneId = 1) { // Disable the physics-manager when loading the scene to avoid inconsistency between collision-handlings and loading PhysicsManager.Instance.IsActive = false; //GameManager.LvlScene = sceneId; GameObject.ClearAll(); HardwareRendering.Reset(); ParticleRendering.Reset(); currentScene = scenes[sceneName]; Screen.SetupViewportsAndCameras(Graphics.gDM, currentScene.GetNumCameras()); if (currentScene != null) { currentScene.Load(); } StartScene(); // Enable the physics-manager after all is loaded and positioned PhysicsManager.Instance.IsActive = true; }
/// <summary> /// Component is destroyed => Remove particles from drawings /// </summary> public override void Destroy() { ParticleRendering.RemoveInstance(_particleType, this); }
// --------------------- BASE METHODS ------------------ /// <summary> /// Initialization of the particle-system /// </summary> public override void Awake() { ParticleRendering.AddInstance(_particleType, this); }
/// <summary> /// Component is destroyed => Remove particles from drawings /// </summary> public override void Destroy() { ParticleRendering.RemoveInstance(_smokePlumeParticles); }
protected override void Draw(GameTime gameTime) { // render scene for real GraphicsDevice.SetRenderTarget(PostProcessingManager.SceneTarget); GraphicsDevice.Clear(Graphics.SkyBlue); base.Draw(gameTime); _graphics.PreferMultiSampling = true; //-----3D----- GraphicsDevice.DepthStencilState = DepthStencilState.Default; // new DepthStencilState() { DepthBufferEnable = true }; // activates z buffer HardwareRendering.Draw(); ParticleRendering.Draw(); if (PhysicsDrawer.Instance.DoDrawings) { foreach (Camera cam in Screen.Cameras) { GraphicsDevice.Viewport = cam.Viewport; // Allow physics drawing for debug-reasons (display boundingboxes etc..) PhysicsDrawer.Instance.Draw(cam); //gizmos GraphicsDevice.RasterizerState = Screen._wireRasterizer; Gizmos.DrawWire(cam); GraphicsDevice.RasterizerState = Screen._fullRasterizer; Gizmos.DrawFull(cam); } Gizmos.ClearOrders(); } // draw everything 3D to get the depth info _graphics.GraphicsDevice.SetRenderTarget(PostProcessingManager.DepthTarget); _graphics.GraphicsDevice.Clear(Color.Black); HardwareRendering.DrawDepth(); ParticleRendering.DrawDepth(); // apply post processing PostProcessingManager.Instance.Draw(_spriteBatch); // Drop the render target GraphicsDevice.SetRenderTarget(null); //-----2D----- int i = 0; foreach (Camera cam in Screen.Cameras) { GraphicsDevice.Viewport = cam.Viewport; _spriteBatch.Begin(); if (showUI) { foreach (GameObject go in GameObject.All) { go.Draw2D(i); } } _spriteBatch.End(); i++; } GraphicsDevice.Viewport = Screen.FullViewport; if (showUI) { _spriteBatch.Begin(); foreach (GameObject go in GameObject.All) { go.Draw2D(-1); } _spriteBatch.End(); } if (ShowFps) { try { string text = string.Format( "Frames per second: {0}/{1}\n" + "Instances: {2}\n", (1.0f / gameTime.ElapsedGameTime.TotalSeconds).ToString("0.00"), (_frames++ / gameTime.TotalGameTime.TotalSeconds).ToString("0.00"), GameObject.All.Length); _spriteBatch.Begin(); _spriteBatch.DrawString(_font, text, new Vector2(65, 265), Color.Black); _spriteBatch.DrawString(_font, text, new Vector2(64, 264), Color.White); _spriteBatch.End(); } catch { // Do nothing } } }
private static void InitializeParticleSystems() { foreach (Powerup powerup in powerupcomponents) { Color minColor = powerup.powerupColor; minColor.A = 0; Color maxColor = powerup.powerupColor; maxColor.A = 64; ParticleSystem3D rayParticles = new ParticleSystem3D { Settings = new Settings { TextureName = "powerup_ray", MaxParticles = 10000, ParticlesPerRound = 10, Duration = 1.0f, Gravity = new Vector3(0, 0, 0), EndVelocity = 0.75f, MinHorizontalVelocity = 0, MaxHorizontalVelocity = 0, MinVerticalVelocity = 0.5f, MaxVerticalVelocity = 1.0f, MinColor = minColor, MaxColor = maxColor, MinRotateSpeed = 0, MaxRotateSpeed = 0, MinStartSize = 0.1f, MaxStartSize = 0.2f, MinEndSize = 0.2f, MaxEndSize = 0.5f } }; maxColor.A = 128; ParticleSystem3D starParticles = new ParticleSystem3D { Settings = new Settings { TextureName = "powerup_star", MaxParticles = 50, ParticlesPerRound = 1, Duration = 1.0f, Gravity = new Vector3(0, 0, 0), EndVelocity = 0.75f, MinHorizontalVelocity = 0, MaxHorizontalVelocity = 0, MinVerticalVelocity = 0.1f, MaxVerticalVelocity = 0.5f, MinColor = minColor, MaxColor = maxColor, MinRotateSpeed = 0, MaxRotateSpeed = 0, MinStartSize = 0.1f, MaxStartSize = 0.2f, MinEndSize = 0.2f, MaxEndSize = 0.5f } }; ParticleRendering.Initialize(powerup.ParticleRay, rayParticles); ParticleRendering.Initialize(powerup.ParticleStar, starParticles); } }
/// <summary> /// Component is destroyed => Remove particles from drawings /// </summary> public override void Destroy() { ParticleRendering.RemoveInstance(_cashDropParticles); }