public void SwitchShowShadows() { Player.GetInstance().ShowShadows = !Player.GetInstance().ShowShadows; SetShadowSwitcher(); // GameObject.Find("Directional Light").GetComponent<ShowShadowController>().SetShadow(); SaveLoadGame.SaveGame(); }
//обробка кнопок 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); }
private void OnApplicationPause(bool pause) { if (pause) { SaveLoadGame.SaveGame(save); } }
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); }
public void SetNextWorld() { if (LevelChooseInfos.chapterIndex < Player.GetInstance().AllChapter.Count - 1) { LevelChooseInfos.chapterIndex++; SaveLoadGame.SaveGame(); } }
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 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(); }
public void FinaliseCreation() { //Sets the entered name and gender for the player PlayerInformation.Name = _name.PlayerName; PlayerInformation.IsMale = _gender.IsMale; //Player starts at level 1 with 0 experience PlayerInformation.Level = 1; PlayerInformation.CurrentExperience = 0; PlayerInformation.RequiredExperience = 500; //Player starts with some gold PlayerInformation.Gold = 500; _save.SaveGame(); }
public void GetHintForGame() { if (game.BuyHint()) { SetHintTile(); SetHintButton(); HideHintTutorial(); SaveLoadGame.SaveGame(); } else { gameSceneGameObjectsController.OpenHintShop(); } }
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(); } }); } }
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(); }
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(); } }
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]); } } } }
public void OpenSettings(GameObject container) { if (ExistsWindow(container, "SettingsScene")) { return; } GameObject settingsScreen = gameObjectLoader.GetWindow("SettingsScene"); settingsScreen.GetComponent <RectTransform>().parent = container.GetComponent <RectTransform>(); settingsScreen.GetComponent <RectTransform>().localPosition = new Vector3(0, 0, -200); settingsScreen.GetComponent <RectTransform>().localScale = new Vector3(0.8f, 0.8f, 0.8f); settingsScreen.transform.Find("CloseButton").GetComponent <Button>().onClick.AddListener(() => { GameObject.Find("AudioSourceClick").GetComponent <AudioSource>().Play(); Destroy(settingsScreen); }); settingsScreen.transform.Find("LanguageArea").transform.Find("GermanButton").GetComponent <Button>().onClick.AddListener(() => { LocalizeManager.GetInstance().SetLanguage(Languages.GERMAN); SaveLoadGame.SaveGame(); }); settingsScreen.transform.Find("LanguageArea").transform.Find("EnglishButton").GetComponent <Button>().onClick.AddListener(() => { LocalizeManager.GetInstance().SetLanguage(Languages.ENGLISH); SaveLoadGame.SaveGame(); }); settingsScreen.transform.Find("PrivacyPolicy").GetComponent <Button>().onClick.AddListener(() => { GameObject.Find("AudioSourceClick").GetComponent <AudioSource>().Play(); Application.OpenURL("http://boxfox-games.de/tilebreaker-privacy-policy/"); }); }
private void Update() { if (saveTextTimer > 0) { SaveText.SetActive(true); saveTextTimer -= Time.deltaTime; } else { SaveText.SetActive(false); } if (buildingLevel == 0) { CheckBuild(); if (startBuilding) { if (Down()) { PointLight.SetActive(true); anim.SetBool("burn", true); onetime = true; startBuilding = false; } } else { if (Up()) { if (onetime) { timerFirstSave = 1f; hintOff = false; resourses.AddResourses(-needWood, 0); buildingLevel++; onetime = false; } } } } if (buildingLevel > 0) { if (fireAudio.clip != FireAudio) { fireAudio.clip = FireAudio; fireAudio.Play(); DownClip = LeftWall.DownClip; } if (weather.weatherNumber > 7) { if (timerOff > 0) { timerOff -= Time.deltaTime; } else { fireAudio.volume = 0; PointLight.SetActive(false); anim.SetBool("burn", false); timerOn = 3f; } } else { if (timerOn > 0) { timerOn -= Time.deltaTime; } else { fireAudio.volume = 0.45f; PointLight.SetActive(true); timerOff = 3f; anim.SetBool("burn", true); } } } if (buildingLevel == 1) { if (!flag.enabled) //вот тут игра сохраняется при зажигании костра { if (timerFirstSave > 0) { timerFirstSave -= Time.deltaTime; } else { if (!firstSave) { saveTextTimer = 1.5f; savingGame.SaveGame(); firstSave = true; } } } CheckUpdateTwo(); if (startBuilding) { if (Up(Tower.transform)) { if (onetime) { hintOff = false; LeftWall.health = LeftWall.healthMax = 150; RightWall.health = RightWall.healthMax = 150; resourses.AddResourses(-needWoodUpdateTwo, 0); buildingLevel++; saveTextTimer = 1.5f; savingGame.SaveGame(); startBuilding = false; onetime = false; } } } } if (buildingLevel == 2) { CheckUpdateThree(); if (startBuilding) { if (Down(Tower.transform)) { Tower.GetComponent <SpriteRenderer>().sprite = TowerLevel3; onetime = true; startBuilding = false; } } else { if (Up(Tower.transform)) { if (onetime) { LeftWall.health = LeftWall.healthMax = 250; RightWall.health = RightWall.healthMax = 250; resourses.AddResourses(-needWoodUpdateThree, 0); buildingLevel++; saveTextTimer = 1.5f; savingGame.SaveGame(); startBuilding = false; onetime = false; } } } } }
private void OnApplicationQuit() { SaveLoadGame.SaveGame(save); }
private void GetFreeHint() { Player.GetInstance().ActualGame.Hints++; SaveLoadGame.SaveGame(); GameObject.Destroy(GameObject.Find("FreeHint")); }
public void button_skills() { SaveLoadGame.SaveGame(save); SceneManager.LoadScene(2); }
private void GameOverProcess() { SaveLoadGame.SaveGame(save); SceneManager.LoadScene(0); }