コード例 #1
0
ファイル: Lock.cs プロジェクト: fordream/Locks
        private void OnLockDialExplosionTimedEvent(object source, ElapsedEventArgs e)
        {
            // Velocity and acceleration
            Vector2 minVelocity = new Vector2 (10f, 10f);
            Vector2 maxVelocity = new Vector2 (15f, 15f);
            Vector2 velocity = Randomization.NextVector2 (minVelocity, maxVelocity);
            velocity.X = velocity.X * Randomization.NextFloatSign ();
            velocity.Y = velocity.Y * Randomization.NextFloatSign ();
            Dial.Velocity = velocity;
            Dial.Acceleration = new Vector2 (0, 0.2f);

            // Rotation
            float finalRotationRadians = Randomization.NextFloat (Dial.RotationRadians + MathHelper.TwoPi, Dial.RotationRadians + (MathHelper.TwoPi * 4));
            Rotate rotateDial = new Rotate (Dial.RotationRadians, finalRotationRadians, 4000d);
            Dial.StartEffect (rotateDial);

            // Explosion
            CreateRandomLockDialExplosion ();
        }
コード例 #2
0
ファイル: Lock.cs プロジェクト: fordream/Locks
 public void RotateDial(int positions)
 {
     float initialRadians = Dial.RotationRadians;
     float finalRadians = Dial.RotationRadians + PositionsToRadians (positions);
     Sunfish.Views.Effects.Rotate rotateEffect = new Sunfish.Views.Effects.Rotate (initialRadians, finalRadians, 300);
     rotateEffect.OnComplete = HandleRotateDialComplete;
     Dial.StartEffect (rotateEffect);
 }