Beispiel #1
0
        private void showScore()
        {
            var scoreText = new GameText("+1");

            scoreText.position = position;
            scene.addEntity(scoreText);

            var moveTween = scoreText.tweenPositionTo(position + new Vector2(0, -40), deathDuration);

            moveTween.setEaseType(EaseType.QuadOut);
            moveTween.start();

            var opacityTween = new FloatTween(scoreText, 0f, deathDuration - 0.3f);

            opacityTween.setEaseType(EaseType.QuadOut);
            opacityTween.setDelay(0.3f);
            opacityTween.start();

            Core.schedule(deathDuration, t => {
                if (scene != null)
                {
                    scoreText?.destroy();
                }
            });
        }
    public void Flash()
    {
        SpriteFlash.SetMaterialFlashColor(spriteRenderer, flashColour);

        if (tween.isRunning())
        {
            tween.stop(true, true);
        }

        tween.jumpToElapsedTime(0f);
        tween.setDuration(duration);
        tween.setEaseType(easeType);
        tween.start();
    }