Пример #1
0
        void DetonateMissile(SKNode missile)
        {
            SKEmitterNode explosion = new ExplosionNode(this);

            explosion.Position = missile.Position;
            AddChild(explosion);
            missile.RemoveFromParent();
        }
Пример #2
0
        void Explode()
        {
            for (int i = 0; i < numberOfChunks; i++)
            {
                float angle    = myRand(0, (float)Math.PI * 2);
                float speed    = myRand(shipChunkMinimumSpeed, shipChunkMaximumSpeed);
                var   position = new CGPoint(myRand((float)Position.X - shipChunkDispersion, (float)Position.Y + shipChunkDispersion),
                                             (nfloat)myRand((float)Position.Y - shipChunkDispersion, (float)Position.Y + shipChunkDispersion));
                var explosion = new ExplosionNode(Scene, position);
                var body      = SKPhysicsBody.CreateCircularBody(0.25f);
                body.CollisionBitMask   = 0;
                body.ContactTestBitMask = 0;
                body.CategoryBitMask    = 0;
                body.Velocity           = new CGVector((float)Math.Cos(angle) * speed, (float)Math.Sin(angle) * speed);
                explosion.PhysicsBody   = body;
                Scene.AddChild(explosion);
            }

            RunAction(SKAction.Sequence(
                          SKAction.WaitForDuration(removeShipTime),
                          SKAction.RemoveFromParent()
                          ));
        }
Пример #3
0
        void Explode()
        {
            for (int i = 0; i < numberOfChunks; i++) {
                float angle = myRand (0, (float) Math.PI * 2);
                float speed = myRand (shipChunkMinimumSpeed, shipChunkMaximumSpeed);
                var position = new PointF (myRand (Position.X - shipChunkDispersion, Position.Y + shipChunkDispersion),
                                           myRand (Position.Y - shipChunkDispersion, Position.Y + shipChunkDispersion));
                var explosion = new ExplosionNode (Scene, position);
                var body = SKPhysicsBody.BodyWithCircleOfRadius (0.25f);
                body.CollisionBitMask = 0;
                body.ContactTestBitMask = 0;
                body.CategoryBitMask = 0;
                body.Velocity = new CGVector ((float) Math.Cos (angle) * speed, (float) Math.Sin (angle) * speed);
                explosion.PhysicsBody = body;
                Scene.AddChild (explosion);
            }

            RunAction (SKAction.Sequence (
                SKAction.WaitForDuration (removeShipTime),
                SKAction.RemoveFromParent ()
            ));
        }
Пример #4
0
 void DetonateMissile(SKNode missile)
 {
     SKEmitterNode explosion = new ExplosionNode (this);
     explosion.Position = missile.Position;
     AddChild (explosion);
     missile.RemoveFromParent ();
 }