public void CreateTextParticle() { InputSimulator simulator = new InputSimulator(); int index = 0; foreach (WindowsInput.Native.VirtualKeyCode key in Enum.GetValues(typeof(WindowsInput.Native.VirtualKeyCode))) { if (simulator.InputDeviceState.IsHardwareKeyDown(key) && !states[index]) { Nova_Particle p = new Nova_Particle(); string keyName = Enum.GetName(typeof(WindowsInput.Native.VirtualKeyCode), key); p.SetTextureFont(Nova_DataBase.GetFont("font"), keyName.Contains("_") ? keyName.Split('_')[1] : keyName, SpriteEffects.None, Microsoft.Xna.Framework.Color.White); p.Position = new Vector2(-Nova_DataBase.GetFont("font").MeasureString(keyName).X / 2, GraphicsDevice.Viewport.Height / 4); // p.SetDirectionRotation(Nova_Functions.GetRandomNumber(-5, 5), Nova_Functions.GetRandomNumber(-5, 5), 0, 0, 0, 0, Nova_Functions.GetRandomNumber(1, 5), Nova_Functions.GetRandomNumber(-1, 5), false); p.LifeTime = 7600; p.SetFadeOut(7600); p.SetInflateSpeed(1, 20, 1, 20, Nova_Particle.GrowingTypeEnum.asc); p.IsAllColorsUntilDie = true; p.InitialLifeTime = 7600; p.SetDirectionSpeed(new Vector2(6, 0)); emitersText.Add(p); } states[index] = simulator.InputDeviceState.IsHardwareKeyDown(key); index++; } }
protected override void Update(GameTime gameTime) { base.Update(gameTime); Controls(); ControlOpacity(gameTime); foreach (Nova_Particle p in particles) { p.Update(gameTime, Matrix.CreateTranslation(0, 0, 0)); } if (!isShow) { Nova_Particle p = new Nova_Particle(); p.SetTexture(Nova_DataBase.GetTexture("bar"), SpriteEffects.None, Microsoft.Xna.Framework.Color.Blue); p.Position = new Vector2(0, 75); p.LifeTime = 1500; p.InitialLifeTime = 1500; p.SetFadeOut(1500); p.IsAllColorsUntilDie = true; p.SetDirectionSpeed(new Vector2(20, 0)); p.inflateSizeHeight = (int)(sumPower * 3); p.SetInternalRotation(0, 1, Nova_Functions.GetCenterOf(p.GetCurrentTexture()), Nova_Particle.RotationDirectionEnum.clockwise); p.inflateSizeWidth = 10; emiters.Add(p); Nova_Particle.DoUpdateParticles(emiters, gameTime, Matrix.CreateTranslation(0, 0, 0)); } UpdatePlayer(); }
private void CreateStep(int posNumber) { Nova_Particle p = new Nova_Particle(); p.SetTexture((List<Texture2D>)Nova_DataBase.GetResource("NOTE_" + (posNumber+1).ToString()), SpriteEffects.None, Color.White); p.SetPosition(new Vector2(posNumber * stepSpace + Nova_Functions.View.Width / 2 - ((numberOfSteps * stepSpace) / 2), -p.texture[0].Height)); p.SetAnimation(4, 1, 120, true); p.SetID(posNumber.ToString()); p.SetDirectionSpeed(new Vector2(0, stepSpeed)); notes.Add(p); }