コード例 #1
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (ParticleSampleGame game = new ParticleSampleGame())
     {
         game.Run();
     }
 }
コード例 #2
0
ファイル: Program.cs プロジェクト: kjpou1/MonoGame-Samples
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (ParticleSampleGame game = new ParticleSampleGame())
     {
         game.Run();
     }
 }
コード例 #3
0
ファイル: Program.cs プロジェクト: Nailz/MonoGame-Samples
		public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
		{
	
			game = new ParticleSampleGame();
			game.Run ();
	
		}
コード例 #4
0
        /// <summary>
        /// InitializeParticle is overridden to add the appearance of wind.
        /// </summary>
        /// <param name="p">the particle to set up</param>
        /// <param name="where">where the particle should be placed</param>
        protected override void InitializeParticle(Particle p, Vector2 where)
        {
            base.InitializeParticle(p, where);

            // the base is mostly good, but we want to simulate a little bit of wind
            // heading to the right.
            p.Acceleration.X += ParticleSampleGame.RandomBetween(10, 50);
        }
コード例 #5
0
ファイル: Main.cs プロジェクト: noelb/monogame
 public override void FinishedLaunching(UIApplication app)
 {
     // Fun begins..
     using (ParticleSampleGame game = new ParticleSampleGame())
     {
         game.Run();
     }
 }
コード例 #6
0
ファイル: Main.cs プロジェクト: QHebert/monogame
 public override void FinishedLaunching(UIApplication app)
 {
     // Fun begins..
     using (ParticleSampleGame game = new ParticleSampleGame())
     {
         game.Run();
     }
 }
コード例 #7
0
        /// <summary>
        /// PickRandomDirection is overriden so that we can make the particles always
        /// move have an initial velocity pointing up.
        /// </summary>
        /// <returns>a random direction which points basically up.</returns>
        protected override Vector2 PickRandomDirection()
        {
            // Point the particles somewhere between 80 and 100 degrees.
            // tweak this to make the smoke have more or less spread.
            float radians = ParticleSampleGame.RandomBetween(
                MathHelper.ToRadians(80), MathHelper.ToRadians(100));

            Vector2 direction = Vector2.Zero;

            // from the unit circle, cosine is the x coordinate and sine is the
            // y coordinate. We're negating y because on the screen increasing y moves
            // down the monitor.
            direction.X = (float)Math.Cos(radians);
            direction.Y = -(float)Math.Sin(radians);
            return(direction);
        }
コード例 #8
0
ファイル: Particle.cs プロジェクト: nusisschad/XNAGameStudio
        // initialize is called by ParticleSystem to set up the particle, and prepares
        // the particle for use.
        public void Initialize(Vector2 position, Vector2 velocity, Vector2 acceleration,
                               float lifetime, float scale, float rotationSpeed)
        {
            // set the values to the requested values
            this.Position      = position;
            this.Velocity      = velocity;
            this.Acceleration  = acceleration;
            this.Lifetime      = lifetime;
            this.Scale         = scale;
            this.RotationSpeed = rotationSpeed;

            // reset TimeSinceStart - we have to do this because particles will be
            // reused.
            this.TimeSinceStart = 0.0f;

            // set rotation to some random value between 0 and 360 degrees.
            this.Rotation = ParticleSampleGame.RandomBetween(0, MathHelper.TwoPi);
        }
