// ======================================================================== public virtual void Start() { rollingModeGroup.gameObject.SetActive(false); groundModeGroup.gameObject.SetActive(false); rollingAirModeGroup.gameObject.SetActive(false); airModeGroup.gameObject.SetActive(false); foreach (CharacterCapability capability in capabilities) { capability.StateInit(stateCurrent, ""); } if (isLocalPlayer) { characterCamera = Instantiate(cameraPrefab).GetComponent <CharacterCamera>(); characterCamera.character = this; characterCamera.UpdateDelta(0); ObjTitleCard titleCard = ObjTitleCard.Make(this); hud = Instantiate(hudPrefab).GetComponent <HUD>(); hud.character = this; hud.Update(); } respawnData.position = position; Respawn(); }
public void ReloadFadeOut(Character character = null) { if (LevelManager.current.characters.Count == 1) { Time.timeScale = 0; } var screenFade = Instantiate( Constants.Get <GameObject>("prefabScreenFadeOut"), Vector3.zero, Quaternion.identity ).GetComponent <ScreenFade>(); if (character != null) { screenFade.canvas.worldCamera = character.characterCamera.camera; } MusicManager.current.FadeOut(); screenFade.onComplete = () => { if (LevelManager.current.characters.Count == 1) { Reload(); } else { if (character == null) { return; } ObjTitleCard.Make(character); character.Respawn(); } }; }
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 void Reload() { StartCoroutine(Utils.LoadLevelAsync( gameObject.scene.path, (Level nextLevel) => { MusicManager.current.Clear(); LevelManager.current.ReloadDisposablesScene(); foreach (var character in LevelManager.current.characters.Where(character => character.currentLevel == this)) { character.currentLevel = nextLevel; ObjTitleCard.Make(character); character.Respawn(); } SceneManager.UnloadSceneAsync(gameObject.scene); }, true )); }