public void FireProjectile() { var projectile = (SKSpriteNode)Projectile.Copy(); projectile.Position = Position; projectile.ZRotation = ZRotation; var emitter = (SKEmitterNode)ProjectileEmitter.Copy(); emitter.TargetNode = CharacterScene.GetChildNode("world"); projectile.AddChild(emitter); CharacterScene.AddNode(projectile, WorldLayer.Character); var rot = ZRotation; float x = -(float)Math.Sin(rot) * HeroProjectileSpeed * HeroProjectileLifetime; float y = (float)Math.Cos(rot) * HeroProjectileSpeed * HeroProjectileLifetime; projectile.RunAction(SKAction.MoveBy(x, y, HeroProjectileLifetime)); projectile.RunAction(SKAction.Sequence(new [] { SKAction.WaitForDuration(HeroProjectileFadeOutTime), SKAction.FadeOutWithDuration(HeroProjectileLifetime - HeroProjectileFadeOutTime), SKAction.RemoveFromParent() })); projectile.RunAction(ProjectileSoundAction); var userData = new UserData { Player = Player }; projectile.UserData = (NSMutableDictionary)userData.Dictionary; }
// Remove the Info Text (fade out) private void ReleaseInfoText() { SKAction actionOut = SKAction.FadeOutWithDuration(0.2); infoLabel1.RemoveAllActions(); infoLabel2.RemoveAllActions(); infoLabel3.RemoveAllActions(); infoLabel4.RemoveAllActions(); infoLabel5.RemoveAllActions(); infoLabel6.RemoveAllActions(); infoLabel7.RemoveAllActions(); infoNode.RemoveAllActions(); infoNode2.RemoveAllActions(); infoNode3.RemoveAllActions(); cancelSpark.RemoveAllActions(); teatimeSprite.RemoveAllActions(); infoLabel1.RunAction(actionOut); infoLabel2.RunAction(actionOut); infoLabel3.RunAction(actionOut); infoLabel4.RunAction(actionOut); infoLabel5.RunAction(actionOut); infoLabel6.RunAction(actionOut); infoLabel7.RunAction(actionOut); infoNode.RunAction(actionOut); infoNode2.RunAction(actionOut); infoNode3.RunAction(actionOut); cancelSpark.RunAction(actionOut); teatimeSprite.RunAction(actionOut); }
private void HideSlidersMenu() { foreach (var slider in this.dofSliders) { slider.RunAction(SKAction.FadeOutWithDuration(Duration)); } }
private void Hide() { foreach (var button in this.cameraButtons) { button.Alpha = 1.0f; button.RunAction(SKAction.FadeOutWithDuration(Duration)); } this.HideSlidersMenu(); this.isMenuHidden = true; }
void AnimationHasCompleted(AnimationState animationState) { if (Dying) { Animated = false; ShadowBlob.RunAction(SKAction.FadeOutWithDuration(1.5f)); } AnimationDidComplete(animationState); if (Attacking) { Attacking = false; } ActiveAnimationKey = null; }
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) })); } }
public override void PerformDeath() { RemoveAllActions(); SKSpriteNode splort = (SKSpriteNode)deathSplort.Copy(); splort.ZPosition = -1; splort.ZRotation = (float)(Random.NextDouble() * Math.PI); splort.Position = Position; splort.Alpha = 0.5f; CharacterScene.AddNode(splort, WorldLayer.Ground); splort.RunAction(SKAction.FadeOutWithDuration(10)); base.PerformDeath(); PhysicsBody.CollisionBitMask = 0; PhysicsBody.ContactTestBitMask = 0; PhysicsBody.CategoryBitMask = 0; PhysicsBody = null; }
public override void AnimationDidComplete(AnimationState animation) { base.AnimationDidComplete(animation); if (animation != AnimationState.Death) { return; } RemoveAllActions(); RunAction(SKAction.Sequence(new [] { SKAction.WaitForDuration(0.75), SKAction.FadeOutWithDuration(1), SKAction.Run(() => { RemoveFromParent(); Cave.Recycle(this); }) })); }
public override void AnimationDidComplete(AnimationState animation) { base.AnimationDidComplete(animation); if (animation != AnimationState.Death) { return; } // In a real game, you'd complete the level here, maybe as shown by commented code below. RemoveAllActions(); RunAction(SKAction.Sequence(new [] { SKAction.WaitForDuration(3), SKAction.FadeOutWithDuration(2), SKAction.RemoveFromParent(), // SKAction.RunBlock(()=> { // CharacterScene.GemeOver(); // }) })); }
// Do SKActions in a sequence on the given Sprite Node (wait, fade in, wait, fade out) private void DoActionSequenceOnNode(SKNode node, double waitSec, double fadeInSec, double waitSecMiddle, double fadeOutSec, nfloat maxAlpha) { SKAction sequence = SKAction.Sequence(SKAction.WaitForDuration(waitSec), SKAction.FadeAlphaTo(maxAlpha, fadeInSec), SKAction.WaitForDuration(waitSecMiddle), SKAction.FadeOutWithDuration(fadeOutSec)); node.RunAction(sequence); }
/// <summary> /// Отключение подсветки выбранного камешка /// </summary> private void HideSelectionIndicator() { // открепляем спрайт "подсветки" selectedSprite.RunAction(SKAction.Sequence(SKAction.FadeOutWithDuration(Properties.SelectedGemTextureFadeDuration / 1000f), SKAction.RemoveFromParent())); }
public override void DidMoveToView(SKView view) { // Setup your scene here var myLabel = new SKLabelNode("Chalkduster") { Text = "Helicopter Destroyers \n**COMING SOON**!", FontSize = 45, Position = new CGPoint(Frame.Width / 2, Frame.Height / 2) }; var myLabel1 = new SKLabelNode("Black") { Text = "BDD copyright 2017", FontSize = 35, Position = new CGPoint(Frame.Width / 2, Frame.Height / 3), Name = "myLabel1" }; var ScoreLabel = new SKLabelNode("Comicsans") { Text = "Score: ", FontSize = 42, Position = new CGPoint(Frame.Width - 100, 100), Name = "ScoreLabel" }; var NavArrow = SKSpriteNode.FromImageNamed(NSBundle.MainBundle.PathForResource("NavArrow", "png")); var Compass = SKSpriteNode.FromImageNamed(NSBundle.MainBundle.PathForResource("compassgauge_small", "png")); var Image1 = SKSpriteNode.FromImageNamed(NSBundle.MainBundle.PathForResource("SideS", "png")); Image1.Position = new CGPoint(Frame.Width / 2, Frame.Height / 4); Compass.Position = new CGPoint(Frame.Width - 50, 50); Compass.Name = "Compass"; NavArrow.Position = new CGPoint(Frame.Width - 50, 50); NavArrow.Name = "NavArrow"; NavArrow.SetScale((nfloat)1.5); //INITIALIZE PLAYER BULLET MAGAZINE for (int j = 0; j < PlayerMagazine.Length; j += 1) { PlayerMagazine[j] = new Bullets(); } //INITIALIZE TOWER ARRAY for (int i = 0; i < EnemyTowers.Length; i += 1) { EnemyTowers[i] = new Towers(5);//towers with 5 guards //for now the number of guards means 2 bullets per guard } for (int i = 0; i < EnemyTanks.Length; i += 1) { EnemyTanks[i] = new Tanks(); } //PLACE TOWERS RANDOMLY THROUGHOUT THE FRAME Random randx = new Random((int)Frame.Width); Random randy = new Random((int)Frame.Height); for (int i = 0; i < EnemyTowers.Length; i += 1) { nfloat randomx = (nfloat)randx.Next() % Frame.Width; nfloat randomy = (nfloat)randy.Next() % Frame.Height; EnemyTowers[i].tower.Position = new CGPoint(randomx, randomy); EnemyTowers[i].tower.Name = "Tower_" + i.ToString(); } for (int i = 0; i < EnemyTanks.Length; i += 1) { nfloat randomx = (nfloat)randx.Next() % Frame.Width; nfloat randomy = (nfloat)randy.Next() % Frame.Height; EnemyTanks[i].enemySprite.Position = new CGPoint(randomx, randomy); EnemyTanks[i].enemySprite.Name = "EnemyTank_" + i.ToString(); } //ADD THE TOWERS TO THE GAMESCENE (PARENT) for (int i = 0; i < EnemyTowers.Length; i += 1) { AddChild(EnemyTowers[i].tower); } //ADD THE TANKS TO THE GAMESENE (PARENT) for (int i = 0; i < EnemyTanks.Length; i += 1) { AddChild(EnemyTanks[i].enemySprite); } //ADD THE LABELS TO THE GAMESCENE (PARENT) AddChild(myLabel); AddChild(myLabel1); AddChild(ScoreLabel); //ADD THE GAUGES TO THE GAMESCENE AddChild(Compass); AddChild(NavArrow); //ESTABLISH AND RUN AN ACTION FOR myLabel and ScoreLabel var fadeout1 = SKAction.FadeOutWithDuration(5); var fadeout2 = SKAction.FadeOutWithDuration(5); myLabel.RunAction(fadeout2); myLabel1.RunAction(fadeout1); }