void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
         //DontDestroyOnLoad(gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
     if (File.Exists(Application.persistentDataPath + "/GameData/game_Data.botHash"))
     {
         LoadGameData();
         if (FileBasedPrefs.HasKey("inGameSceneChange"))
         {
             FileBasedPrefs.DeleteKey("inGameSceneChange");
             mainScreen.SetActive(false);
             allRooms.SetActive(true);
         }
         if (FileBasedPrefs.HasKey("showStairCase"))
         {
             FileBasedPrefs.DeleteKey("showStairCase");
             objects[97].SetActive(false);
             objects[60].SetActive(true);
         }
     }
 }
Beispiel #2
0
 void OnEnable()
 {
     if (FileBasedPrefs.HasKey(this.gameObject.name + "anime") && positionHold)
     {
         this.gameObject.transform.localPosition = holdPosition;
     }
 }
Beispiel #3
0
    private void checkIfWon()
    {
        if (FoundWord.Count >= HorizontalDragWords.Count + VerticalDragWords.Count)
        {
            Debug.Log("WON WORD PUZZLE");

            Reward.SetActive(true);

            if (FileBasedPrefs.HasKey("bigPuzzCount"))
            {
                FileBasedPrefs.SetInt("bigPuzzCount", FileBasedPrefs.GetInt("bigPuzzCount") + 1);
            }
            else
            {
                FileBasedPrefs.SetInt("bigPuzzCount", 1);
            }
            Debug.Log(FileBasedPrefs.GetInt("bigPuzzCount"));
            if (FileBasedPrefs.GetInt("bigPuzzCount") >= 8)
            {
                SteamHandler.instance.SetAch(SteamACH);
            }



            navToComp.SetActive(false);
            navToPuzz.SetActive(true);

            bothash.DialogueM.Instance.sentence = Dialogues.sentences;
            bothash.DialogueM.Instance.Avatar   = character;
            bothash.DialogueM.Instance.Audio    = Dialogues.Audios;
            bothash.DialogueM.Instance.startDialogue();
            //this.gameObject.SetActive(false);
        }
    }
    private void OnEnable()
    {
        /*if (!FileBasedPrefs.HasKey(roomSaveKey)) {
         *              //currentRoom = AllRooms[0].name;
         *  FileBasedPrefs.SetString(roomSaveKey, AllRooms[0].name);
         * }*/
        /*  else {
         *    currentRoom = FileBasedPrefs.GetString(roomSaveKey);
         * }*/

        if (!FileBasedPrefs.HasKey(roomSaveKey))
        {
            //currentRoom = AllRooms[0].name;
            FileBasedPrefs.SetString(roomSaveKey, AllRooms[0].name);
        }
        currentRoom = FileBasedPrefs.GetString(roomSaveKey);

        foreach (GameObject level in AllRooms)
        {
            if (level.name.Equals(currentRoom))
            {
                level.SetActive(true);
            }
            else
            {
                level.SetActive(false);
            }
        }
    }
