Example #1
0
 // проигрыш в игре
 void ShowLoseGamePopup()
 {
     AudioAssistant.Shot("YouLose");
     isPlaying = false;
     GameCamera.main.HideField();
     UIAssistant.main.ShowPage("YouLoseGame");
 }
Example #2
0
    IEnumerator BaseSession() // базовая куротина, проверающая победу или порожение
    {
        while (!limitationRoutineIsOver && !targetRoutineIsOver)
        {
            yield return(0);
        }
        StartNavel.main.Fin_Activ(false);
        Debug.Log(limitationRoutineIsOver + "   " + targetRoutineIsOver);
        if (!reachedTheTarget)
        {
            yield return(StartCoroutine(GameCamera.main.HideFieldRoutine()));

            FieldAssistant.main.RemoveField();
            ShowLoseGamePopup();

            yield break;
        }
        iteraction = false;


        yield return(new WaitForSeconds(0.2f));

        UIAssistant.main.ShowPage("TargetIsReached");
        AudioAssistant.Shot("TargetIsReached");
        yield return(StartCoroutine(Utils.WaitFor(() => CPanel.uiAnimation == 0, 0.4f)));

        UIAssistant.main.ShowPage("Field");

        yield return(StartCoroutine(Utils.WaitFor(CanIWait, 1f)));

        yield return(StartCoroutine(GameCamera.main.HideFieldRoutine()));

        FieldAssistant.main.RemoveField();
        StartCoroutine(YouWin());
    }
Example #3
0
 void  Awake()
 {
     chip          = GetComponent <Chip>();
     chip.chipType = "CrossBomb";
     birth         = SessionAssistant.main.eventCount;
     AudioAssistant.Shot("CreateCrossBomb");
 }
Example #4
0
    // программа, запускающая определённые действия при выигрыше в игре
    IEnumerator YouWin()
    {
        AudioAssistant.Shot("YouWin");
        SteamAchiments.main.TakeAchievement("WIN_GAME");
        PlayerPrefs.SetInt("FirstPass", 1);
        isPlaying = false;

        if (ProfileAssistant.main.local_profile.current_level == LevelProfile.main.level)
        {
            if (Level.all.ContainsKey(ProfileAssistant.main.local_profile.current_level + 1))
            {
                ProfileAssistant.main.local_profile.current_level++;
            }
        }
        ProfileAssistant.main.local_profile.SetScore(LevelProfile.main.level, score);
        GameCamera.main.HideField();
        yield return(0);

        while (CPanel.uiAnimation > 0)
        {
            yield return(0);
        }
        yield return(0);

        UIAssistant.main.ShowPage("YouWin");
        Debug.Log("YouWin");
        AnimationAssistant.main.Ferverk(1);
        UserProfileUtils.WriteProfileOnDevice(ProfileAssistant.main.local_profile);
    }
Example #5
0
    // Coroutine destruction / activation
    IEnumerator DestroyChipFunction()
    {
        matching = true;
        AudioAssistant.Shot("ChipCrush");

        yield return(new WaitForSeconds(0.2f));

        matching = false;

        chip.ParentRemove();


        float   velocity = 0;
        Vector3 impuls   = new Vector3(Random.Range(-3f, 3f), Random.Range(1f, 5f), 0);

        impuls      += chip.impulse;
        chip.impulse = Vector3.zero;
        SpriteRenderer sprite = GetComponent <SpriteRenderer>();

        sprite.sortingLayerName = "Foreground";

        float rotationSpeed = Random.Range(-30f, 30f);
        float growSpeed     = Random.Range(0.2f, 0.8f);

        while (transform.position.y > -10)
        {
            velocity           += Time.deltaTime * 20;
            velocity            = Mathf.Min(velocity, 40);
            transform.position += impuls * Time.deltaTime * transform.localScale.x;
            transform.position -= Vector3.up * Time.deltaTime * velocity * transform.localScale.x;
            transform.Rotate(0, 0, rotationSpeed * Time.deltaTime);
            transform.localScale += Vector3.one * growSpeed * Time.deltaTime;
            yield return(0);
        }
    }
    IEnumerator PlayRoutine()
    {
        int last_swap        = SessionAssistant.main.swapEvent;
        int last_match_count = SessionAssistant.main.matchCount;


        while (true)
        {
            if (SessionAssistant.main.matchCount - last_match_count >= 3)
            {
                Feedback feedback = ProjectParameters.main.feedbacks.GetRandom();
                text.gameObject.SetActive(true);
                text.text = feedback.text;
                anim.Play();
                AudioAssistant.Shot(feedback.audioClipName);
                while (anim.isPlaying)
                {
                    yield return(0);
                }
            }
            text.gameObject.SetActive(false);

            while (SessionAssistant.main.swapEvent <= last_swap)
            {
                yield return(0);
            }

            last_match_count = SessionAssistant.main.matchCount;
            last_swap        = SessionAssistant.main.swapEvent;

            yield return(0);

            yield return(StartCoroutine(Utils.WaitFor(SessionAssistant.main.CanIWait, 0.5f)));
        }
    }
