//-----------
    // METHODS
    //-----------

    private void OnGameInitializehandler()      // invoke every data event
    {
        StopCoroutine("StartCraftingClock");
        OnCatDataChaged.Invoke();
        OnMoneyChanged.Invoke();
        OnItemDataChanged.Invoke();
        OnGroupDataChanged.Invoke();
        if (overallData.gameData.isCrafting)
        {
            StartCoroutine(StartCraftingClock());
        }
        foreach (exploreGroups eG in overallData.gameData.exploreGroups)
        {
            StartCoroutine(StartExploreClock(eG));
        }
    }
    private void ExploreEnded(int indexInList)
    {
        Debug.Log("Explore Ended");
        exploreGroups  eG       = overallData.gameData.exploreGroups[indexInList];
        levels         lvl      = CLD.GetLevelByID(eG.destination);
        List <Ientity> loots    = new List <Ientity>(CalculateLoots(lvl, eG.crews));
        bool           explored = false;
        int            count    = 0;

        //return cats to count
        for (int i = 0; i < eG.crews.Length; i++)
        {
            if (i == 0 || eG.crews[i] == eG.crews[i - 1])
            {
                count++;
            }
            else
            {
                CatControl(eG.crews[i - 1], count, CatControlType.avaliable);
                count = 1;
            }
            if (i + 1 == eG.crews.Length)
            {
                CatControl(eG.crews[i], count, CatControlType.avaliable);
            }
        }
        //adding loots to inventory
        for (int i = 0; i < loots.Count; i++)
        {
            Debug.Log("aye" + loots[i].GetType());
            count = 1;
            for (int j = i + 1; j < loots.Count; j++)
            {
                Debug.Log("aye" + loots[j].GetType());
                if (loots[i].GetType() == loots[j].GetType() && loots[i].id == loots[j].id)
                {
                    Debug.Log("DIE");
                    count++;
                    loots.RemoveAt(j);
                    j--;
                }
            }
            if (loots[i].GetType() == typeof(catData))
            {
                CatControl(loots[i].id, count, CatControlType.count);
            }
            else
            {
                ItemControl(loots[i].id, count);
            }
        }
        //setting explored level
        foreach (exploredLevels exLvl in overallData.gameData.exploredLevels)
        {
            if (exLvl.id == lvl.id)
            {
                exLvl.rate += lvl.rate;
                explored    = true;
                if (exLvl.rate >= 100)
                {
                    unlockScore++;
                }
            }
        }
        if (!explored)
        {
            exploredLevels exLvl = new exploredLevels();
            exLvl.id   = lvl.id;
            exLvl.rate = lvl.rate;
            overallData.gameData.exploredLevels.Add(exLvl);
            if (exLvl.rate >= 100)
            {
                unlockScore++;
            }
        }
        overallData.gameData.exploreGroups.RemoveAt(indexInList);
        OnLevelDataChanged.Invoke();
        OnGroupDataChanged.Invoke();
        OnExploreEnded.Invoke();
    }