private void OnApplicationPause(bool pause)
 {
     if (pause)
     {
         SaveLoadGame.SaveGame(save);
     }
 }
Exemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     if (spawnAtSpawnPoint)
     {
         transform.position = spawn.transform.position;
     }
     if (loadWhenSpawn)
     {
         loadWhenSpawn = false;
         if (loadEntry == null)
         {
             Debug.LogError("loadEntry is not intialized");
         }
         else
         {
             LevelSerializer.LoadNow(loadEntry.Data);
         }
     }
     Debug.Log(saveWhenSpawn);
     if (saveWhenSpawn)
     {
         saveWhenSpawn = false;
         if (saveEntryName == null)
         {
             saveEntryName = "autosave";
         }
         SaveLoadGame.save(saveEntryName);
     }
 }
Exemplo n.º 3
0
 private void Start()
 {
     progress     = FindObjects.GameLogic.GetComponent <DungeonProgress>();
     progressData = FindObjects.GameLogic
                    .GetComponent <DungeonProgressData>();
     saveLoad = FindObjects.GameLogic.GetComponent <SaveLoadGame>();
 }
Exemplo n.º 4
0
    void Start()
    {
        // Debug.Log("-=3=-");
        //  BallController.RedyToRunNewPlayerBall = false;

        if (explosiveBallTransform == null)
        {
            Debug.LogError("explosiveBallTransform==null");
        }
        //Завантажити збереження
        saveLoadManager = new SaveLoadGame();
        save            = saveLoadManager.LoadSave();
        Debug.Log(save.curLvl);

        // створити мапу, відповідно до рівня та отримати її скрипт
        map    = createMapGameobject(save.curLvl).GetComponent <MapInfo>();
        player = map.player;

        TextUpdate();
        LevelPreference(save.curLvl);

        TypesSphere typeSphere = ballCreator.randomType(true, CountColor);

        newSphere = ballCreator.getBall(ballTransform, map.pointToRespawnPlayersBall.position, typeSphere).gameObject;
        // newSphere.GetComponent<BallBehaviour>().TypeSphere = typeSphere;
        //  destroyLists = BallController.BallsLists;
    }
Exemplo n.º 5
0
 public void SwitchShowShadows()
 {
     Player.GetInstance().ShowShadows = !Player.GetInstance().ShowShadows;
     SetShadowSwitcher();
     // GameObject.Find("Directional Light").GetComponent<ShowShadowController>().SetShadow();
     SaveLoadGame.SaveGame();
 }
Exemplo n.º 6
0
    private void Start()
    {
        _audi = GetComponent <AudioSource>();
        if (Ini.FileExists("Save.sv"))
        {
            Ini.LoadFile("Save.sv");
            ExamplePony.playerMare = Ini.Get("Player_mare") == "1";
            ExamplePony.Beard.SetActive(Ini.Get("Player_beard") == "1");
            ExamplePony.randomHair = Convert.ToInt32(Ini.Get("Player_hair"));
            ExamplePony.SetNewValues();
            ExamplePony.HairAnim.GetComponent <SpriteRenderer>().color  =
                ExamplePony.Beard.GetComponent <SpriteRenderer>().color = SaveLoadGame.LoadColor("Player_hairColor");
            ExamplePony.GetComponent <SpriteRenderer>().color           = SaveLoadGame.LoadColor("Player_bodyColor");
            ExamplePony.anims[1].GetComponent <SpriteRenderer>().color  = SaveLoadGame.LoadColor("Player_flagColor");
            ExamplePony.anims[2].GetComponent <SpriteRenderer>().color  = SaveLoadGame.LoadColor("Player_eyesColor");

            ExamplePony.gameObject.SetActive(true);

            for (int i = 0; i < ExamplePony.anims.Length; i++)
            {
                ExamplePony.anims[i].SetBool("sit", true);
            }
            ExamplePony.HairAnim.SetBool("sit", true);

            if (ExamplePony.Beard.activeSelf)
            {
                ExamplePony.Beard.GetComponent <Animator>().SetBool("sit", true);
            }


            LoadGameButton.interactable = true;
        }
    }
    //обробка кнопок
    void StartLvl(int lvl)
    {
        if (lvl * 10 > save.maxOpenLvl)
        {
            return;
        }

        if (lvl == -1)                     //кнопка старт, або поточна максимальна кнопка
        {
            save.curLvl = save.maxOpenLvl + save.maxOpenLvl < 80?1:0;
        }

        if (lvl < save.maxOpenLvl / 10)
        {
            Debug.Log("(lvl) < maxOpenLvl / 10");
            save.curLvl = (lvl * 10) + 10;
        }
        else
        {
            save.curLvl = save.maxOpenLvl + (save.maxOpenLvl < 80 ? 1 : 0);
        }

        SaveLoadGame.SaveGame(save);
        SceneManager.LoadScene(1);
    }