Example #7
0
 void Awake()
 {
     _chip            = GetComponent <Chip>();
     live             = true;
     chip.destroyable = false;
     AudioAssistant.Shot("SugarCreate");
 }
Example #8
0
 // Crush block funtion
 override public void  BlockCrush(bool force)
 {
     if (destroying)
     {
         return;
     }
     if (eventCountBorn == SessionAssistant.main.eventCount && !force)
     {
         return;
     }
     eventCountBorn = SessionAssistant.main.eventCount;
     level--;
     if (level == 0)
     {
         slot.SetScore(1);
         slot.block = null;
         SlotGravity.Reshading();
         StartCoroutine(DestroyingRoutine());
         return;
     }
     if (level > 0)
     {
         anim.Play("BlockCrush");
         AudioAssistant.Shot("BlockHit");
         sr.sprite = sprites[level - 1];
     }
 }
Example #9
0
 void  Awake()
 {
     _chip         = GetComponent <Chip>();
     chip.chipType = "SimpleBomb";
     birth         = MatchThree.main.eventCount;
     AudioAssistant.Shot("CreateBomb");
 }
Example #10
0
    IEnumerator CrossMixRoutine(Chip secondary)
    {
        chip.busy        = true;
        chip.destroyable = false;
        SessionAssistant.main.EventCounter();

        Transform effect = ContentAssistant.main.GetItem("CrossMixEffect").transform;

        effect.SetParent(Slot.folder);
        effect.position = transform.position;
        effect.GetComponent <Animation>().Play();
        AudioAssistant.Shot("CrossBombCrush");

        chip.Minimize();

        FieldAssistant.main.BlockCrush(chip.slot.coord, false);
        FieldAssistant.main.JellyCrush(chip.slot.coord);

        int count = 8;

        for (int path = 1; count > 0; path++)
        {
            count = 0;
            foreach (Side side in Utils.allSides)
            {
                if (Freez(chip.slot.coord + Utils.SideOffset(side) * path))
                {
                    count++;
                }
            }
        }

        if (chip.slot.jam)
        {
            chip.jamType = chip.slot.jam.type;
        }

        count = 8;
        for (int path = 1; count > 0; path++)
        {
            count = 0;
            yield return(new WaitForSeconds(0.05f));

            foreach (Side side in Utils.allSides)
            {
                if (Crush(chip.slot.coord + Utils.SideOffset(side) * path, chip.jamType))
                {
                    count++;
                }
            }
        }

        chip.ParentRemove();

        yield return(new WaitForSeconds(0.1f));

        chip.busy = false;
        chip.HideChip(false);
    }
Example #11
0
 // Showing lose popup
 void ShowLosePopup()
 {
     AudioAssistant.Shot("YouLose");
     AudioAssistant.main.PlayMusic("Menu");
     isPlaying = false;
     FindObjectOfType <FieldCamera>().HideField();
     UIServer.main.ShowPage("YouLose");
 }
Example #12
0
 // Play of successfully purchased sound
 void onItemPurchased(PurchasableVirtualItem item, string payload)
 {
     if (payload != developerPayload)
     {
         return;
     }
     AudioAssistant.Shot("Buy");
 }
Example #13
0
    IEnumerator MoneyMinusAnim()
    {
        AudioAssistant.Shot("Coin");
        MoneyAnim.SetBool("Minus", true);
        yield return(new WaitForSeconds(0.2f));

        MoneyAnim.SetBool("Minus", false);
    }
Example #14
0
 // Play of successfully purchased sound
 void onMarketPurchase(PurchasableVirtualItem item, string payload, Dictionary <string, string> extra)
 {
     if (payload != developerPayload)
     {
         return;
     }
     AudioAssistant.Shot("Buy");
 }
Example #15
0
    IEnumerator MoneyAddAnim()
    {
        SteamAchiments.main.TakeAchievement("FIRST_MONEY");
        AudioAssistant.Shot("AddMoney");
        MoneyAnim.SetBool("Add", true);
        yield return(new WaitForSeconds(0.1f));

        MoneyAnim.SetBool("Add", false);
    }
