Exemple #1
0
    //set the Lock
    private void SetLock()
    {
        if (lockImg == null)
        {
            Debug.LogWarning("Lock doesn't exist or doesn't have an image Component");
            return;
        }

        bool animateLock = LevelData.getAnimateLock(levelNum);

        //animate the Unlocking if "animateUnlock" is true and the level is not locked
        if (animateLock && !isLocked)
        {
            lockImg.gameObject.SetActive(true);
        }

        //set animator with bool values
        lockImg.gameObject.GetComponent <Animator>().SetBool("IsLocked", isLocked);
        lockImg.gameObject.GetComponent <Animator>().SetBool("Animate", animateLock);
        lockImg.gameObject.GetComponent <Animator>().SetBool("IsOn", true);


        LevelData.AnimateUnlock(levelNum, false);
    }