Esempio n. 1
0
 public Sprite(Texture2D texture, Vector2 position, Constants.ViewLayer layer, SpriteFraming framing)
     : base(position, framing.FrameRectangle.Width, framing.FrameRectangle.Height, layer, true)
 {
     Texture = texture;
     Framing = framing;
     Framing.SpriteForFraming = this;
 }
Esempio n. 2
0
        private void CreateRandomExplosion(View viewThatWasTapped)
        {
            int explosionNumber = Randomization.NextInt (1, 4);

            Rectangle frameRectangle = Rectangle.Empty;
            SpriteFraming framing = null;

            switch (explosionNumber) {
            case 1:
                frameRectangle = new Rectangle (0, 0, 134, 134);
                framing = new SpriteFraming (frameRectangle, 12, 25d);
                break;
            case 2:
                frameRectangle = new Rectangle (0, 0, 128, 128);
                framing = new SpriteFraming (frameRectangle, 10, 25d);
                break;
            case 3:
                frameRectangle = new Rectangle (0, 0, 120, 120);
                framing = new SpriteFraming (frameRectangle, 10, 25d);
                break;
            }

            framing.Loops = 1;
            framing.LoopingFinishedBehavior = Constants.SpriteFramingLoopingFinishedBehavior.HideSprite;

            Texture2D explosionTexture = LoadTexture ("Explosion" + explosionNumber.ToString());
            Sprite explosion = new Sprite (explosionTexture, framing);
            explosion.Position = GetRandomExplosionPosition ();

            AddChildView (explosion);

            if (Randomization.NextBool ()) {
                PlaySoundEffect ("Explosion1");
            } else {
                PlaySoundEffect ("Explosion2");
            }
        }
Esempio n. 3
0
        private void CreateRandomLockDialExplosion()
        {
            int explosionNumber = Randomization.NextInt (1, 4);

            Rectangle frameRectangle = Rectangle.Empty;
            SpriteFraming framing = null;

            switch (explosionNumber) {
            case 1:
                frameRectangle = new Rectangle (0, 0, PixelsWithDensity(96), PixelsWithDensity(96));
                framing = new SpriteFraming (frameRectangle, 12, 25d);
                break;
            case 2:
                frameRectangle = new Rectangle (0, 0, PixelsWithDensity(96), PixelsWithDensity(96));
                framing = new SpriteFraming (frameRectangle, 10, 25d);
                break;
            case 3:
                frameRectangle = new Rectangle (0, 0, PixelsWithDensity(96), PixelsWithDensity(96));
                framing = new SpriteFraming (frameRectangle, 10, 25d);
                break;
            }

            framing.Loops = 1;
            framing.LoopingFinishedBehavior = Constants.SpriteFramingLoopingFinishedBehavior.HideSprite;

            Texture2D explosionTexture = SunfishGame.ActiveScreen.LoadTexture ("LockDialExplosion" + explosionNumber.ToString());
            Sprite explosion = new Sprite (explosionTexture, Constants.ViewLayer.Layer6, framing);
            explosion.Position = Randomization.NextVector2Perturbed (Dial.Position, new Vector2 (5, 5));

            SunfishGame.ActiveScreen.AddChildView (explosion);

            if (Randomization.NextBool ()) {
            SunfishGame.ActiveScreen.PlaySoundEffect ("LockDialExplosion1", 0.3f);
            } else {
            SunfishGame.ActiveScreen.PlaySoundEffect ("LockDialExplosion2", 0.3f);
            }
        }
Esempio n. 4
0
 public Sprite(Texture2D texture, Constants.ViewLayer layer, SpriteFraming framing)
     : this(texture, new Vector2(0,0), layer, framing)
 {
 }
Esempio n. 5
0
 public Sprite(Texture2D texture, Vector2 position, SpriteFraming framing)
     : this(texture, position, Constants.ViewLayer.Layer1, framing)
 {
 }