Пример #1
0
    void SpreadCoins()
    {
        if (isRiki)
        {
            shape.enabled = false;
            Destroy(rb);
        }

        SG_Utils.Shuffle <Stuff>(Factory.LIVE_STUFF);

        int goldfishs = (int)item.power;

        foreach (Stuff stuff in Factory.LIVE_STUFF)
        {
            if (stuff != null && stuff is CatBasic && (stuff as CatBasic).isCanHoldCoin)
            {
                Mover.CreateCoinForCat(t.position, stuff as CatBasic);
                goldfishs--;
            }
            if (goldfishs < 1)
            {
                break;
            }
        }
    }
Пример #2
0
    void GetGoldfish()
    {
        if (isRiki)
        {
            shape.enabled = false;
            Destroy(rb);
        }

        SG_Utils.Shuffle <Stuff>(Factory.LIVE_STUFF);

        int goldfishs = (int)item.power;

        foreach (Stuff stuff in Factory.LIVE_STUFF)
        {
            if (stuff != null && stuff is CatBasic && (stuff as CatBasic).isCoin)
            {
                stuff.Punch();

                (stuff as CatBasic).FreeCoin();

                if (--goldfishs <= 0)
                {
                    break;
                }
            }
        }
    }
Пример #3
0
    void Mix()
    {
        var stuff1 = Factory.LIVE_STUFF.ToArray();

        var stuff2 = Factory.LIVE_STUFF.ToArray();

        SG_Utils.Shuffle <Stuff>(stuff2);

        for (int i = 0; i < stuff1.Length; i++)
        {
            Factory.LIVE_STUFF.Remove(stuff1[i]);

            stuff1[i].StartCoroutine(stuff1[i].MoveTo(stuff2[i].t.position, Random.Range(0.5f, 2f), s => { Factory.LIVE_STUFF.Add(s); }));
        }
    }
Пример #4
0
    void Magic()
    {
        if (isRiki)
        {
            shape.enabled = false;
            Destroy(rb);
        }

        SG_Utils.Shuffle <Stuff>(Factory.LIVE_STUFF);

        int count = (int)item.power;

        Stuff[] sortStuff = Factory.LIVE_STUFF.ToArray();

        System.Array.Sort(sortStuff, delegate(Stuff s1, Stuff s2)
        {
            if (s1 == null || s2 == null)
            {
                return(0);
            }
            else
            {
                return(DistanceTo(s1).CompareTo(DistanceTo(s2)));
            }
        });

        foreach (Stuff stuff in sortStuff)
        {
            if (stuff != null && stuff is CatBasic && !(stuff is CatJoker) && (stuff as CatBasic).type != changingColor.catType)
            {
                (stuff as CatBasic).ChangeType(changingColor.catType);

                stuff.Punch();

                if (--count <= 0)
                {
                    break;
                }
            }
        }
    }
