Example #1
0
    public void AddShieldPoints(int _shieldPoints)
    {
        AudioManager.PlayShieldUpSound();

        // If re-adding the shield.
        if (Shield <= 0)
        {
            mPlayerData.Shield  = 0;
            mPlayerData.Shield += _shieldPoints;
            PlayerInfoManager.Instance.UpdateShield(mPlayerData.Shield);

            // Show shield bubble and start the animation.
            mShieldBubbleTransform.localScale = Vector3.zero;
            mShieldBubbleSpriteRen.enabled    = true;
            ScaleToAction shieldScaleUp = new ScaleToAction(mShieldBubbleTransform, Graph.InverseExponential, Vector3.one, 1.0f);
            ActionHandler.RunAction(shieldScaleUp);
        }
        // Else just adding on top of the shield.
        else
        {
            PulseAction pulse = new PulseAction(
                mShieldBubbleTransform, 1,
                Graph.Exponential, Graph.InverseExponential,
                0.25f, 0.35f,
                Vector3.one, Vector3.one * 1.2f);
            ActionHandler.RunAction(pulse);

            mPlayerData.Shield += _shieldPoints;
            PlayerInfoManager.Instance.UpdateShield(mPlayerData.Shield);
        }
    }
Example #2
0
    private void Setup()
    {
        mScoreText = transform.FindChild("ScoreText").GetComponent <Text>();

        mPulse          = null;
        mScoreText.text = GameManager.Instance.Score.ToString("N0");
    }
Example #3
0
    public void UpdateScore(int _score)
    {
        mScoreText.text = _score.ToString("N0");

        // Pulse attention!
        if (mPulse == null)
        {
            mPulse = new PulseAction(
                mScoreText.transform,
                1,
                Graph.Linear,
                Graph.InverseExponential,
                0.08f,
                0.15f,
                Vector3.one,
                Vector3.one * 1.5f);
        }
        mPulse.StopAction(true);
        ActionHandler.RunAction(mPulse);
    }
    private void SetupTitleWithLogo()
    {
        sbLoadedGame         = true;
        mSplashPanelCG.alpha = 1.0f;

        // Logo Animation
        DelayAction prePulseDelay = new DelayAction(1.5f);
        PulseAction clickPulse    = new PulseAction(
            mLogoTransform,
            1,
            Graph.Exponential,
            0.25f,
            Vector3.one,
            Vector3.one * 0.8f);

        clickPulse.OnActionStart += () => { AudioManager.PlayPenClickSound(); };
        DelayAction postPulseDelay = new DelayAction(0.25f);

        MoveByAction   anticipateLeft      = new MoveByAction(mLogoTransform, Graph.InverseExponential, Vector3.left * (100) * (Screen.height / 1920.0f), 0.5f);
        ScaleToAction  anticipateSquash    = new ScaleToAction(mLogoTransform, Graph.InverseExponential, new Vector3(0.75f, 1.25f, 1.25f), 0.5f);
        ActionParallel anticipateParallel  = new ActionParallel(anticipateLeft, anticipateSquash);
        DelayAction    postAnticipateDelay = new DelayAction(0.1f);
        MoveByAction   zoomRight           = new MoveByAction(mLogoTransform, Graph.InverseExponential, Vector3.right * (1024 + 400) * (Screen.height / 1920.0f), 0.3f);
        ScaleToAction  scaleDown           = new ScaleToAction(mLogoTransform, Graph.InverseExponential, new Vector3(1.5f, 0.5f, 0.5f), 0.5f);
        ActionParallel zoomRightParallel   = new ActionParallel(zoomRight, scaleDown);

        DelayAction preFadeDelay = new DelayAction(0.2f);
        CanvasGroupAlphaFadeToAction fadeCGAway = new CanvasGroupAlphaFadeToAction(mSplashPanelCG, 0.0f, 1.5f);

        fadeCGAway.OnActionFinish += () => {
            mSplashPanelCG.blocksRaycasts = false;
        };

        // Tap to Start text.
        DelayAction TurnOn = new DelayAction(0.5f);

        TurnOn.OnActionFinish += () => {
            mTapToStartText.enabled = true;
            if (mStartButton.interactable == false)
            {
                mStartButton.interactable = true;
            }
        };
        DelayAction TurnOff = new DelayAction(1.0f);

        TurnOff.OnActionFinish += () => { mTapToStartText.enabled = false; };
        ActionSequence      tapTextFlashSeq = new ActionSequence(TurnOn, TurnOff);
        ActionRepeatForever repeatFlash     = new ActionRepeatForever(tapTextFlashSeq);

        ActionSequence splashSeq = new ActionSequence(
            prePulseDelay, clickPulse, postPulseDelay,
            anticipateParallel, postAnticipateDelay, zoomRightParallel,
            preFadeDelay, fadeCGAway,
            repeatFlash
            );

        ActionHandler.RunAction(splashSeq);



        // Card Animations.
        // Card is already spinning in the background.
        // 0 to 90, snap -90, -90 to 0
        mSpiningCard.localEulerAngles = Vector3.zero;
        // Timing here doesn't matter. Is used to sync. 0.5f just nice to have card back show when canvas fades.
        RotateByAction initSpin = new RotateByAction(mSpiningCard, Graph.Linear, Vector3.up * 90.0f, 0.5f);

        initSpin.OnActionFinish += () => {
            mCardSpriteRen.transform.localScale -= Vector3.right * 2.0f;
            mCardSpriteRen.sprite = mCardSprites[Random.Range(0, mCardSprites.Length)];
        };
        RotateByAction spinA = new RotateByAction(mSpiningCard, Graph.Linear, Vector3.up * 180.0f, 3.0f);

        spinA.OnActionFinish += () => {
            mCardSpriteRen.transform.localScale += Vector3.right * 2.0f;
            mCardSpriteRen.sprite = mSpriteCardBack;
        };
        RotateByAction spinB = new RotateByAction(mSpiningCard, Graph.Linear, Vector3.up * 180.0f, 3.0f);

        spinB.OnActionFinish += () => {
            mCardSpriteRen.transform.localScale -= Vector3.right * 2.0f;
            mCardSpriteRen.sprite = mCardSprites[Random.Range(0, mCardSprites.Length)];
        };

        ActionSequence cardSpinSeq = new ActionSequence(spinA, spinB);

        ActionHandler.RunAction(new ActionSequence(initSpin, new ActionRepeatForever(cardSpinSeq)));
    }