Пример #1
0
    void Start()
    {
        APIClass = GameObject.Find("API");
        api      = APIClass.GetComponent <MainAPI>();

        WarriorClass = GameObject.Find("character");
        wrr          = WarriorClass.GetComponent <Warrior>();

        LvlManagerClass = GameObject.Find("Main Camera");
        lvlmng          = LvlManagerClass.GetComponent <LvlManager>();

        unlockedAb = new bool[3];                       //инициализация
        levelAb    = new int[3];
        unlockedAb = wrr.unlockedabilities;
        levelAb    = wrr.levelofabilities;
        _level     = wrr.level;
        string str = GlobalControl.Instance.LevelGrade;

        char[] charArray  = str.ToCharArray(0, 5);
        int    firstChar  = (int)Char.GetNumericValue(charArray[0]);
        int    secondChar = (int)Char.GetNumericValue(charArray[2]);
        int    thirdChar  = (int)Char.GetNumericValue(charArray[4]);

        _level        = wrr.level;
        unlockedAb[0] = true;
        unlockedAb[1] = true;
        unlockedAb[2] = true;
        levelAb[0]    = firstChar;
        levelAb[1]    = secondChar;
        levelAb[2]    = thirdChar;

        UnblockButton1.SetActive(false);
        UnblockButton2.SetActive(false);
        UnblockButton3.SetActive(false);

        Skill1.interactable = false;
        Skill2.interactable = false;
        Skill3.interactable = false;

        LvlUpSkill1.SetActive(false);
        LvlUpSkill2.SetActive(false);
        LvlUpSkill3.SetActive(false);

        Img1Skill1Lvl.SetActive(false);
        Img1Skill2Lvl.SetActive(false);
        Img1Skill3Lvl.SetActive(false);
        Img1Skill4Lvl.SetActive(false);
        Img2Skill1Lvl.SetActive(false);
        Img2Skill2Lvl.SetActive(false);
        Img2Skill3Lvl.SetActive(false);
        Img2Skill4Lvl.SetActive(false);
        Img3Skill1Lvl.SetActive(false);
        Img3Skill2Lvl.SetActive(false);
        Img3Skill3Lvl.SetActive(false);
        Img3Skill4Lvl.SetActive(false);
    }
Пример #2
0
    void Update()
    {
        if ((lvlmng.lvlForUnblockSkills != 0) && (lvlmng.lvlForSkills != 0))
        {
            if (unlockedAb[0] != true)
            {
                UnblockButton1.SetActive(true);
            }
            if (unlockedAb[1] != true)
            {
                UnblockButton2.SetActive(true);
            }
            if (unlockedAb[2] != true)
            {
                UnblockButton3.SetActive(true);
            }
            treeIsActive = true;
        }
        else
        {
            UnblockButton1.SetActive(false);
            UnblockButton2.SetActive(false);
            UnblockButton3.SetActive(false);
        }
        if (unlockedAb[0] == true)
        {
            Skill1.interactable = true;
        }
        if (unlockedAb[1] == true)
        {
            Skill2.interactable = true;
        }
        if (unlockedAb[2] == true)
        {
            Skill3.interactable = true;
        }
        if ((lvlmng.lvlForSkills != 0) && (unlockedAb[0] == true))
        {
            LvlUpSkill1.SetActive(true);
        }
        else
        {
            LvlUpSkill1.SetActive(false);
        }
        if ((lvlmng.lvlForSkills != 0) && (unlockedAb[1] == true))
        {
            LvlUpSkill2.SetActive(true);
        }
        else
        {
            LvlUpSkill2.SetActive(false);
        }
        if ((lvlmng.lvlForSkills != 0) && (unlockedAb[2] == true))
        {
            LvlUpSkill3.SetActive(true);
        }
        else
        {
            LvlUpSkill3.SetActive(false);
        }

        if (unlockedAb[0] == true)
        {
            Img1Skill1Lvl.SetActive(true);
        }
        if (levelAb[0] == 1)
        {
            Img1Skill2Lvl.SetActive(true);
        }
        if (levelAb[0] == 2)
        {
            Img1Skill2Lvl.SetActive(true);
            Img1Skill3Lvl.SetActive(true);
        }
        if (levelAb[0] == 3)
        {
            Img1Skill2Lvl.SetActive(true);
            Img1Skill3Lvl.SetActive(true);
            Img1Skill4Lvl.SetActive(true);
        }
        if (unlockedAb[1] == true)
        {
            Img2Skill1Lvl.SetActive(true);
        }
        if (levelAb[1] == 1)
        {
            Img2Skill2Lvl.SetActive(true);
        }
        if (levelAb[1] == 2)
        {
            Img2Skill2Lvl.SetActive(true);
            Img2Skill3Lvl.SetActive(true);
        }
        if (levelAb[1] == 3)
        {
            Img2Skill2Lvl.SetActive(true);
            Img2Skill3Lvl.SetActive(true);
            Img2Skill4Lvl.SetActive(true);
        }
        if (unlockedAb[2] == true)
        {
            Img3Skill1Lvl.SetActive(true);
        }
        if (levelAb[2] == 1)
        {
            Img3Skill2Lvl.SetActive(true);
        }
        if (levelAb[2] == 2)
        {
            Img3Skill2Lvl.SetActive(true);
            Img3Skill3Lvl.SetActive(true);
        }
        if (levelAb[2] == 3)
        {
            Img3Skill2Lvl.SetActive(true);
            Img3Skill3Lvl.SetActive(true);
            Img3Skill4Lvl.SetActive(true);
        }
    }