Example #1
0
    public override void Pick()
    {
        isPicked = true;

        (shape as CircleCollider2D).radius *= 1.2f;

        rikiImage.SetActive(false);

        if (anim == null)
        {
            anim = Instantiate(animations[CHAIN.Count > 0 ? CHAIN[CHAIN.Count - 1].type.id : 0]) as BasicCatAnimation;
            anim.transform.SetParent(animParent, false);
#if GAF
            anim.clip.addTrigger(clip =>
            {
                if (isPicked)
                {
                    clip.pause();
                }
            }, anim.frameHalf);
            anim.clip.addTrigger(clip =>
            {
                if (anim != null)
                {
                    Destroy(anim.gameObject);
                }
                rikiImage.SetActive(true);
            }, anim.frameEnd);
#endif
        }

        if (sound.ON && onClickSound != null)
        {
            onClickSound.Play();
        }

        if (CHAIN.Count > 0)
        {
            SetColor(CHAIN[CHAIN.Count - 1].type);
        }
    }
Example #2
0
    public void DrawAttention()
    {
        if (isCoin)
        {
            rikiImage.candy.SetActive(false);
            anim = Instantiate(typeRiki.candy) as BasicCatAnimation;
            anim.transform.SetParent(animParent, false);
#if GAF
            anim.clip.addTrigger(clip => { Destroy(anim.gameObject); rikiImage.candy.SetActive(true); }, anim.frameEnd);
#endif
        }
        else
        {
            rikiImage.idle.SetActive(false);
            anim = Instantiate(typeRiki.idle) as BasicCatAnimation;
            anim.transform.SetParent(animParent, false);
#if GAF
            anim.clip.addTrigger(clip => { Destroy(anim.gameObject); rikiImage.idle.SetActive(true); }, anim.frameEnd);
#endif
        }
    }
Example #3
0
    public override void Pick()
    {
        isPicked = true;

        (shape as CircleCollider2D).radius *= 1.2f;

        if (anim != null)
        {
            Destroy(anim.gameObject);
        }

        if (isCoin)
        {
            rikiImage.candy.SetActive(false);
            anim = Instantiate(typeRiki.candyPicked) as BasicCatAnimation;
            anim.transform.SetParent(animParent, false);
#if GAF
            anim.clip.addTrigger(clip => { if (isPicked)
                                           {
                                               clip.pause();
                                           }
                                 }, anim.frameHalf);
            anim.clip.addTrigger(clip => { Destroy(anim.gameObject); if (isCoin)
                                           {
                                               rikiImage.candy.SetActive(true);
                                           }
                                 }, anim.frameEnd);
#endif
        }
        else if (isMultiplier)
        {
            rikiImage.multiplier.SetActive(false);
            rikiImage.multiplierText.gameObject.SetActive(false);
            anim = Instantiate(typeRiki.multiplierPicked) as BasicCatAnimation;
            anim.transform.SetParent(animParent, false);
            anim.multiplierText.text = "x" + (gameplay.multiplier + 1);
#if GAF
            anim.clip.addTrigger(clip => { if (isPicked)
                                           {
                                               clip.pause();
                                           }
                                 }, anim.frameHalf);
            anim.clip.addTrigger(clip =>
            {
                Destroy(anim.gameObject);
                if (isMultiplier)
                {
                    rikiImage.multiplier.SetActive(true);
                    rikiImage.multiplierText.gameObject.SetActive(true);
                }
            }, anim.frameEnd);
#endif
        }
        else if (isHeart)
        {
            // TODO
        }
        else if (isBat)
        {
            // TODO
        }
        else
        {
            rikiImage.idle.SetActive(false);
            anim = Instantiate(typeRiki.idlePicked) as BasicCatAnimation;
            anim.transform.SetParent(animParent, false);
#if GAF
            anim.clip.addTrigger(clip => { if (isPicked)
                                           {
                                               clip.pause();
                                           }
                                 }, anim.frameHalf);
            anim.clip.addTrigger(clip => { Destroy(anim.gameObject); rikiImage.idle.SetActive(true); }, anim.frameEnd);
#endif
        }

        if (sound.ON && onClickSound != null)
        {
            onClickSound.Play();
        }
    }