Beispiel #5
0
    public static bool[] GetBoolArray(String key)
    {
        if (FileBasedPrefs.HasKey(key))
        {
            var bytes = System.Convert.FromBase64String(FileBasedPrefs.GetString(key));
            if (bytes.Length < 5)
            {
                Debug.LogError("Corrupt preference file for " + key);
                return(new bool[0]);
            }
            if ((ArrayType)bytes[0] != ArrayType.Bool)
            {
                Debug.LogError(key + " is not a boolean array");
                return(new bool[0]);
            }
            Initialize();

            // Make a new bytes array that doesn't include the number of entries + identifier (first 5 bytes) and turn that into a BitArray
            var bytes2 = new byte[bytes.Length - 5];
            System.Array.Copy(bytes, 5, bytes2, 0, bytes2.Length);
            var bits = new BitArray(bytes2);
            // Get the number of entries from the first 4 bytes after the identifier and resize the BitArray to that length, then convert it to a boolean array
            bits.Length = ConvertBytesToInt32(bytes);
            var boolArray = new bool[bits.Count];
            bits.CopyTo(boolArray, 0);

            return(boolArray);
        }
        return(new bool[0]);
    }
 private void OnMouseDown()
 {
     if (!FileBasedPrefs.HasKey("keyDisplayed"))
     {
         FileBasedPrefs.SetInt("clickedTaps", 1);
     }
 }
    // Update is called once per frame
    void Update()
    {
        if (checkStatus() && !puzzleCompleted)
        {
            Prize.SetActive(true);
            painting.SetActive(true);
            SteamHandler.instance.SetAch(SteamACH1);
            puzzleCompleted = true;
            //examinePainting.SetActive(false);
            if (FileBasedPrefs.HasKey("bigPuzzCount"))
            {
                FileBasedPrefs.SetInt("bigPuzzCount", FileBasedPrefs.GetInt("bigPuzzCount") + 1);
            }
            else
            {
                FileBasedPrefs.SetInt("bigPuzzCount", 1);
            }
            Debug.Log(FileBasedPrefs.GetInt("bigPuzzCount"));
            if (FileBasedPrefs.GetInt("bigPuzzCount") >= 8)
            {
                SteamHandler.instance.SetAch(SteamACH);
            }



            if (!FileBasedPrefs.HasKey("paintigOjectsPicked"))
            {
                FileBasedPrefs.SetInt("PantingSolved", 1);
            }
        }
    }
    void Start()
    {
        string spName = GetComponent <SpriteRenderer>().sprite.name;

        if (FileBasedPrefs.HasKey(spName) && (FileBasedPrefs.GetString(spName) == "showed_once"))
        {
            GetComponent <SpriteRenderer>().enabled = true;
            if (GetComponent <BoxCollider>() != null && initialEnableBoxCollider)
            {
                GetComponent <BoxCollider>().enabled = false;
            }
            else if (GetComponent <BoxCollider>() != null && !initialEnableBoxCollider)
            {
                GetComponent <BoxCollider>().enabled = true;
            }
        }
        else
        {
            GetComponent <SpriteRenderer>().enabled = false;
            if (GetComponent <BoxCollider>() != null && initialEnableBoxCollider)
            {
                GetComponent <BoxCollider>().enabled = true;
            }
            else if (GetComponent <BoxCollider>() != null && !initialEnableBoxCollider)
            {
                GetComponent <BoxCollider>().enabled = false;
            }
        }
    }
    // Start is called before the first frame update

    private void Awake()
    {
        if (FileBasedPrefs.HasKey("inGameSceneChange"))
        {
            Debug.Log("++++ froLoading+++++++");
        }
    }
Beispiel #10
0
 private void OnMouseDown()
 {
     if (FileBasedPrefs.HasKey("BenardEntryDone") && !FileBasedPrefs.HasKey("NavAfterBenardEntry"))
     {
         FileBasedPrefs.SetInt("NavAfterBenardEntry", 1);
         Block1stFLoorNav.SetActive(false);
     }
 }
 private void Awake()
 {
     if (FileBasedPrefs.HasKey("inGameSceneChange"))
     {
         gameObject.SetActive(false);
         FileBasedPrefs.DeleteKey("inGameSceneChange");
     }
 }
Beispiel #12
0
 public static Color GetColor(String key, Color defaultValue)
 {
     if (FileBasedPrefs.HasKey(key))
     {
         return(GetColor(key));
     }
     return(defaultValue);
 }
Beispiel #13
0
 public static Quaternion GetQuaternion(String key, Quaternion defaultValue)
 {
     if (FileBasedPrefs.HasKey(key))
     {
         return(GetQuaternion(key));
     }
     return(defaultValue);
 }
