示例#1
0
        public void ShowEndScreen()
        {
            // Congratulation title
            var congratulationsNode = SKSpriteNode.FromImageNamed("Overlays/congratulations.png");

            // Max image
            var characterNode = SKSpriteNode.FromImageNamed("Overlays/congratulations_pandaMax.png");

            characterNode.Position    = new CGPoint(0f, -220f);
            characterNode.AnchorPoint = new CGPoint(0.5f, 0f);

            this.congratulationsGroupNode = new SKNode();
            this.congratulationsGroupNode.AddChild(characterNode);
            this.congratulationsGroupNode.AddChild(congratulationsNode);
            this.AddChild(this.congratulationsGroupNode);

            // Layout the overlay
            this.Layout2DOverlay();

            // Animate
            congratulationsNode.Alpha  = 0f;
            congratulationsNode.XScale = 0f;
            congratulationsNode.YScale = 0f;
            congratulationsNode.RunAction(SKAction.Group(new SKAction[] { SKAction.FadeInWithDuration(0.25),
                                                                          SKAction.Sequence(new SKAction[] { SKAction.ScaleTo(1.22f, 0.25),
                                                                                                             SKAction.ScaleTo(1f, 0.1) }) }));

            characterNode.Alpha  = 0f;
            characterNode.XScale = 0f;
            characterNode.YScale = 0f;
            characterNode.RunAction(SKAction.Sequence(new SKAction[] { SKAction.WaitForDuration(0.5),
                                                                       SKAction.Group(new SKAction[] { SKAction.FadeInWithDuration(0.5),
                                                                                                       SKAction.Sequence(new SKAction[] { SKAction.ScaleTo(1.22f, 0.25),
                                                                                                                                          SKAction.ScaleTo(1f, 0.1) }) }) }));
        }
        // Show the congratulation screen.
        void ShowCongratulation()
        {
            var gNodes = gameNodes.Value;

            gNodes.Camera.UsesOrthographicProjection = false;

            sceneInterface.Scene.Background.Contents = UIColor.Black;

            gNodes.Confetti.Hidden = false;
            particleRemovalTimer?.Invalidate();
            particleRemovalTimer = NSTimer.CreateScheduledTimer(30, RemoveParticles);

            gNodes.CongratulationsLabel.RemoveFromParent();
            gNodes.CongratulationsLabel.Position = new CGPoint(ContentFrame.Width / 2, ContentFrame.Height / 2);
            gNodes.CongratulationsLabel.XScale   = 0;
            gNodes.CongratulationsLabel.YScale   = 0;
            gNodes.CongratulationsLabel.Alpha    = 0;

            gNodes.CongratulationsLabel.RunAction(SKAction.Group(new SKAction [] {
                SKAction.FadeInWithDuration(0.25),
                SKAction.Sequence(new SKAction [] {
                    SKAction.ScaleTo(0.7f, 0.25),
                    SKAction.ScaleTo(0.8f, 0.2)
                })
            }));

            sceneInterface.OverlayScene.AddChild(gNodes.CongratulationsLabel);
        }
        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));
            });
        }
示例#4
0
        private void Show()
        {
            foreach (var button in this.cameraButtons)
            {
                button.Alpha = 0.0f;
                button.RunAction(SKAction.FadeInWithDuration(Duration));
            }

            this.isMenuHidden = false;
        }
        public void FadeIn(float duration)
        {
            // Fade in the main sprite and blob shadow.
            SKAction fadeAction = SKAction.FadeInWithDuration(duration);

            Alpha = 0;
            RunAction(fadeAction);

            ShadowBlob.Alpha = 0;
            ShadowBlob.RunAction(fadeAction);
        }
示例#6
0
        private void ShowSlidersMenu()
        {
            foreach (var slider in this.dofSliders)
            {
                slider.RunAction(SKAction.FadeInWithDuration(Duration));
            }

            this.dofSliders[0].Value = 0.1f;
            this.dofSliders[1].Value = 0.5f;

            this.CameraFStopChanged(this.dofSliders[0]);
            this.CameraFocusDistanceChanged(this.dofSliders[1]);
        }
示例#7
0
 private void SetOverlaysHidden(bool shouldHide)
 {
     foreach (var node in this.sceneView.Scene)
     {
         if (shouldHide)
         {
             // Hide overlay content immediately during relocalization.
             node.Alpha = 0f;
         }
         else
         {
             // Fade overlay content in after relocalization succeeds.
             node.RunAction(SKAction.FadeInWithDuration(0.5d));
         }
     }
 }
        public void ShowLabel(string label)
        {
            if (Label == null)
            {
                Label = SKLabelNode.FromFont("Myriad Set");
                if (Label == null)
                {
                    Label = SKLabelNode.FromFont("Avenir-Heavy");
                }
                Label.FontSize = 140;
                Label.Position = new CGPoint(0, 0);

                AddChild(Label);
            }
            else
            {
                if (label != null)
                {
                    Label.Position = new CGPoint(0, Size.Height * 0.25f);
                }
            }

            if (label == null)
            {
                Label.RunAction(SKAction.FadeOutWithDuration(0.5));
            }
            else
            {
                                #if __IOS__
                if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone)
                {
                    Label.FontSize = label.Length > 10 ? 50 : 80;
                }
                else
                                #endif
                Label.FontSize = label.Length > 10 ? 100 : 140;

                Label.Text  = label;
                Label.Alpha = 0.0f;
                Label.RunAction(SKAction.Sequence(new [] {
                    SKAction.WaitForDuration(0.5),
                    SKAction.FadeInWithDuration(0.5)
                }));
            }
        }
示例#9
0
        /// <summary>
        /// Добававляем его спрайт на нод для камешка, с расчетом размера и позиции
        /// </summary>
        /// <param name="gem">Камешек которому добавляется спрайт.</param>
        private void AttachSpriteTo(Gem gem)
        {
            SKSpriteNode sprite;

            // Если разрушитель - открепляем старый спрайт на этом месте от слоя камешков
            if ((gem.IsALineDestroyer || gem.IsABomb) && Level.GemArray[gem.Row, gem.Column] != null)
            {
                sprite = Level.GemArray[gem.Row, gem.Column].Sprite;

                if (sprite != null && sprite.Parent != null)
                {
                    sprite.RemoveFromParent();
                }
            }

            // подготовка спрайта
            sprite          = SKSpriteNode.FromImageNamed(gem.GetSpriteName());
            sprite.Size     = new CGSize(gemCellWidth, gemCellHeight);
            sprite.Position = GetPositionFromRowAndColumn(gem.Row, gem.Column);
            gemLayer.AddChild(sprite);

            gem.Sprite = sprite;

            // подготовка к анимации
            sprite.Alpha  = 0;
            sprite.XScale = 0.5f;
            sprite.YScale = 0.5f;

            // Анимация появления камешка
            sprite.RunAction(
                SKAction.Sequence(
                    SKAction.WaitForDuration(0.25, 0.5),
                    SKAction.Group(
                        SKAction.FadeInWithDuration(0.25),
                        SKAction.ScaleTo(1.0f, 0.25)
                        )
                    ));

            // если разрушитель - заменяем в массиве камешек
            if (gem.IsALineDestroyer || gem.IsABomb)
            {
                Level.GemArray[gem.Row, gem.Column] = gem;
            }
        }