Example #16
0
    // Coroutine of special control mode
    public override IEnumerator Logic()
    {
        finger.gameObject.SetActive(false);
        yield return(StartCoroutine(Utils.WaitFor(SessionAssistant.main.CanIWait, 0.1f)));

        Slot target = null;

        while (true)
        {
            if (Input.GetMouseButtonDown(0) || (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Ended))
            {
                target = ControlAssistant.main.GetSlotFromTouch();
            }
            if (target && target.chip && target.chip.chipType == "SimpleChip")
            {
                AudioAssistant.Shot("MagicFinger");

                finger.gameObject.SetActive(true);
                finger.transform.position = target.transform.position;
                finger.Play();

                yield return(new WaitForSeconds(2));

                ProfileAssistant.main.local_profile["finger"]--;

                float prob = Random.value;
                if (prob < 0.35f)
                {
                    FieldAssistant.main.AddPowerup(target.coord, "SimpleBomb");
                }
                else if (prob < 0.7f)
                {
                    FieldAssistant.main.AddPowerup(target.coord, "CrossBomb");
                }
                else if (prob < 0.9f)
                {
                    FieldAssistant.main.AddPowerup(target.coord, "ColorBomb");
                }
                else
                {
                    FieldAssistant.main.AddPowerup(target.coord, "RainbowHeart");
                }
                SessionAssistant.main.EventCounter();
                break;
            }
            yield return(0);
        }

        while (finger.isPlaying)
        {
            yield return(0);
        }

        finger.gameObject.SetActive(false);

        UIAssistant.main.ShowPage("Field");
    }
Example #17
0
 void onItemPurchased(PurchasableVirtualItem item, string payload)
 {
     if (payload != developerPayload)
     {
         return;
     }
     AudioAssistant.Shot("Buy");
     BerryStorePurchaser.Succeed(item.ItemId);
 }
    // Effect logic
    IEnumerator MixEffect()
    {
        yield return(0);

        Chip chip = GetChip();

        while (chip.parentSlot == null)
        {
            yield return(0);
        }
        transform.position = chip.parentSlot.transform.position;

        while (!SessionAssistant.main.CanIMatch())
        {
            yield return(0);
        }

        SessionAssistant.main.matching++;
        SessionAssistant.main.EventCounter();

        GetComponent <Animation>().Play();
        AudioAssistant.Shot("CrossBombCrush");

        sx = chip.parentSlot.slot.x;
        sy = chip.parentSlot.slot.y;

        yield return(new WaitForSeconds(0.3f));

        FieldAssistant.main.JellyCrush(sx, sy);

        for (int i = 1; i < 12; i++)
        {
            Crush(sx + i, sy + i);
            Crush(sx + i, sy);
            Crush(sx + i, sy - i);
            Crush(sx, sy + i);
            Crush(sx, sy - i);
            Crush(sx - i, sy + i);
            Crush(sx - i, sy);
            Crush(sx - i, sy - i);
            yield return(new WaitForSeconds(0.05f));
        }

        yield return(new WaitForSeconds(0.2f));

        SessionAssistant.main.matching--;

        while (GetComponent <Animation>().isPlaying)
        {
            yield return(0);
        }
        FieldAssistant.main.BlockCrush(sx, sy, false);

        destroingLock = false;
        DestroyChipFunction();
    }
Example #19
0
    void Start()
    {
        SpriteRenderer sr = GetComponent <SpriteRenderer>();

        if (type == "Jam A")
        {
            sr.sprite = jamAsprite;
        }
        AudioAssistant.Shot("WeedCreate");
    }
Example #20
0
    IEnumerator MixEffect()
    {
        yield return(0);

        Chip chip = GetChip();

        while (chip.parentSlot == null)
        {
            yield return(0);
        }
        transform.position = chip.parentSlot.transform.position;

        while (!SessionAssistant.main.CanIMatch())
        {
            yield return(0);
        }

        SessionAssistant.main.matching++;

        GetComponent <Animation>().Play();
        AudioAssistant.Shot("BombCrush");

        sx = chip.parentSlot.slot.x;
        sy = chip.parentSlot.slot.y;

        int width  = FieldAssistant.main.field.width;
        int height = FieldAssistant.main.field.height;

//		FieldAssistant.main.JellyCrush(sx, sy);

        for (int x = 0; x < width; x++)
        {
            for (int y = 0; y < height; y++)
            {
                Crush(x, y);
            }
        }

        AnimationAssistant.main.Explode(transform.position, 5, 30);

        yield return(new WaitForSeconds(0.6f));

        SessionAssistant.main.matching--;

        while (GetComponent <Animation>().isPlaying)
        {
            yield return(0);
        }

        FieldAssistant.main.BlockCrush(sx, sy, false);

        destroingLock = false;
        DestroyChipFunction();
    }
