// Use this for initialization
    void Start()
    {
        myBut = GetComponent <Button> ();

        if (completeLevelBeforeOpeningMenu != null)
        {
            if (!SaveMaster.isLevelDone(completeLevelBeforeOpeningMenu))
            {
                myBut.onClick.RemoveAllListeners();
                myBut.onClick.AddListener(() => SceneMaster.s.LoadPlayingLevel(completeLevelBeforeOpeningMenu.id));
            }
        }

        if (!UnlockRequirementKeeper.isUnlocked(unlockReq, questDecisionLockId, questDecisionReqValue))
        {
            if (myDisMode == DisableMode.Disable)
            {
                gameObject.SetActive(false);
            }
            else
            {
                try {
                    GetComponent <TMPro.TextMeshProUGUI> ().text = "Locked";
                } catch { }
            }
        }
    }
 // Use this for initialization
 void Start()
 {
     if (reqLevel != null)
     {
         if (!SaveMaster.isLevelDone(reqLevel))
         {
             gameObject.SetActive(false);
         }
     }
 }
Esempio n. 3
0
    // Use this for initialization
    void Start()
    {
        myBut = GetComponent <Button> ();

        if (!SaveMaster.isLevelDone(myLevel))
        {
            myBut.onClick.RemoveAllListeners();
            myBut.onClick.AddListener(OpenLevel);
        }
    }
 public void PowerUpDisabledCallback()
 {
     StartCoroutine(ChargeUpButton(lastActiveFire));
     if (isDoneEarth && isDoneFire && !canDisExit)
     {
         if (!SaveMaster.isLevelDone(doranLevel))
         {
             Invoke("ActivateYouCanExit", 0.5f);
             Invoke("CanDisableCanExit", 1f);
         }
     }
 }
 public void EndTrying()
 {
     if (!SaveMaster.isLevelDone(doranLevel))
     {
         tutPanel.SetActive(false);
         LocalPlayerController.isActive = false;
         decidePanel.SetActive(true);
         GameObjectiveMaster.s.isGamePlaying = false;
     }
     else
     {
         EndGame();
     }
 }
    // Use this for initialization
    void Start()
    {
        DialogTree.s.myCustomTriggers[0]                   += StartElementTrial;
        DialogTree.s.myCustomTriggers[1]                   += EndGame;
        CharacterStuffController.s.buttonStateHijack       += ButtonStateHiJack;
        CharacterStuffController.s.isHijacked               = true;
        CharacterStuffController.s.powerUpDisabledCallback += PowerUpDisabledCallback;

        tutPanel.SetActive(false);
        decidePanel.SetActive(false);
        youCanExitHerePanel.SetActive(false);

        SetUpButtons();

        if (SaveMaster.isLevelDone(doranLevel))
        {
            Invoke("LateStartChangeDialog", 0.1f);
        }
    }