コード例 #9
0
        /// <summary>
        /// InitializeParticle randomizes some properties for a particle, then
        /// calls initialize on it. It can be overriden by subclasses if they
        /// want to modify the way particles are created. For example,
        /// SmokePlumeParticleSystem overrides this function make all particles
        /// accelerate to the right, simulating wind.
        /// </summary>
        /// <param name="p">the particle to initialize</param>
        /// <param name="where">the position on the screen that the particle should be
        /// </param>
        protected virtual void InitializeParticle(Particle p, Vector2 where)
        {
            // first, call PickRandomDirection to figure out which way the particle
            // will be moving. velocity and acceleration's values will come from this.
            Vector2 direction = PickRandomDirection();

            // pick some random values for our particle
            float velocity =
                ParticleSampleGame.RandomBetween(minInitialSpeed, maxInitialSpeed);
            float acceleration =
                ParticleSampleGame.RandomBetween(minAcceleration, maxAcceleration);
            float lifetime =
                ParticleSampleGame.RandomBetween(minLifetime, maxLifetime);
            float scale =
                ParticleSampleGame.RandomBetween(minScale, maxScale);
            float rotationSpeed =
                ParticleSampleGame.RandomBetween(minRotationSpeed, maxRotationSpeed);

            // then initialize it with those random values. initialize will save those,
            // and make sure it is marked as active.
            p.Initialize(
                where, velocity * direction, acceleration * direction,
                lifetime, scale, rotationSpeed);
        }
コード例 #10
0
 public override void FinishedLaunching(MonoMac.Foundation.NSObject notification)
 {
     game = new ParticleSampleGame();
     game.Run();
 }
コード例 #11
0
 /// <summary>
 /// Constructs a new ParticleSystem.
 /// </summary>
 /// <param name="game">The host for this particle system. The game keeps the 
 /// content manager and sprite batch for us.</param>
 /// <param name="howManyEffects">the maximum number of particle effects that
 /// are expected on screen at once.</param>
 /// <remarks>it is tempting to set the value of howManyEffects very high.
 /// However, this value should be set to the minimum possible, because
 /// it has a large impact on the amount of memory required, and slows down the
 /// Update and Draw functions.</remarks>
 protected ParticleSystem(ParticleSampleGame game, int howManyEffects)
     : base(game)
 {            
     this.game = game;
     this.howManyEffects = howManyEffects;
 }
コード例 #12
0
 /// <summary>
 /// Constructs a new ParticleSystem.
 /// </summary>
 /// <param name="game">The host for this particle system. The game keeps the
 /// content manager and sprite batch for us.</param>
 /// <param name="howManyEffects">the maximum number of particle effects that
 /// are expected on screen at once.</param>
 /// <remarks>it is tempting to set the value of howManyEffects very high.
 /// However, this value should be set to the minimum possible, because
 /// it has a large impact on the amount of memory required, and slows down the
 /// Update and Draw functions.</remarks>
 protected ParticleSystem(ParticleSampleGame game, int howManyEffects)
     : base(game)
 {
     this.game           = game;
     this.howManyEffects = howManyEffects;
 }
コード例 #13
0
 public ExplosionSmokeParticleSystem(ParticleSampleGame game, int howManyEffects)
     : base(game, howManyEffects)
 {
 }
コード例 #14
0
 public SmokePlumeParticleSystem(ParticleSampleGame game, int howManyEffects)
     : base(game, howManyEffects)
 {
 }
コード例 #15
0
 public ExplosionSmokeParticleSystem(ParticleSampleGame game, int howManyEffects)
     : base(game, howManyEffects)
 {
 }
コード例 #16
0
 private static void Main()
 {
     using (var game = new ParticleSampleGame())
         game.Run();
 }
コード例 #17
0
        /// <summary>
        /// PickRandomDirection is used by InitializeParticles to decide which direction
        /// particles will move. The default implementation is a random vector in a
        /// circular pattern.
        /// </summary>
        protected virtual Vector2 PickRandomDirection()
        {
            float angle = ParticleSampleGame.RandomBetween(0, MathHelper.TwoPi);

            return(new Vector2((float)Math.Cos(angle), (float)Math.Sin(angle)));
        }
コード例 #18
0
ファイル: Program.cs プロジェクト: yankost/MonoGame-Samples

        
コード例 #19
0
 public SmokePlumeParticleSystem(ParticleSampleGame game, int howManyEffects)
     : base(game,howManyEffects)
 {
 }