Exemplo n.º 8
0
 void Start()
 {
     _playerInfo = GameObject.FindGameObjectWithTag(Tags.PLAYERINFO).GetComponent <PlayerInformation>();
     _save       = GameObject.FindGameObjectWithTag(Tags.SAVELOADOBJECT).GetComponent <SaveLoadGame>();
     _gender     = GetComponent <ChoosePlayerGender>();
     _name       = GetComponent <ChoosePlayerName>();
 }
Exemplo n.º 9
0
    public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
    {
        if (String.Equals(args.purchasedProduct.definition.id, TB_100Coins, StringComparison.Ordinal))
        {
            Player.GetInstance().Coins += 100;
        }
        else if (String.Equals(args.purchasedProduct.definition.id, TB_200Coins, StringComparison.Ordinal))
        {
            Player.GetInstance().Coins += 200;
        }
        else if (String.Equals(args.purchasedProduct.definition.id, TB_500Coins, StringComparison.Ordinal))
        {
            Player.GetInstance().Coins += 500;
        }
        else if (String.Equals(args.purchasedProduct.definition.id, TB_1000Coins, StringComparison.Ordinal))
        {
            Player.GetInstance().Coins += 1000;
        }
        else if (String.Equals(args.purchasedProduct.definition.id, TB_REMOVE_ADS, StringComparison.Ordinal))
        {
            Player.GetInstance().ShouldShowAds = false;
            GameObject removeAdsContainer      = GameObject.Find("RemoveAds");
            if (removeAdsContainer != null)
            {
                Destroy(removeAdsContainer);
            }
        }
        else
        {
            Debug.Log("ProcessPurchase: FAIL. Unrecognized product:");
        }

        SaveLoadGame.SaveGame();
        return(PurchaseProcessingResult.Complete);
    }
 public void button_exit()
 {
     StopAllCoroutines();
     SaveLoadGame.SaveGame(save);
     Advertisement.Banner.Hide();
     SceneManager.LoadScene(0);
 }
Exemplo n.º 11
0
 public void SetNextWorld()
 {
     if (LevelChooseInfos.chapterIndex < Player.GetInstance().AllChapter.Count - 1)
     {
         LevelChooseInfos.chapterIndex++;
         SaveLoadGame.SaveGame();
     }
 }
Exemplo n.º 12
0
 // Use this for initialization
 void Awake()
 {
     roomNavigation    = GetComponent <RoomNavigation>();
     interactableItems = GetComponent <InteractableItems>();
     saveLoadGame      = GetComponent <SaveLoadGame>();
     Cursor.lockState  = CursorLockMode.Locked;
     Score             = Moves = 0;
 }
Exemplo n.º 13
0
 public static Player GetInstance()
 {
     if (Instance == null)
     {
         Instance = new Player();
         SaveLoadGame.LoadGame();
     }
     return(Instance);
 }
Exemplo n.º 14
0
 public void OnHintDescriptionOkClick()
 {
     GameObject.Find("AudioSourceClick").GetComponent <AudioSource>().Play();
     Player.GetInstance().HasUserPlayedHintTutorial = true;
     SaveLoadGame.SaveGame();
     gameSceneController.isJumpingAvailable = true;
     animator.SetTrigger("decrase");
     repeatButton.SetActive(true);
 }
    public ProgressBar progressBar;                     //прогрес бар до наступного рівня. Встановити в редакторі


    private void Awake()
    {
        saveLoadManager = new SaveLoadGame();
        save            = saveLoadManager.LoadSave();
        if (save == null)
        {
            Debug.Log("save==null");
        }
    }
Exemplo n.º 16
0
 private void UpdateSave()
 {
     save = skillScreenManager.save;           //Кнопка скіла працює з ігровим збереженням, але сама нічого не зберігає в файл. Зберігає SkillScreenManager
     if (save == null)
     {
         saveLoadManager = new SaveLoadGame();
         save            = saveLoadManager.LoadSave();
         //Debug.LogError("Не завантажене збереження з skillScreenManager");
     }
 }
Exemplo n.º 17
0
    void Start()
    {
        SLG = SaveLoadGame.Instance;

        Time.timeScale = 0;
        if (loadgame)
        {
            LoadGame(false);
            Time.timeScale = 1;
        }
    }
Exemplo n.º 18
0
    public void DoubleReward()
    {
        if (!this.isPlayed)
        {
            return;
        }

        this.chapter.Player.Coins += tries == 1 ? (TBConstants.GAME_FIRST_TRY_REWARD + TBConstants.GAME_REWARD) :
                                     TBConstants.GAME_REWARD;
        SaveLoadGame.SaveGame();
    }
