Example #1
0
    IEnumerator Fly(CatBasic cat)
    {
        Vector3 gravity = new Vector3(-0.4f, 0.4f, 0f);

        while (cat != null && t != null && cat.gameObject.activeSelf && !cat.isActivated && cat.DistanceTo(t.position) > 0.25f)
        {
            t.position += speed * (gravity + (cat.t.position - t.position).normalized) * Time.deltaTime;
            yield return(new WaitForEndOfFrame());
        }

        if (cat == null || t == null || !cat.gameObject.activeSelf)
        {
        }
        else if (cat.isActivated)
        {
            Create(ui.game.coinPrefab, ui.canvas[3].transform, t.position, gameplay.level.coinParent, 0.4f, target =>
            {
                gameplay.GetCoin();
            });
        }
        else if (cat.DistanceTo(t.position) < 0.25f)
        {
            cat.SetCoin();
            cat.Punch();
        }

        Destroy(gameObject);
    }
Example #2
0
    public void RemoveCatBasic(CatBasic cat)
    {
        cat.t.SetParent(ui.game.stuffBack, true);
        cat.t.position = randomPosition;
        cat.gameObject.SetActive(false);

        if (!POOL_CATS.Contains(cat))
        {
            POOL_CATS.Add(cat);
        }
    }
Example #3
0
    IEnumerator ChainHighlightManager()
    {
        while (isPlaying)
        {
            if (CatBasic.CHAIN.Count > 0)
            {
                CatBasic.HighlightChain();
            }

            yield return(new WaitForSeconds(0.4f));
        }
    }
Example #4
0
    // Летит рыбка к коту
    public static Mover CreateCoinForCat(Vector3 from, CatBasic cat)
    {
        Mover mover = Instantiate(ui.game.coinPrefab) as Mover;

        mover.t = mover.transform;
        mover.t.SetParent(ui.canvas[3].transform, false);
        mover.t.position = from;
        mover.t.Rotate(0f, 0f, Random.Range(0f, 360f));
        mover.speed *= Random.Range(0.9f, 1.1f);

        mover.StartCoroutine(mover.Fly(cat));

        return(mover);
    }