Esempio n. 7
0
    public static bool isUnlocked(GameSettings myLevel, int questDecisionLockId, float questDecisionReqValue)
    {
        bool isLevelChecked, isLevelDone, isQuestChecked, isQuestDone;

        isLevelChecked = myLevel != null;

        if (isLevelChecked)
        {
            //check if the level is done
            isLevelDone = SaveMaster.isLevelDone(myLevel);
        }
        else
        {
            isLevelDone = true;
        }

        isQuestChecked = questDecisionLockId != -1;
        if (isQuestChecked)
        {
            if (SaveMaster.s.mySave.questDecisions.Length < questDecisionLockId)
            {
                float[] temp = SaveMaster.s.mySave.questDecisions;
                SaveMaster.s.mySave.questDecisions = new float[questDecisionLockId];
                temp.CopyTo(SaveMaster.s.mySave.questDecisions, 0);
            }

            //check if the quest requirements are met
            isQuestDone = SaveMaster.s.mySave.questDecisions[questDecisionLockId] == questDecisionReqValue;
        }
        else
        {
            isQuestDone = true;
        }

        return(isQuestDone && isLevelDone);
    }
    // Use this for initialization
    void Start()
    {
        bool isNotTriggeredYet, isLevelDone, isNotQuestSwapped, isQuestDone;

        isNotQuestSwapped = questDecisionReqValue == -1;

        //Check if this event was triggered before
        if (SaveMaster.s.mySave.triggeredEvents.Length <= eventId)
        {
            bool[] temp = SaveMaster.s.mySave.triggeredEvents;
            SaveMaster.s.mySave.triggeredEvents = new bool[eventId];
            temp.CopyTo(SaveMaster.s.mySave.triggeredEvents, 0);
        }
        isNotTriggeredYet = !SaveMaster.s.mySave.triggeredEvents[eventId];


        //check if the level is done
        isLevelDone = SaveMaster.isLevelDone(myLevel);


        if (isNotTriggeredYet && isLevelDone)
        {
            if (SaveMaster.s.mySave.questDecisions.Length < questDecisionLockId)
            {
                float[] temp = SaveMaster.s.mySave.questDecisions;
                SaveMaster.s.mySave.questDecisions = new float[questDecisionLockId];
                temp.CopyTo(SaveMaster.s.mySave.questDecisions, 0);
            }

            if (isNotQuestSwapped)
            {
                //check if the quest requirements are met
                isQuestDone = true;
                if (questDecisionLockId != -1 && questDecisionLockId < SaveMaster.s.mySave.questDecisions.Length)
                {
                    isQuestDone = SaveMaster.s.mySave.questDecisions[questDecisionLockId] == questDecisionReqValue;
                }

                if (isQuestDone)
                {
                    DialogTree.s.LoadFromAsset(myDialog);
                    DialogTree.s.StartDialog();
                    SaveMaster.s.mySave.triggeredEvents[eventId] = true;
                }
            }
            else
            {
                //swap based on quest decision
                DialogTreeAsset myDecisionDialog = null;
                try {
                    myDecisionDialog = questDecisionDialogSwap[(int)SaveMaster.s.mySave.questDecisions[questDecisionLockId]];
                } catch (System.Exception e) {
                    DataLogger.LogError("Can't trigger dialog after event! " + eventId, e);
                }

                if (myDecisionDialog != null)
                {
                    DialogTree.s.LoadFromAsset(myDecisionDialog);
                    DialogTree.s.StartDialog();
                    SaveMaster.s.mySave.triggeredEvents[eventId] = true;
                }
            }
        }
    }
Esempio n. 9
0
    // Use this for initialization
    public void Start()
    {
        if (myText != null)
        {
            myText.text = mySettings.levelShortName;
        }
        if (nameText != null)
        {
            nameText.text = mySettings.levelName;
        }
        if (descriptionText != null)
        {
            descriptionText.text = mySettings.levelDescription;
        }
        if (startingImage != null)
        {
            startingImage.sprite = mySettings.startingImage;
        }

        if (mySettings != null)
        {
            GameSettings myFinalLevel = mySettings;
            while (myFinalLevel.nextStage != null)
            {
                myFinalLevel = myFinalLevel.nextStage;
            }

            if (SaveMaster.isLevelDone(myFinalLevel))
            {
                myButton.interactable = true;
                isUnlocked            = true;
                mybutImg.sprite       = finishedButImg;
            }
            else
            {
                myButton.interactable = true;
                isUnlocked            = true;
                mybutImg.sprite       = unlockedButImg;
            }
        }

        if (unlockReq != null)
        {
            bool isAlt = true;
            if (unlockReqAlt != null)
            {
                isAlt = SaveMaster.isLevelDone(unlockReqAlt);
            }

            if (!SaveMaster.isLevelDone(unlockReq) || !isAlt)
            {
                myButton.interactable = false;
                isUnlocked            = false;
                mybutImg.sprite       = lockedButImg;
            }
        }

        if (questDecisionLockId != -1)
        {
            try {
                if (SaveMaster.s.mySave.questDecisions.Length < questDecisionLockId)
                {
                    float[] temp = SaveMaster.s.mySave.questDecisions;
                    SaveMaster.s.mySave.questDecisions = new float[questDecisionLockId];
                    temp.CopyTo(SaveMaster.s.mySave.questDecisions, 0);
                }
                if (SaveMaster.s.mySave.questDecisions[questDecisionLockId] != questDecisionReqValue)
                {
                    myButton.interactable = false;
                    isUnlocked            = false;
                    mybutImg.sprite       = lockedButImg;
                }
            } catch {
                DataLogger.LogError("Problem Checking Quest Decision Choice " + questDecisionLockId.ToString());
            }
        }
        isInitialized = true;
    }