void StartNextLevel(Level nextLevel) { character.currentLevel = nextLevel; character.timer = 0; character.rings = 0; character.respawnData.position = character.currentLevel.spawnPosition; character.respawnData.timer = 0; character.checkpointId = 0; if (GlobalOptions.Get("levelTransitions") != "OFF") { character.timerPause = false; character.TryGetCapability("victory", (CharacterCapability capability) => { ((CharacterCapabilityVictory)capability).victoryLock = false; }); character.positionMax = Mathf.Infinity * Vector2.one; if (character.characterCamera != null) { character.characterCamera.maxPosition = Mathf.Infinity * Vector2.one; } ObjTitleCard titleCard = ObjTitleCard.Make(character, false); } else { character.currentLevel.ReloadFadeOut(character); } Destroy(gameObject); }
public NamedTemplate(ViewContext viewContext, string name) { _globals = GlobalOptions.Get(viewContext.HttpContext); _writer = new TemplateWriter(viewContext.Writer); if (_globals.InTemplate()) { throw new InvalidOperationException("A named template cannot be defined inside any template."); } _writer.WriteStart(name); _globals.EnterTemplate(); }
// Update is called once per frame void Update() { if (endTimer <= 0) { return; } if (GlobalOptions.Get("levelTransitions") == "INSTANT") { if (sceneReference.ScenePath != "") { character.score += GetTimeBonus(character.timer); character.score += character.rings * 100; character.effects.Clear(); LoadNextLevel(); endTimer = 0; return; } } scoreTextComponent.text = character.score.ToString(); ringTextComponent.text = ringBonus.ToString(); timeTextComponent.text = timeBonus.ToString(); if (showTimer > 0) { showTimer -= Utils.cappedDeltaTime; if (showTimer <= 0) { // animator.Play("Items Enter"); timeBonus = GetTimeBonus(character.timer); ringBonus = character.rings * 100; if (character.characterCamera != null) { canvas.worldCamera = character.characterCamera.camera; // i hate this name too, trust me } actTextComponent.text = character.currentLevel.act.ToString(); character.TryGetCapability("victory", (CharacterCapability capability) => { ((CharacterCapabilityVictory)capability).victoryLock = true; }); character.effects.Clear(); MusicManager.current.Play(new MusicManager.MusicStackEntry { introPath = "Music/Level Clear" }); } return; } if (tallyTimer > 0) { tallyTimer -= Utils.cappedDeltaTime; return; } if ((timeBonus > 0) || (ringBonus > 0)) { if (tallyFrameTimer > 0) { tallyFrameTimer -= Utils.cappedDeltaTime; if (tallyFrameTimer <= 0) { tallyFrameTimer = 1F / 60F; } else { return; } } int transferAmtTime = Mathf.Min(100, timeBonus); int transferAmtRing = Mathf.Min(100, ringBonus); if (Input.GetButtonDown("Pause")) { transferAmtTime = timeBonus; transferAmtRing = ringBonus; } timeBonus -= transferAmtTime; ringBonus -= transferAmtRing; character.score += transferAmtTime; character.score += transferAmtRing; SFX.Play(audioSource, "sfxTallyBeep"); if ((timeBonus <= 0) && (ringBonus <= 0)) { SFX.Play(audioSource, "sfxTallyChaChing"); if (GlobalOptions.Get("levelTransitions") != "OFF") { animator.Play("Items Exit"); } } return; } if (endTimer > 0) { endTimer -= Utils.cappedDeltaTime; if (endTimer <= 0) { LoadNextLevel(); } } }
public void Update() { canvas.worldCamera = character.characterCamera.camera; // Debug.Log(character.characterCamera.camera); scoreText.text = Utils.IntToStrCached(character.score); ringsText.text = Utils.IntToStrCached(character.rings); livesText.text = Utils.IntToStrCached(character.lives); int minutes = (int)(character.timer / 60); int seconds = (int)(character.timer % 60); sb.Clear(); sb.Append(Utils.IntToStrCached(minutes)); sb.Append(":"); if (seconds < 10) { sb.Append("0"); } sb.Append(Utils.IntToStrCached(seconds)); if (GlobalOptions.Get("timerType") != "NORMAL") { sb.Append(":"); int preciseTime = 0; if (GlobalOptions.Get("timerType") == "CENTISECOND") { preciseTime = (int)((character.timer % 1) * 100F); } if (GlobalOptions.Get("timerType") == "FRAMES") { preciseTime = (int)((character.timer * 60) % 60); } if (preciseTime < 10) { sb.Append("0"); } sb.Append(Utils.IntToStrCached(preciseTime)); } timeText.text = sb.ToString(); bool shouldFlash = (((int)(Time.unscaledTime * 60)) % 16) > 8; if (shouldFlash) { if (character.rings <= 0) { ringsTitleText.color = Color.red; } if (GlobalOptions.GetBool("timeLimit")) { if (character.timer >= 9 * 60) { timeTitleText.color = Color.red; } } } else { timeTitleText.color = Color.white; ringsTitleText.color = Color.white; } }