Exemplo n.º 19
0
    // Start is called before the first frame update
    void Start()
    {
        saveLoadManager = new SaveLoadGame();
        save            = saveLoadManager.LoadSave();
        float scaleValue = 1.0f;

        if (save != null)
        {
            scaleValue = Mathf.Clamp((save.maxOpenLvl / 10.0f), 1, 8);
        }

        moonSpriteRender.transform.localScale = new Vector3(scaleValue, scaleValue, 1);
    }
Exemplo n.º 20
0
 public void GetHintForGame()
 {
     if (game.BuyHint())
     {
         SetHintTile();
         SetHintButton();
         HideHintTutorial();
         SaveLoadGame.SaveGame();
     }
     else
     {
         gameSceneGameObjectsController.OpenHintShop();
     }
 }
Exemplo n.º 21
0
 private bool BuyHintsForPrice(int hintCount, int price)
 {
     if (coins >= price)
     {
         hints += hintCount;
         coins -= price;
         SaveLoadGame.SaveGame();
         return(true);
     }
     else
     {
         return(false);
     }
 }
    private void SetCharacterInfos(int characterIndex, bool shouldActualCharacterNod, bool shouldActualCharacterCelebrate)
    {
        SetSelectedCharacter(shouldActualCharacterNod, shouldActualCharacterCelebrate);
        actualCharacter = characterValues[characterIndex].character;
        characterTitle.GetComponent <LocalizeText>().key = actualCharacter.Name;

        if (actualCharacter.IsChoosen)
        {
            selectedText.SetActive(true);
            buyButton.SetActive(false);
            selectButton.SetActive(false);
        }
        else if (actualCharacter.isAvailable)
        {
            buyButton.SetActive(false);
            selectButton.SetActive(true);
            selectedText.SetActive(false);
            selectButton.GetComponent <Button>().onClick.RemoveAllListeners();
            selectButton.GetComponent <Button>().onClick.AddListener(() =>
            {
                buttonClickAudio.Play();
                Player.GetInstance().ChooseCharacter(actualCharacter);
                SetCharacterInfos(characterIndex, true, false);
                SaveLoadGame.SaveGame();
            });
        }
        else
        {
            selectButton.SetActive(false);
            selectedText.SetActive(false);
            buyButton.SetActive(true);
            buyButton.transform.Find("PriceText").GetComponent <Text>().text = actualCharacter.Price.ToString();
            buyButton.GetComponent <Button>().onClick.RemoveAllListeners();
            buyButton.GetComponent <Button>().onClick.AddListener(() =>
            {
                if (!actualCharacter.Buy())
                {
                    buttonDisabledAudio.Play();
                    openWindowEvents.OpenIAP(GameObject.Find("Canvas"));
                }
                else
                {
                    buyAudio.Play();
                    SetCharacterInfos(characterIndex, false, true);
                    SaveLoadGame.SaveGame();
                }
            });
        }
    }
Exemplo n.º 23
0
    void Start()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        DontDestroyOnLoad(gameObject);

        gameManagerInfo = new GameManagerInfo();
    }
    void Awake()
    {
        //Debug.Log("Awake:" + SceneManager.GetActiveScene().name);
        DontDestroyOnLoad(this.gameObject);

        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(gameObject);
        }
        listSpawns = GameObject.FindGameObjectsWithTag("Spawner").ToList();
    }
Exemplo n.º 25
0
    public void SwitchSound()
    {
        if (Player.GetInstance().SoundOn)
        {
            AudioListener.volume = 0f;
            image.sprite         = Resources.Load <Sprite>("UI/Buttons/Button_Sound_Muted");
        }
        else
        {
            AudioListener.volume = 1f;
            image.sprite         = Resources.Load <Sprite>("UI/Buttons/Button_Sound");
        }

        Player.GetInstance().SoundOn = !Player.GetInstance().SoundOn;
        SaveLoadGame.SaveGame();
    }