Example #21
0
    IEnumerator BaseSession()
    {
        DebugPanel.Log("Status (Base)", "Session", "Began.");
        while (!limitationRoutineIsOver && !targetRoutineIsOver)
        {
            yield return(0);
        }

        DebugPanel.Log("Status (Base)", "Session", "Waiting is over.");

        // Checking the condition of losing
        if (!reachedTheTarget)
        {
            DebugPanel.Log("Status (Base)", "Session", "Session failed. Clearing.");
            yield return(StartCoroutine(GameCamera.main.HideFieldRoutine()));

            FieldAssistant.main.RemoveField();
            ShowLosePopup();
            DebugPanel.Log("Status (Base)", "Session", "Session failed. End.");
            yield break;
        }

        iteraction = false;

        DebugPanel.Log("Status (Base)", "Session", "Session completed. Target is reached.");

        yield return(new WaitForSeconds(0.2f));

        UIAssistant.main.ShowPage("TargetIsReached");
        AudioAssistant.Shot("TargetIsReached");
        yield return(StartCoroutine(Utils.WaitFor(() => CPanel.uiAnimation == 0, 0.4f)));

        UIAssistant.main.ShowPage("Field");


        DebugPanel.Log("Status (Base)", "Session", "Session completed. Bonus matching.");

        // Conversion of the remaining moves into bombs and activating them
        yield return(StartCoroutine(BurnLastMovesToPowerups()));

        yield return(StartCoroutine(Utils.WaitFor(CanIWait, 1f)));

        DebugPanel.Log("Status (Base)", "Session", "Session completed. Clearing.");

        // Ending the session, showing win popup
        yield return(StartCoroutine(GameCamera.main.HideFieldRoutine()));

        FieldAssistant.main.RemoveField();
        StartCoroutine(YouWin());

        DebugPanel.Log("Status (Base)", "Session", "Session completed. End.");
    }
Example #22
0
 public bool ChekLoseGame()
 {
     if (MatchThree.main.eat <= 0 || MatchThree.main.energy <= 0 || MatchThree.main.hygiene <= 0 || MatchThree.main.coffee <= 0)
     {
         AudioAssistant.Shot("YouLose");
         UIAssistant.main.ShowPage("YouLoseGame");
         return(true);
     }
     else
     {
         return(false);
     }
 }
Example #23
0
 // Crush block funtion
 public void JellyCrush()
 {
     if (level == 1)
     {
         AudioAssistant.Shot("JellyCrush");
         StartCoroutine(DestroyingRoutine());
         return;
     }
     level--;
     anim.Play("JellyCrush");
     AudioAssistant.Shot("JellyrHit");
     sr.sprite = sprites[level - 1];
 }
Example #24
0
 // Function item purchase
 public void Purchase(int seedsCount, string goodId, int goodCount)
 {
     if (ProfileAssistant.main.local_profile["seed"] < seedsCount)
     {
         UIAssistant.main.ShowPage("Store");
         return;
     }
     ProfileAssistant.main.local_profile["seed"] -= seedsCount;
     ProfileAssistant.main.local_profile[goodId] += goodCount;
     ProfileAssistant.main.SaveUserInventory();
     ItemCounter.RefreshAll();
     AudioAssistant.Shot("Buy");
 }
Example #25
0
    IEnumerator  DestroyChipFunction(string powerup)
    {
        if (birth == SessionAssistant.main.eventCount)
        {
            chip.destroying = false;
            yield break;
        }

        if (!chip.destroying)
        {
            yield break;
        }

        chip.busy    = true;
        chip.gravity = false;

        chip.Play("Match");
        AudioAssistant.Shot("RainbowHeartCrush");
        SessionAssistant.main.EventCounter();

        FieldAssistant.main.JellyCrush(chip.slot.coord);

        chips.Add(chip);
        branchCount = GetBranchCount();

        if (chip.slot.jam)
        {
            chip.jamType = chip.slot.jam.type;
        }
        for (int i = 0; i < branchCount; i++)
        {
            StartCoroutine(LightningBranch(powerup));
        }

        while (branchCount != -1)
        {
            yield return(0);
        }

        chip.ParentRemove();
        chip.busy    = false;
        chip.gravity = true;

        chip.Play("Destroying");
        while (chip.IsPlaying("Destroying"))
        {
            yield return(0);
        }

        Destroy(gameObject);
    }
