// 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); }
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) }) }) })); }
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)); }); }
/// <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; } }