Beispiel #14
0
 public static Vector3 GetVector3(String key, Vector3 defaultValue)
 {
     if (FileBasedPrefs.HasKey(key))
     {
         return(GetVector3(key));
     }
     return(defaultValue);
 }
Beispiel #15
0
 private void OnMouseDown()
 {
     if (FileBasedPrefs.HasKey("PantingSolved") && !FileBasedPrefs.HasKey("PantingSolvedNavigationDone"))
     {
         FileBasedPrefs.SetInt("PantingSolvedNavigationDone", 1);
         bothash.DialogueM.Instance.sentence = sentences;
         bothash.DialogueM.Instance.Avatar   = character;
         bothash.DialogueM.Instance.Audio    = Audios;
         bothash.DialogueM.Instance.startDialogue();
     }
 }
 // Start is called before the first frame update
 void Start()
 {
     if (FileBasedPrefs.HasKey(gameObject.name) && FileBasedPrefs.GetString(gameObject.name) == "showed_once")
     {
         gameObject.SetActive(true);
     }
     else
     {
         gameObject.SetActive(false);
     }
 }
    IEnumerator StartLoading()
    {
        yield return(new WaitForSecondsRealtime(0.5f));

        if (FileBasedPrefs.HasKey("_restarted_"))
        {
            FileBasedPrefs.DeleteAll();
            FileBasedPrefs.DeleteKey("_restarted_");
        }
        LoadLevel();
    }
Beispiel #18
0
 private void OnMouseDown()
 {
     if (FileBasedPrefs.HasKey("plantInspected") && !FileBasedPrefs.HasKey("compass"))
     {
         FileBasedPrefs.SetInt("compass", 1);
         bothash.DialogueM.Instance.sentence = Dialogues.sentences;
         bothash.DialogueM.Instance.Avatar   = character;
         bothash.DialogueM.Instance.Audio    = Dialogues.Audios;
         bothash.DialogueM.Instance.startDialogue();
     }
 }
 private void OnMouseDown()
 {
     if (FileBasedPrefs.HasKey("SilverKeyfound") && !FileBasedPrefs.HasKey("BenardEntryDone"))
     {
         FileBasedPrefs.SetInt("BenardEntryDone", 1);
         bothash.DialogueM.Instance.sentence = Dialogues.sentences;
         bothash.DialogueM.Instance.Avatar   = character;
         bothash.DialogueM.Instance.Audio    = Dialogues.Audios;
         bothash.DialogueM.Instance.startDialogue();
     }
 }
Beispiel #20
0
 public void ButtonHideMe()
 {
     if (item != null)
     {
         if (!FileBasedPrefs.HasKey(item.name))
         {
             FileBasedPrefs.SetString(item.name, "hidden_once");
             item.SetActive(false);
         }
     }
 }
Beispiel #21
0
 private void OnMouseDown()
 {
     if (item != null)
     {
         if (!FileBasedPrefs.HasKey(item.name))
         {
             FileBasedPrefs.SetString(item.name, "hidden_once");
             item.SetActive(false);
         }
     }
 }