Example #26
0
    IEnumerator SimpleMixRoutine(Chip secondary)
    {
        chip.busy        = true;
        chip.destroyable = false;
        SessionAssistant.main.EventCounter();

        Transform effect = ContentAssistant.main.GetItem("SimpleMixEffect").transform;

        effect.SetParent(Slot.folder);
        effect.position = transform.position;
        effect.GetComponent <Animation>().Play();
        AudioAssistant.Shot("BombCrush");
        SessionAssistant.main.EventCounter();

        if (chip.slot.jam)
        {
            chip.jamType = chip.slot.jam.type;
        }

        chip.Minimize();

        SessionAssistant.main.EventCounter();
        int2 key = new int2();

        for (key.x = 0; key.x < LevelProfile.main.width; key.x++)
        {
            for (key.y = 0; key.y < LevelProfile.main.height; key.y++)
            {
                if (Mathf.Abs(chip.slot.x - key.x) + Mathf.Abs(chip.slot.y - key.y) <= 3)
                {
                    Crush(key);
                }
            }
        }

        AnimationAssistant.main.Explode(transform.position, 5, 30);

        yield return(new WaitForSeconds(0.6f));

        chip.busy = false;

        while (chip.IsPlaying())
        {
            yield return(0);
        }

        FieldAssistant.main.BlockCrush(chip.slot.coord, false);

        chip.HideChip(false);
    }
    // Showing lose popup
    void ShowLosePopup()
    {
        int result = RatingAssistant.main.CheckRatingDate();

        AudioAssistant.Shot("YouLose");
        AudioAssistant.main.PlayMusic("Menu");
        isPlaying = false;
        FindObjectOfType <FieldCamera>().HideField();
        if (result == 2 && !RatingAssistant.main.wasRated)
        {
            RatingAssistant.main.ShowLikePopUp(false);
        }
        UIServer.main.ShowPage("YouLose");
    }
Example #28
0
    IEnumerator TimerRoutine()
    {
        yield return(0);

        while (SessionAssistant.main.timeLeft > 10)
        {
            yield return(new WaitForSeconds(0.1f));
        }
        while (SessionAssistant.main.timeLeft > 0)
        {
            AudioAssistant.Shot("TimeWarrning");
            yield return(new WaitForSeconds(1f));
        }
    }
Example #29
0
    public IEnumerator Destroying()
    {
        chip.busy = true;

        SpriteRenderer sprite = GetComponent <SpriteRenderer>();

        AudioAssistant.Shot("ChipCrush");

        yield return(new WaitForSeconds(0.1f));

        chip.ParentRemove();
        chip.busy = false;

        if (chip.IsColored() && SessionAssistant.main.countOfEachTargetCount[chip.id] > 0)
        {
            GameObject go = GameObject.Find("ColorTargetItem" + Chip.chipTypes[chip.id]);

            if (go)
            {
                Transform target = go.transform;

                sprite.sortingLayerName = "UI";
                sprite.sortingOrder     = 10;

                float   time           = 0;
                float   speed          = Random.Range(1f, 1.8f);
                Vector3 startPosition  = transform.position;
                Vector3 targetPosition = target.position;

                while (time < 1)
                {
                    transform.position = Vector3.Lerp(startPosition, targetPosition, EasingFunctions.easeInOutQuad(time));
                    time += Time.unscaledDeltaTime * speed;
                    yield return(0);
                }

                transform.position = target.position;
            }
        }

        chip.Play("Destroying");

        while (chip.IsPlaying("Destroying"))
        {
            yield return(0);
        }

        Destroy(gameObject);
    }
Example #30
0
    void ShowWinPopup()
    {
        AudioAssistant.Shot("YouWin");
        AudioAssistant.main.PlayMusic("Menu");
        isPlaying = false;
        string key = "Best_Score_" + LevelProfile.main.level.ToString();

        if (PlayerPrefs.GetInt(key) < score)
        {
            PlayerPrefs.SetInt(key, score);
        }
        PlayerPrefs.SetInt("Complete_" + LevelProfile.main.level.ToString(), 1);
        FindObjectOfType <FieldCamera>().HideField();
        UIServer.main.ShowPage("YouWin");
    }