示例#1
0
    internal static void killTweening(this GameObject self)
    {
        List <GoTween> tweens = Go.tweensWithTarget(self);

        foreach (GoTween tween in tweens)
        {
            tween.pause();
            tween.destroy();
        }
    }
示例#2
0
 static public int tweensWithTarget_s(IntPtr l)
 {
     try {
         System.Object a1;
         checkType(l, 1, out a1);
         System.Boolean a2;
         checkType(l, 2, out a2);
         var ret = Go.tweensWithTarget(a1, a2);
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#3
0
 internal static List <GoTween> getTweens(this GameObject self)
 {
     return(Go.tweensWithTarget(self));
 }
    public void EndGame()
    {
        FlyOutUIElements();

        scoreLabel.text = string.Format("{0:#,###0}", score);

        for (int i = hearts.Count - 1; i >= 0; i--)
        {
            FSprite heart = hearts[i];
            foreach (AbstractTween tween in Go.tweensWithTarget(heart))
            {
                Go.removeTween(tween);
            }
            heart.RemoveFromContainer();
            hearts.Remove(heart);
        }

        if (score >= 1000000)
        {
            StartHeartShower();
            FSoundManager.StopMusic();
            FSoundManager.PlaySound("happyPiano");
            gameIsOver = true;
            FLabel label = new FLabel("SoftSugar", "I love you times a million!");
            label.color = new Color(0.12f, 0.12f, 0.12f, 1.0f);
            label.x     = Futile.screen.halfWidth;
            label.y     = Futile.screen.halfHeight;
            label.scale = 0;
            AddChild(label);

            TweenConfig config = new TweenConfig()
                                 .floatProp("scale", 1.0f)
                                 .setEaseType(EaseType.SineInOut)
                                 .onComplete(OnWinLabelDoneAppearing);

            Go.to(label, 0.5f, config);
        }

        if (numHeartsMissed >= 5)
        {
            gameIsOver = true;
            FSoundManager.StopMusic();
            FSoundManager.PlaySound("sadPiano");
            FLabel topLabel    = new FLabel("SoftSugar", "Are you kidding me?!");
            FLabel bottomLabel = new FLabel("SoftSugar", string.Format("I love you way more than x{0:#,###0}!", score));
            topLabel.color    = new Color(0.75f, 0.12f, 0.12f, 1.0f);
            bottomLabel.color = new Color(0.12f, 0.12f, 0.12f, 1.0f);
            bottomLabel.x     = topLabel.x = Futile.screen.halfWidth;
            float bottomBeginning = 300f;
            float segmentHeight   = (Futile.screen.height - bottomBeginning * 2f) / 3f;
            bottomLabel.y     = segmentHeight - bottomLabel.textRect.height / 2f + bottomBeginning;
            topLabel.y        = segmentHeight * 3f - topLabel.textRect.height / 2f + bottomBeginning;
            bottomLabel.scale = topLabel.scale = 0;
            AddChild(topLabel);
            AddChild(bottomLabel);

            TweenConfig config1 = new TweenConfig()
                                  .floatProp("scale", 1.0f)
                                  .setEaseType(EaseType.SineInOut);
            TweenConfig config2 = new TweenConfig()
                                  .floatProp("scale", 0.75f)
                                  .setEaseType(EaseType.SineInOut);

            float duration = 0.5f;

            TweenChain chain = new TweenChain();
            chain.append(new Tween(topLabel, duration, config1));
            chain.append(new Tween(bottomLabel, duration, config2));
            chain.setOnCompleteHandler(OnGameShouldBeFullyOver);

            Go.addTween(chain);
            chain.play();
        }
    }