Exemplo n.º 26
0
    private void GameWinProcess()
    {
        if ((float)save.skill[(int)PlayerSkill.SK_BONUS_EXP] > 0)
        {
            score = (score * 110) / 100;
        }

        save.playerExp += (score * 8);

        save.maxOpenLvl++;
        SaveLoadGame.SaveGame(save);
        StartCoroutine(GameWinProcessCoroutine());

        //Debug.Log("-=1=-");
        BallController.RedyToRunNewPlayerBall = false;

        if (winSalut != null)
        {
            winSalut.SetActive(true);
        }

        //Звук
        if (salutSound != null)
        {
            salutSound.Play();
        }

        if (map.sphereRespawnsList != null)
        {
            foreach (var resp in map.sphereRespawnsList)
            {
                resp.Speed = 0;
            }
        }

        //Очистка 5-го списка. Знищення наявних на екрані куль
        if (BallController.BallsLists[4] != null)
        {
            for (int i = 0; i < BallController.BallsLists[4].Count; i++)
            {
                if (BallController.BallsLists[4][i] != null)
                {
                    DestroyProcess(BallController.BallsLists[4][i]);
                }
            }
        }
    }
Exemplo n.º 27
0
    private IEnumerator CheckGame()
    {
        if (game.IsWon())
        {
            // Animation
            characterAnimator.SetTrigger("celebrate" + (TBConstants.RANDOM.Next(1, 4)));
            ActivateReplayAndHelp(false);
            GameObject.Find("AudioWin").GetComponent <AudioSource>().Play();
            yield return(new WaitForSeconds(2));

            ActivateReplayAndHelp(true);

            // Werbung
            adController.ShowVideoAd();
            Player.GetInstance().WinsWithoutAd += 1;

            // Gewonnen Anzeige
            gameSceneGameObjectsController.SetWinVisible();
            game.GamePlayed();

            // Reset Hints
            game.Hints = 0;

            //Speichern
            SaveLoadGame.SaveGame();
        }
        else if (game.IsLose())
        {
            // Animation
            characterAnimator.SetTrigger("disapointed" + (TBConstants.RANDOM.Next(1, 3)));
            ActivateReplayAndHelp(false);
            GameObject.Find("AudioLose").GetComponent <AudioSource>().Play();
            yield return(new WaitForSeconds(2));

            ActivateReplayAndHelp(true);

            // Verloren Anzeige
            gameSceneGameObjectsController.SetLoseVisible();

            // Speichern
            SaveLoadGame.SaveGame();
        }
        else
        {
            CheckHintTutorial();
        }
    }
    // Start is called before the first frame update
    void Start()
    {
        if (Advertisement.isSupported)
        {
            Advertisement.Initialize("3611265");
        }
        //Advertisement.Banner.SetPosition(BannerPosition.BOTTOM_CENTER);
        //Advertisement.Banner.Show("banner");

        saveLoadManager = new SaveLoadGame();
        save            = saveLoadManager.LoadSave();

        curAdvIndex            = UnityEngine.Random.Range(0, 4);
        advSpriteRender.sprite = advSprites[curAdvIndex];

        if (Advertisement.IsReady())
        {
            curAdvIndex            = UnityEngine.Random.Range(0, 4);
            advSpriteRender.sprite = advSprites[curAdvIndex];
        }
        else
        {
            advSpriteRender.gameObject.SetActive(false);
        }

        if (save.skillPoint > 0)
        {
            direction.SetActive(true);
        }
        else
        {
            direction.SetActive(false);
        }

        if (loadScreenCam != null)
        {
            for (int i = 0; i < textLvl.Length; i++)
            {
                if (save.maxOpenLvl > (i + 1) * 10)
                {
                    loadScreenCam.targetPos = textLvl[i].transform.position.y + 1.5f;
                }
            }
        }
    }
Exemplo n.º 29
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.transform.CompareTag("Player"))
        {
            collectedcheckPoint  = saveGame.CollectSavedValues();
            collectedcheckPoint += 1;

            Debug.Log("The checkpoint was saved now: " + collectedcheckPoint);

            SaveLoadGame.SaveCheckpoint(collectedcheckPoint);
            if (collision.transform.GetComponent <playerHealth>() == true)
            {
                collision.transform.GetComponent <playerHealth>().TakeDamage(-1);
                Instantiate(HealParticles, transform.position, Quaternion.identity);
                Destroy(this.gameObject);
            }
        }
    }
    void Start()
    {
        //chieldObjs = gameObject.GetComponentsInChildren<GameObject>();

        game = GameObject.FindGameObjectWithTag("Game");

        Player          = GameObject.FindGameObjectWithTag("Player");
        playerComand    = Player.gameObject.GetComponent <PlayerComand>();
        healthBarPlayer = Player.gameObject.GetComponent <HealthBarPlayer>();
        saveLoad        = game.GetComponent <SaveLoadGame>();
        spawmList       = new List <GameObject>();
        spawmList       = GameObject.FindGameObjectsWithTag("Spawner").ToList();

        for (int i = 0; i < spawmList.Count; i++)
        {
            spawmList[i].GetComponent <HandleTextFile>().morte();
            //handleText = spawmList[i].GetComponent<HandleTextFile>();
        }
    }