Esempio n. 1
0
        void ShowEndScreen()
        {
            gameIsComplete = true;

            // Add confettis
            SCNMatrix4 particlePosition = SCNMatrix4.CreateTranslation(0f, 8f, 0f);

            GameView.Scene.AddParticleSystem(confetti, particlePosition);

            // Congratulation title
            SKSpriteNode congrat = SKSpriteNode.FromImageNamed("Images/congratulations.png");

            congrat.Position = new CGPoint(GameView.Bounds.Width / 2, GameView.Bounds.Height / 2);
            SKScene overlay = GameView.OverlayScene;

            congrat.XScale = congrat.YScale = 0;
            congrat.Alpha  = 0;
            congrat.RunAction(SKAction.Group(new [] {
                SKAction.FadeInWithDuration(0.25),
                SKAction.Sequence(new [] {
                    SKAction.ScaleTo(.55f, 0.25),
                    SKAction.ScaleTo(.3f, 0.1),
                })
            }));

            // Panda Image
            SKSpriteNode congratPanda = SKSpriteNode.FromImageNamed("Images/congratulations_pandaMax.png");

            congratPanda.Position    = new CGPoint(GameView.Bounds.Width / 2f, GameView.Bounds.Height / 2f - 90f);
            congratPanda.AnchorPoint = new CGPoint(.5f, 0f);
            congratPanda.XScale      = congratPanda.YScale = 0f;
            congratPanda.Alpha       = 0;

            congratPanda.RunAction(SKAction.Sequence(new [] {
                SKAction.WaitForDuration(.5f),
                SKAction.Sequence(new [] {
                    SKAction.ScaleTo(.5f, 0.25),
                    SKAction.ScaleTo(.4f, 0.1)
                })
            }));

            overlay.AddChild(congratPanda);
            overlay.AddChild(congrat);

            // Stop music
            GameView.Scene.RootNode.RemoveAllAudioPlayers();

            // Play the congrat sound.
            GameView.Scene.RootNode.AddAudioPlayer(SCNAudioPlayer.FromSource(victoryMusic));

            // Animate the camera forever
            DispatchQueue.MainQueue.DispatchAfter(new DispatchTime(DispatchTime.Now, 1 * NanoSecondsPerSeond), () => {
                cameraYHandle.RunAction(SCNAction.RepeatActionForever(SCNAction.RotateBy(0f, -1f, 0f, 3.0)));
                cameraXHandle.RunAction(SCNAction.RotateTo(-(float)Math.PI / 4f, 0f, 0f, 5.0));
            });
        }
Esempio n. 2
0
        void SetupMusic()
        {
            // Get an arbitrary node to attach the sounds to.
            SCNNode        node   = GameView.Scene.RootNode;
            SCNAudioSource source = SCNAudioSource.FromFile("game.scnassets/sounds/music.m4a");

            source.Loops        = true;
            source.Volume       = 0.25f;
            source.ShouldStream = true;
            source.Positional   = false;

            SCNAudioPlayer player = SCNAudioPlayer.FromSource(source);

            node.AddAudioPlayer(player);
        }
Esempio n. 3
0
        void SetupSounds()
        {
            // Get an arbitrary node to attach the sounds to
            SCNNode node = GameView.Scene.RootNode;
            // The wind sound
            SCNAudioSource source = SCNAudioSource.FromFile("game.scnassets/sounds/wind.m4a");

            source.Volume = .3f;
            SCNAudioPlayer player = SCNAudioPlayer.FromSource(source);

            source.Loops        = true;
            source.ShouldStream = true;
            source.Positional   = false;
            node.AddAudioPlayer(player);

            // fire
            source            = SCNAudioSource.FromFile("game.scnassets/sounds/flamethrower.mp3");
            source.Loops      = true;
            source.Volume     = 0;
            source.Positional = false;
            flameThrowerSound = SCNAudioPlayer.FromSource(source);
            node.AddAudioPlayer(flameThrowerSound);

            // hit
            hitSound        = SCNAudioSource.FromFile("game.scnassets/sounds/ouch_firehit.mp3");
            hitSound.Volume = 2f;
            hitSound.Load();

            pshhhSound        = SCNAudioSource.FromFile("game.scnassets/sounds/fire_extinction.mp3");
            pshhhSound.Volume = 2f;
            pshhhSound.Load();

            aahSound        = SCNAudioSource.FromFile("game.scnassets/sounds/aah_extinction.mp3");
            aahSound.Volume = 2f;
            aahSound.Load();

            // collectable
            collectPearlSound        = SCNAudioSource.FromFile("game.scnassets/sounds/collect1.mp3");
            collectPearlSound.Volume = 0.5f;
            collectPearlSound.Load();

            collectFlowerSound = SCNAudioSource.FromFile("game.scnassets/sounds/collect1.mp3");
            collectFlowerSound.Load();

            // victory
            victoryMusic        = SCNAudioSource.FromFile("game.scnassets/sounds/Music_victory.mp3");
            victoryMusic.Volume = 0.5f;
        }
		void SetupSounds ()
		{
			// Get an arbitrary node to attach the sounds to
			SCNNode node = GameView.Scene.RootNode;
			// The wind sound
			SCNAudioSource source = SCNAudioSource.FromFile ("game.scnassets/sounds/wind.m4a");
			source.Volume = .3f;
			SCNAudioPlayer player = SCNAudioPlayer.FromSource (source);
			source.Loops = true;
			source.ShouldStream = true;
			source.Positional = false;
			node.AddAudioPlayer (player);

			// fire
			source = SCNAudioSource.FromFile ("game.scnassets/sounds/flamethrower.mp3");
			source.Loops = true;
			source.Volume = 0;
			source.Positional = false;
			flameThrowerSound = SCNAudioPlayer.FromSource (source);
			node.AddAudioPlayer (flameThrowerSound);

			// hit
			hitSound = SCNAudioSource.FromFile ("game.scnassets/sounds/ouch_firehit.mp3");
			hitSound.Volume = 2f;
			hitSound.Load ();

			pshhhSound = SCNAudioSource.FromFile ("game.scnassets/sounds/fire_extinction.mp3");
			pshhhSound.Volume = 2f;
			pshhhSound.Load ();

			aahSound = SCNAudioSource.FromFile ("game.scnassets/sounds/aah_extinction.mp3");
			aahSound.Volume = 2f;
			aahSound.Load ();

			// collectable
			collectPearlSound = SCNAudioSource.FromFile ("game.scnassets/sounds/collect1.mp3");
			collectPearlSound.Volume = 0.5f;
			collectPearlSound.Load ();

			collectFlowerSound = SCNAudioSource.FromFile ("game.scnassets/sounds/collect1.mp3");
			collectFlowerSound.Load ();

			// victory
			victoryMusic = SCNAudioSource.FromFile ("game.scnassets/sounds/Music_victory.mp3");
			victoryMusic.Volume = 0.5f;
		}