コード例 #1
0
        public void Update(GameTime gameTime)
        {
            Game1 g1 = (Game1)game;

            if (displaying || g1.Gesture == ManipMode.GRAB || g1.Gesture == ManipMode.SELECTGRAB)
            {
                nextSparkle -= (float)gameTime.ElapsedGameTime.TotalSeconds;
                if (nextSparkle < 0)
                {
                    sparkleSystem.DefaultColor = g1.Gesture != ManipMode.GRAB ? Color.Lime : grabColours[sparkleRandom.Next(0, grabColours.Length)];
                    var ranX = (float)(sparkleRandom.NextDouble() * 0.5 - 0.25);
                    sparkleSystem.AddInstance(((Game1)game).CursorPos, new Vector2(ranX, ranX + 1) * 20);
                    nextSparkle = (float)sparkleRandom.NextDouble() * sparkleIntv;
                }
            }
            sparkleSystem.Update(gameTime);

            if ((g1.Gesture == ManipMode.SELECT || g1.Gesture == ManipMode.SELECTGRAB) && lastGesture == ManipMode.NONE)
            {
                sparkleSystem.DefaultColor = Color.White;
                int pCount = sparkleRandom.Next(20, 50);
                for (int i = 0; i < pCount; i++)
                {
                    var ranX = (float)(sparkleRandom.NextDouble() * 0.5 - 0.25);
                    sparkleSystem.AddInstance(((Game1)game).CursorPos, 50);
                }
            }

            lastGesture = g1.Gesture;
        }