Пример #5
0
    public override void ActivatePower()
    {
        var types = new CatType[] {
            CatType.GetCatType(Cats.Snow), CatType.GetCatType(Cats.Loki), CatType.GetCatType(Cats.Orion),
            CatType.GetCatType(Cats.Zen), CatType.GetCatType(Cats.Disco), CatType.GetCatType(Cats.Boom),
            CatType.GetCatType(Cats.Cap), CatType.GetCatType(Cats.King), CatType.GetCatType(Cats.Flint)
        };

        type = types[Random.Range(0, types.Length)];
        item = new CatItem(type, item.level, 0);

        if (type == CatType.GetCatType(Cats.Zen))
        {
            shape.enabled = false;

            StartCoroutine(FlyingTimers((int)item.power));

            iTween.PunchScale(ui.game.timeText.gameObject, new Vector3(0.6f, 0.6f, 0), 1);

            if (!isRiki)
            {
                ShakeAndDestroy();
            }
        }
        else if (type == CatType.GetCatType(Cats.Snow))
        {
            shape.enabled = false;

            gameplay.FreezeSeconds(item.power);

            if (!isRiki)
            {
                ShakeAndDestroy();
            }
        }
        else if (type == CatType.GetCatType(Cats.Disco))
        {
            shape.enabled = false;

            gameplay.StartFever(item.power);

            if (!isRiki)
            {
                ShakeAndDestroy();
            }
        }
        else if (type == CatType.GetCatType(Cats.Boom))
        {
            shape.enabled = false;

            Bomb((type.levelPower[0] + (type.levelPower[item.level - 1] - type.levelPower[0]) * 0.4f));

            if (!isRiki)
            {
                ShakeAndDestroy();
            }
        }
        else if (type == CatType.GetCatType(Cats.Cap))
        {
            Destroy(rb);
            shape.enabled = false;

            float scale = type.scale.x * (smallScreen ? 1.1f : 1f) * 0.6f * (type.levelPower[item.level - 1] / type.levelPower[0]);
            iTween.ScaleTo(gameObject, iTween.Hash("x", scale, "y", scale, "easeType", "easeOutBack", "time", 0.6f));

            StartCoroutine(Fly());
            StartCoroutine(PushOutCatsOnPath());
        }
        else if (type == CatType.GetCatType(Cats.King))
        {
            shape.enabled = false;

            SG_Utils.Shuffle <Stuff>(Factory.LIVE_STUFF);

            int goldfishs = (int)item.power;
            foreach (Stuff stuff in Factory.LIVE_STUFF)
            {
                if (stuff != null && stuff is CatBasic && (stuff as CatBasic).isCanHoldCoin)
                {
                    Mover.CreateCoinForCat(t.position, stuff as CatBasic);
                    goldfishs--;
                }
                if (goldfishs < 1)
                {
                    break;
                }
            }

            if (!isRiki)
            {
                ShakeAndDestroy();
            }
        }
        else if (type == CatType.GetCatType(Cats.Flint))
        {
            shape.enabled = false;

            SG_Utils.Shuffle <Stuff>(Factory.LIVE_STUFF);

            int goldfishs = (int)item.power;
            foreach (Stuff stuff in Factory.LIVE_STUFF)
            {
                if (stuff != null && stuff is CatBasic && (stuff as CatBasic).isCoin)
                {
                    stuff.Punch();

                    (stuff as CatBasic).FreeCoin();

                    if (--goldfishs <= 0)
                    {
                        break;
                    }
                }
            }

            if (!isRiki)
            {
                ShakeAndDestroy();
            }
        }
        else if (type == CatType.GetCatType(Cats.Loki))
        {
            shape.enabled = false;

            for (byte i = 0; i < CatLoki.bomb[item.level - 1, 0]; i++)
            {
                factory.CreateFirework(factory.fireworkPrefabs.boomSmall, new Vector3(Random.Range(-2f, 2f), Random.Range(-6f, 6f), 0));
            }
            for (byte i = 0; i < CatLoki.bomb[item.level - 1, 1]; i++)
            {
                factory.CreateFirework(factory.fireworkPrefabs.rocket, new Vector3(Random.Range(-2f, 2f), Random.Range(-6f, 6f), 0));
            }
            for (byte i = 0; i < CatLoki.bomb[item.level - 1, 2]; i++)
            {
                factory.CreateFirework(factory.fireworkPrefabs.boomBig, new Vector3(Random.Range(-2f, 2f), Random.Range(-6f, 6f), 0));
            }
            for (byte i = 0; i < CatLoki.bomb[item.level - 1, 3]; i++)
            {
                factory.CreateFirework(factory.fireworkPrefabs.color, new Vector3(Random.Range(-2f, 2f), Random.Range(-6f, 6f), 0));
            }

            if (!isRiki)
            {
                ShakeAndDestroy();
            }
        }
        else if (type == CatType.GetCatType(Cats.Orion))
        {
            shape.enabled = false;

            BlackHole.Create(t.position, item.power);

            if (!isRiki)
            {
                ShakeAndDestroy();
            }
        }
    }