public override void OnClick()
    {
        base.OnClick();


        // Play animation
        //GetComponent<Animator>().Play("");

        // Drop egg if there is one
        if (hasEgg)
        {
            chickenObject.GetComponent <Animator>().Play("coop_" + chickenObject.name + "Yes");
            AkSoundEngine.PostEvent("Chicken", gameObject);
            EggCoop egg = GetComponentInChildren <EggCoop>();
            StartCoroutine(Coroutines.AnimatePosition(egg.gameObject, eggMark.position, 20f, () => {
                egg.chickenCoop = chickenCoop;
                egg.GetComponent <BoxCollider2D>().enabled = true;
                egg.PlayLandingAnimation();
            }));
            hasEgg = false;
        }
        else
        {
            chickenObject.GetComponent <Animator>().Play("coop_" + chickenObject.name + "No");
            AkSoundEngine.PostEvent("Chicken", gameObject);
        }
    }
Esempio n. 2
0
    public bool OnEggTap(EggCoop egg)
    {
        Data data = SaveNLoadTxt.Load();


        if (++data.eggQuantity == Pancake.eggs)
        {
            exitButton.SetActive(true);
        }

        SaveNLoadTxt.Save(data);

        return(true);
    }