コード例 #1
0
 public void DidCollectKey()
 {
     this.collectedKeySprite.Texture = SKTexture.FromImageNamed("Overlays/key_full.png");
     this.collectedKeySprite.RunAction(SKAction.Sequence(new SKAction[] { SKAction.WaitForDuration(0.5f),
                                                                          SKAction.ScaleBy(1.5f, 0.2f),
                                                                          SKAction.ScaleBy(1f / 1.5f, 0.2f) }));
 }
コード例 #2
0
        public void textScaling(SKLabelNode scaled)
        {
            var up = SKAction.ScaleBy(1.2f, 0.8f);
            //var down = SKAction.ScaleBy (0.8f, 0.5f);
            var seq  = SKAction.Sequence(new SKAction[] { up, up.ReversedAction });        //({up,down});
            var fort = SKAction.RepeatActionForever(seq);

            scaled.RunAction(fort);
        }
コード例 #3
0
        public async void finishingTimeAnimation()
        {
            var scale1 = SKAction.ScaleBy(6.0f, 0.5);

            TimeLabel.RunAction(scale1);

            var scale2 = scale1.ReversedAction;

            TimeLabel.RunAction(scale2);
        }
コード例 #4
0
        public async void loadStarter()
        {
            var scoreLoad = new SKLabelNode()
            {
                Text      = "" + (GameObj.ToBeatScore + 1) + " To Win",              //.ToString ();
                Position  = new CGPoint(Size.Width / 2, (Size.Height / 2) - 200),
                FontSize  = 66,
                FontColor = UIColor.White,
                FontName  = "GillSans-Bold",
            };

            scoreLoad.SetScale(0.1f);

            var moveUpAction  = SKAction.MoveTo((new CGPoint(Size.Width / 2, Size.Height / 2)), 1.0);
            var scaleUpAction = SKAction.ScaleBy(9f, 1.0);

            AddChild(scoreLoad);

            scoreLoad.RunAction(moveUpAction);
            scoreLoad.RunAction(scaleUpAction);

            await System.Threading.Tasks.Task.Delay(2000);

            scoreLoad.RemoveFromParent();

            for (int i = 0; i < 3; i++)
            {
                var startGameNode = new SKLabelNode()
                {
                    Text      = "" + (3 - i),
                    Position  = new CGPoint(Size.Width / 2, (Size.Height / 2) - 200),
                    FontSize  = 80,
                    FontColor = UIColor.Red,
                    FontName  = "GillSans-Bold",
                };
                startGameNode.SetScale(0.1f);

                var moveUpAction1  = SKAction.MoveTo((new CGPoint(Size.Width / 2, Size.Height / 2)), 1.0);
                var scaleUpAction1 = SKAction.ScaleBy(9f, 1.0);
                AddChild(startGameNode);

                startGameNode.RunAction(moveUpAction1);
                startGameNode.RunAction(scaleUpAction1);

                await System.Threading.Tasks.Task.Delay(2000);

                startGameNode.RemoveFromParent();
            }
        }
コード例 #5
0
        public async void AnalyzeTouch()
        {
            var touchDiff  = LastTouch.Y - FirstTouch.Y;
            var touchDiffX = LastTouch.X - FirstTouch.X;

            if (touchDiff > 66)
            {
                var sprite = new SKSpriteNode("dart_blue")
                {
                    Position = new CGPoint(
                        FirstTouch.X, -5f)
                };


                //dart_blue
//				var sprite1 = new SKSpriteNode ("knife1") {
//					Position = new CGPoint(
//						FirstTouch.X,-5f )
//				};



                sprite.SetScale(1.5f);
                AddChild(sprite);

                var finaldest = new CGPoint();
                var action    = SKAction.MoveTo(finaldest, 0.3);

                if (touchDiff < 150)
                {
                    finaldest = new CGPoint(LastTouch.X + (touchDiffX * 0.5f), LastTouch.Y + (touchDiff * 0.3f));
                    action    = SKAction.MoveTo(finaldest, 0.3);                //FollowPath (np, 3.0);
                }
                else
                {
                    finaldest = new CGPoint(LastTouch.X + (touchDiffX * 0.5f),
                                            LastTouch.Y + (touchDiff * 0.6f));

                    action = SKAction.MoveTo(finaldest, 0.2);
                }

                nfloat rotatingAngle = touchDiffX / 333;

                Console.WriteLine("touchDiff:::" + touchDiffX);
                Console.WriteLine("toRadians:::" + rotatingAngle);

                //to radians
                var RotAction = SKAction.RotateToAngle(-rotatingAngle, 0);

                //to small size
                var scaleAction = SKAction.ScaleTo(0.8f, 0.1555);

                sprite.RunAction(action);
                sprite.RunAction(RotAction);
                sprite.RunAction(scaleAction);

                SpriteCount++;

                //COLLISION
                if (PhotoNode.ContainsPoint(finaldest))
                {
                    CurrentScore++;
                    System.Diagnostics.Debug.WriteLine("POINTS:    " + CurrentScore);
                    System.Diagnostics.Debug.WriteLine("collideddddddd::::::::::::::::::::::");

                    await System.Threading.Tasks.Task.Delay(200);

                    await System.Threading.Tasks.Task.Delay(200);

                    var displayScoreNode = new SKLabelNode();

                    displayScoreNode.Text      = "" + CurrentScore;                    //.ToString ();
                    displayScoreNode.Position  = new CGPoint(Size.Width / 2, (Size.Height / 2) - 200);
                    displayScoreNode.FontSize  = 80;
                    displayScoreNode.FontColor = UIColor.Red;
                    displayScoreNode.FontName  = "GillSans-Bold";
                    displayScoreNode.SetScale(0.1f);

                    var moveUpAction  = SKAction.MoveTo((new CGPoint(Size.Width / 2, Size.Height / 2)), 0.5);
                    var scaleUpAction = SKAction.ScaleBy(9f, 0.5);
                    AddChild(displayScoreNode);

                    displayScoreNode.RunAction(moveUpAction);
                    displayScoreNode.RunAction(scaleUpAction);

                    await System.Threading.Tasks.Task.Delay(1000);

                    displayScoreNode.RemoveFromParent();
                }
                else
                {
                    await System.Threading.Tasks.Task.Delay(300);

                    SystemSound.Vibrate.PlaySystemSound();                     //.PlayAlertSound();
                    SystemSound.Vibrate.Close();
                }

                //REMOVE SLOW DART
                if (touchDiff < 100)
                {
                    await System.Threading.Tasks.Task.Delay(200);

                    sprite.RemoveFromParent();
                    SpriteCount--;
                }

                if (touchDiff > 120 && (!PhotoFrameNode.ContainsPoint(finaldest)))
                {
                    await System.Threading.Tasks.Task.Delay(300);

                    SystemSound.Vibrate.PlaySystemSound();                     //.PlayAlertSound();
                    SystemSound.Vibrate.Close();
                    await System.Threading.Tasks.Task.Delay(200);
                }
            }
        }