Beispiel #22
0
 public void ItemDisplay()
 {
     // todo save hog
     if (item != null)
     {
         if (FileBasedPrefs.HasKey(item.name))
         {
             item.SetActive(false);
         }
     }
 }
 public void LoadLevel()
 {
     Load.SetActive(true);
     if (FileBasedPrefs.HasKey("CurrentScene"))
     {
         StartCoroutine(LoadingScreen(FileBasedPrefs.GetInt("CurrentScene")));
     }
     else
     {
         StartCoroutine(LoadingScreen(1));
     }
 }
 public void PlayVent()
 {
     if (FileBasedPrefs.HasKey(this.gameObject.name))
     {
         gameObject.GetComponent <Animator>().enabled = false;
         return;
     }
     else
     {
         FileBasedPrefs.SetString(this.gameObject.name, "Done");
         gameObject.GetComponent <Animator>().enabled = true;
     }
 }
    public void removeKey(GameObject pressedKey)
    {
        pressedKey.GetComponent <SpriteRenderer>().enabled = true;
        SoundManager.Instance.gameSounds[13].Play();
        if (!keys.Contains(pressedKey))
        {
            keys.Clear();
            keys.AddRange(keysDuplicate);
            count = 0;
            foreach (GameObject item in keysDuplicate)
            {
                item.GetComponent <SpriteRenderer>().enabled = false;
            }
            pressedKey.GetComponent <SpriteRenderer>().enabled = false;
        }
        else
        {
            count++;
            keys.Remove(pressedKey);
            if (count >= 8)
            {
                prize.SetActive(true);



                if (FileBasedPrefs.HasKey("bigPuzzCount"))
                {
                    FileBasedPrefs.SetInt("bigPuzzCount", FileBasedPrefs.GetInt("bigPuzzCount") + 1);
                }
                else
                {
                    FileBasedPrefs.SetInt("bigPuzzCount", 1);
                }
                Debug.Log(FileBasedPrefs.GetInt("bigPuzzCount"));
                if (FileBasedPrefs.GetInt("bigPuzzCount") >= 8)
                {
                    SteamHandler.instance.SetAch(SteamACH);
                }



                examine.SetActive(false);
                navigate.SetActive(true);
                bothash.DialogueM.Instance.sentence = Dialogues.sentences;
                bothash.DialogueM.Instance.Avatar   = character;
                bothash.DialogueM.Instance.Audio    = Dialogues.Audios;
                bothash.DialogueM.Instance.startDialogue();
                currRoom.SetActive(false);
            }
        }
    }
Beispiel #26
0
    public static Quaternion[] GetQuaternionArray(String key, Quaternion defaultValue, int defaultSize)
    {
        if (FileBasedPrefs.HasKey(key))
        {
            return(GetQuaternionArray(key));
        }
        var quaternionArray = new Quaternion[defaultSize];

        for (int i = 0; i < defaultSize; i++)
        {
            quaternionArray[i] = defaultValue;
        }
        return(quaternionArray);
    }
Beispiel #27
0
    public static float[] GetFloatArray(String key, float defaultValue, int defaultSize)
    {
        if (FileBasedPrefs.HasKey(key))
        {
            return(GetFloatArray(key));
        }
        var floatArray = new float[defaultSize];

        for (int i = 0; i < defaultSize; i++)
        {
            floatArray[i] = defaultValue;
        }
        return(floatArray);
    }
Beispiel #28
0
    public static Vector2[] GetVector2Array(String key, Vector2 defaultValue, int defaultSize)
    {
        if (FileBasedPrefs.HasKey(key))
        {
            return(GetVector2Array(key));
        }
        var vector2Array = new Vector2[defaultSize];

        for (int i = 0; i < defaultSize; i++)
        {
            vector2Array[i] = defaultValue;
        }
        return(vector2Array);
    }
Beispiel #29
0
        IEnumerator waitForchair()
        {
            if (!FileBasedPrefs.HasKey(this.gameObject.name))
            {
                FileBasedPrefs.SetInt(this.gameObject.name, 1);
                blockscreen.SetActive(true);
                yield return(new WaitForSeconds(2.2f));

                DialogueM.Instance.sentence = Dialogues.sentences;
                DialogueM.Instance.Avatar   = character;
                DialogueM.Instance.Audio    = Dialogues.Audios;
                DialogueM.Instance.startDialogue();
            }
        }
Beispiel #30
0
    public static Color[] GetColorArray(String key, Color defaultValue, int defaultSize)
    {
        if (FileBasedPrefs.HasKey(key))
        {
            return(GetColorArray(key));
        }
        var colorArray = new Color[defaultSize];

        for (int i = 0; i < defaultSize; i++)
        {
            colorArray[i] = defaultValue;
        }
        return(colorArray);
    }