void FinishGivePiece() { collectable_UI.onFinish -= FinishGivePiece; collectable_UI.gameObject.SetActive(false); SaveManager.Instance.LevelCollectableLoaded = Application.loadedLevelName; if (posToShow == -1) { SaveManager.Instance.LevelToLoadVideoCollectable = SaveManager.Instance.LevelToLoadCollectable; } else { if (CollectablesManager.isCollectableReady(TypeLevel)) { if (CollectablesManager.isCollectableFull(TypeLevel)) { SaveManager.Instance.LevelToLoadVideoCollectable = Door.NextScene; } else { SaveManager.Instance.LevelToLoadVideoCollectable = SaveManager.Instance.LevelToLoadCollectable; } } } CameraFade.StartAlphaFade(Color.black, false, 0.2f); CameraFade.Instance.m_OnFadeFinish += LoadLevel; }
void CheckForNextStep() { /* * if (SaveManager.Instance.dataKlaus == null) * { * SaveManager.Instance.StartSaveManager(); * }*/ if (CollectablesManager.isCollectableReady(TypeLevel))//Pregunto si este collectable ya se agarro { SaveManager.Instance.LevelCollectableLoaded = Application.loadedLevelName; if (CollectablesManager.isCollectableFull(TypeLevel))//Pregunto si ya se colleciono todo { SaveManager.Instance.LevelToLoadVideoCollectable = Door.NextScene; //Muestro Puerta Door.pausa = pausa; Door.gameObject.SetActive(true); } else { SaveManager.Instance.LevelToLoadVideoCollectable = SaveManager.Instance.LevelToLoadCollectable; //Muestro Portal Portal.pausa = pausa; Portal.gameObject.SetActive(true); } gameObject.SetActive(false); } }
public void SetLevel(string worldTitle, ArcadeLevelsInfo info) { currentWorld = info.worldID; Title.UpdateKey(worldTitle); Font font = null; int index = (int)FontsManager.FontType.Arcade; if (FontsManager.Instance.RegularFonts != null && FontsManager.Instance.RegularFonts.Length > index) { font = FontsManager.Instance.RegularFonts[index]; } for (int i = 0; i != info.levels.Length; ++i) { string sceneName = info.levels[i].sceneName.Split('-')[0]; Arcade_ButtonSelect instance = prefab.Spawn <Arcade_ButtonSelect>(); instance.Setup(font, currentWorld, i, info.levels[i].sceneName, info.levels[i].sectionNames, info.levels[i].picture, info.levels[i].hasTimeAttack, SaveManager.Instance.dataKlaus.GetTime(sceneName), info.levels[i].companyRecordSeconds, CollectablesManager.GetCollectedPieces(sceneName), CollectablesManager.GetTotalPieces(sceneName) ); Add(instance, false); } AdjustContainer(); }
IEnumerator WaitingPortal() { CharacterManager.Instance.FreezeAll(); CharacterManager.Instance.BecomeInmortal(true); //Salvo posToShow = CollectablesManager.setCollectable(TypeLevel); GetComponent <SpriteRenderer>().enabled = false; for (int i = 0; i < transform.childCount; ++i) { transform.GetChild(i).gameObject.SetActive(false); } yield return(StartCoroutine(new TimeCallBacks().WaitPause(timeToShowNextStep))); collectable_UI.onFinish += FinishGivePiece; if (posToShow >= 0) { collectable_UI.SetCollect(posToShow); } else { collectable_UI.SetCollect(0); } float timer = CounterTimerPlay.Instance.EndTime(); SaveManager.Instance.AddPlayTime(timer); ManagerAnalytics.MissionCompleted(Application.loadedLevelName, false, timer, 0, false); //Precargo la escena de video // LoadLevelManager.Instance.LoadLevel(Application.loadedLevelName + "_Video", ThreadPriority.Low, true); }
void OnGameLoaded() { if (!back) { // Set collectables info int currentPieces = 0; int totalPieces = 0; int currentSpeedruns = 0; int totalSpeedruns = 0; for (int i = 0; i != info.levels.Length; ++i) { string sceneName = info.levels[i].sceneName.Split('-')[0]; currentPieces += CollectablesManager.GetCollectedPieces(sceneName); totalPieces += CollectablesManager.GetTotalPieces(sceneName); float currentScore = SaveManager.Instance.dataKlaus.GetTime(sceneName); currentSpeedruns += info.levels[i].hasTimeAttack && currentScore > 0 && currentScore < info.levels[i].companyRecordSeconds ? 1 : 0; totalSpeedruns += info.levels[i].hasTimeAttack ? 1 : 0; } timeAttackValue = currentSpeedruns + "/" + totalSpeedruns; collectablesValue = currentPieces + "/" + totalPieces; } }
public void SelectLevel(int level) { audio.Play(); back.enabled = false; menu.ChangeWithGlitch(); // If this level doesn't have time attack, go to story mode directly if (!currentItems[currentLevel].timeAttackAvailable) { SumitSelectLevel(false); } // Else, show popup for the user to decide the mode else { currentLevel = level; popup.sections = currentItems[currentLevel].sectionNames; string sceneName = currentItems[currentLevel].sceneName.Split('-')[0]; popup.Setup( currentItems[currentLevel].companyRecord, SaveManager.Instance.dataKlaus.GetTime(sceneName), CollectablesManager.GetCollectedPieces(sceneName), CollectablesManager.GetTotalPieces(sceneName)); popup.Show(); } }
private void Awake() { if (_instance != null) { Destroy(gameObject); } else { _instance = this; } }
// Use this for initialization void Awake() { if (CollectablesManager.isCollectableFull(World) == false) { gameObject.SetActive(false); } else { CollectableCpuMaster.Instance.AddCPU(); } }
void OnGotPieceAllCallback(int wor) { if (UnLock) { return; } if (wor == World) { UnLock = true; bool UnlockAll = CollectablesManager.isCollectableFullForAll(); if (UnlockAll) { TrophiesManager.Instance.AwardTrophy(IDforAll); } enabled = false; } }
void OnGameLoaded() { // Get total time played timePlayedText.text = HUD_TimeAttack.FormatTime(SaveManager.Instance.dataKlaus.totalTimePlayed); // Get story progress float storyProgress = SaveManager.Instance.GetHistoryPercent(); storyText.text = Mathf.FloorToInt(storyProgress) + "%"; // Get total deaths deathsText.text = SaveManager.Instance.dataKlaus.deaths.ToString(); // Get total memories int currentPieces = 0; int totalPieces = 0; for (int i = 0; i != SaveManager.Instance.dataKlaus.collectablesItems.Count; ++i) { totalPieces += SaveManager.Instance.dataKlaus.collectablesItems[i].item.Count; currentPieces += SaveManager.Instance.dataKlaus.collectablesItems[i].item.FindAll(x => x).Count; } piecesText.text = currentPieces.ToString("00") + "/" + totalPieces.ToString("00"); // Get memories completed int memoriesCompleted = 0; int totalMemories = 6; for (int i = 1; i != 7; ++i) { memoriesCompleted += CollectablesManager.isCollectableFull("W" + i) ? 1 : 0; } memoriesCompletedText.text = memoriesCompleted.ToString() + "/" + totalMemories.ToString(); // Get time attack progress float timeAttackProgress = 100f * (float)SaveManager.Instance.dataKlaus.GetBrokenCompanyRecords() / (float)SaveManager.Instance.dataKlaus.GetTotalCompanyRecords(); timeAttackText.text = Mathf.FloorToInt(timeAttackProgress) + "%"; // Get overall progress progressText.text = Mathf.FloorToInt(storyProgress * 0.5f + timeAttackProgress * 0.25f + 25f * (float)currentPieces / (float)totalPieces) + "%"; }
void Start() { string sceneName = SceneManager.GetActiveScene().name.Split('-')[0]; int total = CollectablesManager.GetTotalPieces(sceneName); if (total != 0) { text.text = CollectablesManager.GetCollectedPieces(sceneName) + "/" + total; } canvasGroup.alpha = total != 0 ? 1 : 0; int worldIndex = Mathf.Clamp((int)char.GetNumericValue(sceneName[1]) - 1, 0, sprites.Length - 1); for (int i = 0; i != sprites.Length; ++i) { sprites[i].SetActive(i == worldIndex); } }
void OnGameLoaded() { for (int i = 0; i != memories.Length; ++i) { memories[i].interactable = CollectablesManager.isCollectableFull("W" + (i + 1)); } for (int i = 0; i != memories.Length; ++i) { if (!memories[i].interactable) { continue; } Navigation navigation = memories[i].navigation; for (int j = i - 1; j >= 0; --j) { if (memories[j].interactable) { navigation.selectOnUp = memories[j]; break; } } for (int j = i + 1; j < memories.Length; ++j) { if (memories[j].interactable) { navigation.selectOnDown = memories[j]; break; } } memories[i].navigation = navigation; } }
private void Awake() { Instance = this; }
// Use this for initialization private void Start() { this.sr = this.GetComponent <SpriteRenderer>(); this.levelManager = FindObjectOfType <LevelManager>(); this.collectablesManager = FindObjectOfType <CollectablesManager>(); }
// Update is called once per frame void Update() { if (ReInput.players.GetPlayer(0).GetButtonDown(InputEnum.GetInputString(CombinationKeys[currentKey])) && !firstUnlock) { ++currentNumberOfTimePress; if (currentNumberOfTimePress >= numberOfTimePress) { ++currentKey; if (currentKey >= CombinationKeys.Length) { SaveManager.Instance.dataKlaus.isNewGame = false; SaveManager.Instance.dataKlaus.isArcadeModeUnlock = true; buttonUnlock.interactable = true; arcadePopUp.canChangeSection = true; currentKey = 0; firstUnlock = true; Debug.LogError("Unlocked ArcdeMode"); } } StopCoroutine("ResetAll"); StartCoroutine("ResetAll", timeToNotPress); } if (ReInput.players.GetPlayer(0).GetButtonDown(InputEnum.GetInputString(CombinationKeysTrophy[currentKey2])) && !secondUnlock) { ++currentNumberOfTimePress2; if (currentNumberOfTimePress2 >= numberOfTimePress) { ++currentKey2; if (currentKey2 >= CombinationKeysTrophy.Length) { for (int i = 0; i < buttonsUnlocks2.Length; ++i) { buttonsUnlocks2[i].interactable = true; } for (int i = 1; i <= 6; ++i) { for (int j = 1; j <= 6; ++j) { CollectablesManager.setCollectable("W" + i + "L0" + j); } } Debug.LogError("Unlocked Collectables"); currentKey2 = 0; secondUnlock = true; } } StopCoroutine("ResetAll2"); StartCoroutine("ResetAll2", timeToNotPress); } if (ReInput.players.GetPlayer(0).GetButtonDown(InputEnum.GetInputString(CombinationKeysMemories[currentKey3])) && !thirdUnlock) { ++currentNumberOfTimePress3; if (currentNumberOfTimePress3 >= numberOfTimePress) { ++currentKey3; if (currentKey3 >= CombinationKeysMemories.Length) { SaveManager.Instance.dataKlaus.collectablesItems[0].item[0] = true; for (int i = 0; i < SaveManager.Instance.dataKlaus.collectablesItems.Count; ++i) { for (int j = 0; j < SaveManager.Instance.dataKlaus.collectablesItems[i].item.Count; ++j) { SaveManager.Instance.dataKlaus.collectablesItems[i].item[j] = true; } } for (int i = 0; i < buttonsUnlocksMemories.Length; ++i) { buttonsUnlocksMemories[i].interactable = true; } currentKey3 = 0; thirdUnlock = true; Debug.LogError("Unlocked Memories"); } } StopCoroutine("ResetAll3"); StartCoroutine("ResetAll3", timeToNotPress); } }
private void Start() { inventory = GameObject.FindGameObjectWithTag("Player").GetComponent <Inventory>(); collectablesManager = GameObject.FindGameObjectWithTag("Player").GetComponent <CollectablesManager>(); }