private void Start() { Cursor.visible = false; Cursor.lockState = CursorLockMode.Locked; PlayerPrefs.SetInt("Level", SceneTransition.GetCurSceneId()); }
void Start() { markRTF = mark.GetComponent <RectTransform>(); soundGroup = GetComponent <SoundGroup>(); focusManager.OnNodeFocused.Subscribe(node => { var cursorPos = node.GetComponent <CursorPositionHolder>(); mark.transform.position = cursorPos.CursorPosTransform.position; soundGroup.Play("Move"); }); this.UpdateAsObservable() .Subscribe(_ => markRTF.Rotate(0, 0, markRotateSpeed * Time.deltaTime)); resume.OnSelected.Subscribe(_ => { soundGroup.Play("Enter"); _OnPauseEnd.OnNext(Unit.Default); }); goToConfig.OnSelected.Subscribe(_ => { soundGroup.Play("Enter"); Hide(); config.Enter(); }); quit.OnSelected.Subscribe(_ => { soundGroup.Play("Enter"); SceneTransition.StartToChangeScene <DefaultTransitionView>("StageChoiceScene"); }); config.OnExit.Subscribe(_ => Enter()); }
// 更新 void Update() { death_Count = player.GetComponent <Player>().GetDeathCount(); if (sateg_deth - death_Count < 0 && !flag) { //GemaOver SE.instance.PlaySE(transitionSE); SceneTransition.Nextscene(m_scene); flag = true; } //// オブジェクトからTextコンポーネントを取得 //Text score_text = score_object.GetComponent<Text>(); //// テキストの表示を入れ替える //score_text.text = " × " + (sateg_deth - death_Count); //if(old_Death_Count != death_Count) //{ // p_Number.GetComponent<number>().ChengNum(3); //} old_Death_Count = death_Count; }
private void Awake() { PlayerController.OnPlayerSeesSomethingInteractable_Room += ShowInteractionPrompt; PlayerController.OnPlayerDoesNotSeeSomehtingInteractable += HideInteractionPrompt; attachedSceneTransition = GetComponent <SceneTransition>(); }
public SceneDirector() { Transition = SceneTransition.FadeOutToBlack_FadeIn; DefaultFadeOutTransition = SceneTransition.FadeOutToBlack; DefaultFadeInTransition = SceneTransition.FadeInFromBlack; DefaultFadeTime = 0.01f; }
private void Awake() { if (Instance == null) { Instance = this; } else if (Instance != this) { Destroy(gameObject); return; } if (OverlayCanvas == null) { Debug.Log("OverlayCanvas doesn't exist or is not linked to this script."); } if (FadeOverlay == null) { Debug.Log("FadeOverlay doesn't exist or is not linked to this script."); } var color = FadeOverlay.color; color = new Color(color.r, color.g, color.b, 1); FadeOverlay.color = color; StartCoroutine(Fade(TransitionDirection.In)); }
public static void Replace(String nextScene, SceneTransition transition = SceneTransition.FadeOutToBlack_FadeIn, Boolean needFade = true) { if (nextScene != "MainMenu") { if (Singleton <BubbleUI> .Instance != null) { Singleton <BubbleUI> .Instance.SetGameObjectActive(false); } EventHUD.Cleanup(); EventInput.ClearPadMask(); } Instance.Transition = transition; if (transition == SceneTransition.SwirlInBlack || transition == SceneTransition.SwirlInWhite) { PersistenSingleton <UIManager> .Instance.SetPlayerControlEnable(false, null); Instance.Swirl(nextScene, transition); } else { Instance.NextScene = nextScene; SoundLib.LazyLoadSoundResources(); PersistenSingleton <UIManager> .Instance.SetLoadingForSceneChange(); Instance.Replace(needFade); } }
//public string sceneName; void Awake() { //Hero Script Persists across scenes //startingCoords = this.transform.position; //SceneManager.sceneLoaded += OnSceneLoaded; if (instance != null) { //instance.gameObject.GetComponent<Rigidbody>().MovePosition(instance.startingCoords); //move the other object to the right place? //instance.ResetCoords(); //Destroy(gameObject); //assign health vaalues to new object // this.currentHealth = instance.currentHealth; //this.currentLives = instance.currentLives; //kill old object //GameObject oldObject = instance.gameObject; Destroy(gameObject); //instance = this; //DontDestroyOnLoad(gameObject); } else { instance = this; //DontDestroyOnLoad(gameObject); } }
void OnSceneTransition(SceneTransition e) { switch (e.sceneName) { case "TitleScreen": StartPlayingTrack(titleSource); break; case "VisualNovelScene": StartPlayingTrack(baseSource); break; case "FightScene": //StartPlayingTrack(fightSources[Services.FightScene.roundNum - 1]); //if (Services.FightScene.roundNum == 3) //{ // musicInstance = FMODUnity.RuntimeManager.CreateInstance(Music); // musicInstance.start(); //} break; default: break; } }
//过关->排行榜 public void goToRankListScene() { //重置数据 Flag.alreadyGetFlag = false; StartCoroutine(SceneTransition.getInstance().loadScene("RankListScene", 1.5f, 3)); }
//游戏结束 public void gameOver() { if (GameOver == false) { GameOver = true; //BGM AudioControler.getInstance().stopAllBGM(); Character.getInstance().characterDie(); //游戏结束逻辑 --GameData.MarioLives; if (GameData.MarioLives > 0) { StartCoroutine(SceneTransition.getInstance().loadScene("LivesScene", 2, 3)); } else { //刷新游戏数据 GameData.dataUpdate(); StartCoroutine(SceneTransition.getInstance().loadScene("GameOverScene", 2, 3)); } } }
/// <summary> /// Load a scene with the provided name. /// </summary> /// <param name="sceneName">The name of the scene to load.</param> public static async Task LoadAsync(string sceneName, SceneTransition sceneTransitionPrefab, int spawnPoint = 0) { if (IsTransitioning) { return; } Game.spawnPoint = spawnPoint; IsTransitioning = true; // Transition out Instance.sceneTransitionInstance = Instantiate(sceneTransitionPrefab); Instance.sceneTransitionInstance.Out(); while (!Instance.sceneTransitionInstance.DidReachHalfway) { await new WaitForUpdate(); } await new WaitForSeconds(0.25f); SceneManager.LoadScene(sceneName); // Transition in Instance.sceneTransitionInstance.In(); IsTransitioning = false; }
private IEnumerator _Swirl(String nextScene, SceneTransition transition) { this.PendingCurrentScene = this.CurrentScene; this.PendingNextScene = nextScene; this.IsFading = true; UIManager.Field.Loading = true; PersistenSingleton <UIManager> .Instance.SetUIPauseEnable(false); PersistenSingleton <UIManager> .Instance.SetMenuControlEnable(false); PersistenSingleton <UIManager> .Instance.SetPlayerControlEnable(false, (Action)null); for (Int32 waitFrames = (Int32)((!FF9StateSystem.Settings.IsFastForward) ? ((Int32)((!PersistenSingleton <UIManager> .Instance.Dialogs.Visible) ? 2 : 9)) : (FF9StateSystem.Settings.FastForwardFactor * 2)); waitFrames > 0; waitFrames--) { yield return(new WaitForEndOfFrame()); } SFX_Rush.CreateScreen(); yield return(null); Application.LoadLevel("SwirlScene"); this.LastScene = this.CurrentScene; this.CurrentScene = "SwirlScene"; global::Debug.Log("---------- Current Scene : " + PersistenSingleton <SceneDirector> .Instance.CurrentScene + " ----------"); this.NextScene = String.Empty; yield return(new WaitForEndOfFrame()); Resources.UnloadUnusedAssets(); //GC.Collect(); SceneDirector.ClearFadeColor(); this.IsFading = false; yield break; }
private void Start() { maxIndex = pos.Length; hasEntered = false; setActiveLevel(); sceneTransition = GameObject.Find("sceneTransitionCanvas").GetComponent <SceneTransition>(); }
void Start() { if ((mTesting && !Application.isEditor)) { GameObject.Destroy(this.gameObject); Debug.Log("Destroyed Test Game Instance"); return; } if (mInstance != null && mInstance != this) { GameObject.Destroy(this); return; } mInstance = this; DontDestroyOnLoad(this); InitLogicImplementation(); gameLogicImplementation.Start(); mGameLicense = Helpers.CreateComponentIfNotExists <GameLicense>(this); mGameOptions = Helpers.CreateComponentIfNotExists <GameOptions>(this); mGameState = Helpers.CreateComponentIfNotExists <GameStateManager>(this); mGamePlayer = Helpers.CreateComponentIfNotExists <GamePlayer>(this); mGameMusic = Helpers.CreateComponentIfNotExists <GameMusic>(this); mGameLoca = Helpers.CreateComponentIfNotExists <GameLocalization>(this); mGameLoca.Initialize(); mGamePause = Helpers.CreateComponentIfNotExists <GamePause>(this); mGameInput = Helpers.CreateComponentIfNotExists <GameInput>(this); mSceneTransition = Helpers.CreateComponentIfNotExists <SceneTransition>(this); mGameData = Helpers.CreateComponentIfNotExists <GameData>(this); mFirstFrame = true; }
void Start() { SceneTransition transition = Singleton.Get <SceneTransition>(); if (transition.State == SceneTransition.Transition.FadingIn) { mTargetAlpha = 1; mCurrentAlpha = 0; } else { mTargetAlpha = 1; mCurrentAlpha = 1; } if (titleGuiText != null) { foreach (GUIText guiText in titleGuiText) { if (guiText != null) { mCurrentColor = guiText.material.color; mCurrentColor.a = mCurrentAlpha; guiText.material.color = mCurrentColor; } } } }
void GetComponents() { m_sceneTransition = GetComponent <SceneTransition>(); m_gameLoading = GetComponent <GameLoading>(); m_emptyDataHandler = GetComponent <EmptyDataSaving>(); m_gameSaving = GetComponent <GameSaving>(); }
void OnTriggerStay(Collider col) { if (col.tag != "Player") { return; } doorSign.SetActive(true); doorSign.transform.Find("[roomText]").gameObject.GetComponent <Text>().text = room; Vector3 p4 = col.transform.TransformDirection(Vector3.forward); float PDotN = Vector3.Dot(p4, transform.position - col.transform.position); if (Input.GetButtonDown("Fire1") /*&& (PDotN>0.25|| Vector3.Distance(col.transform.position, transform.position) < 2)*/) { doorSign.SetActive(false); //Debug.Log("Changing Scenes"); npcDialogue.saveState(); ProgressManager.doorID = doorID; //preserve.Instance.transitions+=1; //SceneManager.LoadScene(scene); SceneTransition.setScene(scene); transition.GetComponent <SceneTransition>().play = true; } }
public IEnumerator ConnectPlayers() { var tempNameCurrent = Instantiate(_textName); tempNameCurrent.GetComponent <NamePlayer>().SetValue(PlayerPrefs.GetString("NamePlayer"), _charsSwitch[CURRENT_NUMBER - 1].transform); tempNameCurrent.GetComponent <NamePlayer>()._height = 3.5f; for (int i = 0; i < 4; i++) { yield return(new WaitForSeconds(Random.value)); int randomSkin = Random.Range(0, 3); var connPlayerT = _connectedPlayers[i].transform; var temp = Instantiate(_charsSkin[randomSkin], connPlayerT.position, connPlayerT.rotation, connPlayerT.parent); _countPlayers++; string randomName = _namesPlayer[Random.Range(0, _namesPlayer.Length)] + Random.Range(0, 1000); var tempText = Instantiate(_textName, connPlayerT.position, Quaternion.identity); tempText.GetComponent <NamePlayer>()._height = 2.3f; tempText.GetComponent <NamePlayer>().SetValue(randomName, temp.transform); PlayerPrefs.SetString("EnemyName" + i, randomName); PlayerPrefs.SetInt("EnemySkin" + i, randomSkin); temp.transform.DOLocalMove(Vector3.zero, 1.0f).SetEase(Ease.OutBounce); } yield return(new WaitForSeconds(2.0f)); SceneTransition.SwitchToScene("OfflineScene"); }
private void OnTriggerEnter(Collider other) { //check if on trigger enter with enemy projectile if (other.CompareTag("EnemyProjectile") && !playerAnim.GetCurrentAnimatorStateInfo(0).IsName("PlayerSelfDestruct")) { if (HP > 0) { playerAnim.SetBool("Damaged", true); StartCoroutine(cameraShakeScript.Shake(0.2f, 0.5f)); HP -= 1; Destroy(health[indexHP].gameObject); Instantiate(blast, transform.position, transform.rotation); indexHP++; } //if player health equals 0, destroy player gameobject if (HP <= 0) { gameStateScript = gameState.GetComponent <GameState>(); gameStateScript.levelEnd = true; sceneTransitionScript = sceneTransition.GetComponent <SceneTransition>(); sceneTransitionScript.RetryMenu(); Instantiate(lastBlast, transform.position, transform.rotation); Destroy(playerCompound); } } }
void Update() { if (state != State.Active) { return; } if (input.AnyButtonDown()) { state = State.FadingOut; if (saveDataManager.TutorialFinished) { titleLogo.FadeOut(); cloudSpawner.FadeOut(); anyKeyToStart.Disappear(); sounds.Play("Push"); DOVirtual.DelayedCall(fadeOutToTransition, () => { SceneTransition.StartToChangeScene <DefaultTransitionView>("StageChoiceScene"); }); } else { SceneTransition.StartToChangeScene <WhiteOutTransitionView>("Tutorial"); } } }
private IEnumerator jumpScene() { yield return(new WaitForSeconds(0.5f)); AudioControler.getInstance().SE_Daikettefinal.Play(); StartCoroutine(SceneTransition.getInstance().loadScene("LivesScene", 0, 2)); }
public void Display(ref Rect buttonSize, float deltaTime, SceneTransition transition) { if (IsUp == true) { // Update the current Y coordinate, if necessary if (mCurrentYCoordinate < 0) { mCurrentYCoordinate = Screen.height; } // Find the target Y coordinate if ((transition == null) || (transition.State != SceneTransition.Transition.NotTransitioning) || (isUp == false)) { mTargetYCoordinate = Screen.height; } else { mTargetYCoordinate = (Screen.height - (popUpHeight + popUpMargin)); } // Lerp to this value mCurrentYCoordinate = Mathf.Lerp(mCurrentYCoordinate, mTargetYCoordinate, (deltaTime * appearSpeed)); // Display the dialog buttonSize.x = (Screen.width - popUpWidth) / 2; buttonSize.y = mCurrentYCoordinate; buttonSize.width = popUpWidth; buttonSize.height = popUpHeight; GUI.Box(buttonSize, mText); } }
void Awake() { //set up the reference to this script. if (transform.name == "GUI") { gameScene = this; } screenFader = transform.Find("ScreenFader").GetComponent <GUITexture>(); if (screenFader != null) { RotatableGUI = false; } else { RotatableGUI = true; } if (!RotatableGUI) { screenFader.pixelInset = new Rect(0, 0, 342, 192); } else { screenFaderOnGUI = transform.Find("ScreenFader").GetComponent <RotatableGUIItem>(); screenFaderOnGUI.size = new Vector2(342, 192); } }
private IEnumerator Transition(SceneTransition transition, float initial, float final) { Time.timeScale = 0.2f; var start = Time.unscaledTime; var end = start + transition.duration; image.material.SetTexture("_Texture", transition.texture); image.material.SetFloat("_Smoothing", transition.smoothing); image.material.SetFloat("_Rotation", transition.rotation); image.material.SetFloat("_Cutoff", initial); while (Time.unscaledTime < end) { var cutoff = Tween.Lerp(initial, final, (Time.unscaledTime - start) / transition.duration); image.material.SetFloat("_Cutoff", cutoff); yield return(null); } image.material.SetFloat("_Cutoff", final); Time.timeScale = 1f; }
private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.tag == "Player") { SceneTransition.Nextscene(0); } }
IEnumerator InitializeInternal() { initialized = true; Instance = this; DontDestroyOnLoad(this); ThreadingBridge.Initialize(); // for webgl we cannot use custom attributes to find classes, so we rely on a delegate to create the logic instance for us. Initialize(); #if UNITY_WEBGL webGLHelper = this.AddComponentIfNotExists <WebGLPlatformHelper>(); #endif gameOptions = this.AddComponentIfNotExists <GameOptions>(); gameMusic = this.AddComponentIfNotExists <GameMusic>(); gameLoca = this.AddComponentIfNotExists <GameLocalization>(); gameLoca.Initialize(); gameInput = this.AddComponentIfNotExists <GameInput>(); sceneTransition = this.AddComponentIfNotExists <SceneTransition>(); objectPool = new ObjectPool(); yield return(new WaitForEndOfFrame()); GameSetupReady(); }
public void ListenGameStop() { var _transition = new SceneTransition (); _transition.context = ContextType.LOBBY; _transition.scene = lobbyScene; Global.Transition ().RequestStartScene (_transition); }
private void Awake() { if (button == null) { gameObject.GetComponent <Button>(); } SceneTransition sceneTransition = GameObject.FindObjectOfType <SceneTransition>(); button?.onClick.AddListener(() => { if (sceneTransition != null) { sceneTransition.Transition($"{sceneToLoad}"); } else { SceneManager.LoadScene($"{sceneToLoad}"); } if (sceneToLoad == "MainMenu") { Networker networker = GameObject.FindObjectOfType <Networker>(); if (networker != null) { Destroy(networker.gameObject); } } }); }
void Awake() { GameObject c = GameObject.FindGameObjectWithTag ("GameController"); flags = c.GetComponent<Flags>(); transition = GameObject.FindGameObjectWithTag("Fader").GetComponent<SceneTransition>(); flags.AddCutsceneFlag(cutsceneDialogue.name); }
private IEnumerator TransitionOut(SceneTransition transition) { var initial = 1.1f + transition.smoothing; var final = -.1f - transition.smoothing; yield return(StartCoroutine(Transition(transition, initial, final))); }
private void Start() { instance = this; anim = GetComponent <Animator>(); anim.SetTrigger("transEnd"); }
public void RequestStartScene(SceneTransition _transition) { if (! Network.isServer) { Debug.Log("Only server is allowed to transfer to scene " + _transition.scene); return; } networkView.RPC("TransitionManager_RequestStartScene", RPCMode.All, NetworkSerializer.Serialize(_transition)); }
void Awake() { // Singleton implementation if (Instance == null) { Instance = this; DontDestroyOnLoad(gameObject); canvasGroup = GetComponent<CanvasGroup>(); } else { Destroy(this); } }
private SceneTransition sceneTransition; // Scene switching void Start () { // Initialize game state variables sceneTransition = GetComponent<SceneTransition> (); // Initialise Players playerOne = GameObject.FindGameObjectWithTag("Player1").GetComponent<PlayerController>(); playerTwo = GameObject.FindGameObjectWithTag("Player2").GetComponent<PlayerController>(); // Get a list of respawn points gameRespawns = GameObject.FindGameObjectsWithTag("Respawn").ToList(); // Get a list of shrines and split them between the two players InitialiseShrines(); }
void Start() { _sceneTransition = Helper.Find<SceneTransition>("SceneTransition"); LevelSelectionAndUILogic = new LevelManager(); LevelSelectionAndUILogic.LoadFromJson(); }
void initialize() { //player = GameObject.FindGameObjectWithTag("PlayerSwapper").transform; numberAlive = enemies.Length; music = GameObject.FindGameObjectWithTag("Music").GetComponent<MusicManager>(); //gates = GameObject.FindGameObjectsWithTag ("Gate"); setUpGates(); looker = GameObject.FindGameObjectWithTag("CamFollow").GetComponent<CamLooker>(); GameObject c = GameObject.FindGameObjectWithTag ("GameController"); data = c.GetComponent<GameData>(); gameOverHandler = c.GetComponent<GameOverHandler>(); flags = c.GetComponent<Flags>(); transition = GameObject.FindGameObjectWithTag("Fader").GetComponent<SceneTransition>(); flags.AddTrapFlag(); trapCleared = flags.CheckTrapFlag(); canvas = GameObject.Find ("HUD").gameObject; if(type == trapType.STEALTH) stealthPrep(); initialized = true; }
void StartSceneLocal(SceneTransition _transition) { Global.Level.Load(_transition.scene); Global.Context ().context = _transition.context; }
public void ChangeScene( SceneTransition transition ) { m_SceneTransitions.Add( transition ); PlayTransitionOutEffect(); }
void TransitionManager_RequestStartScene(string _transitionSerial) { var _transition = new SceneTransition(); NetworkSerializer.Deserialize(_transitionSerial, out _transition); StartSceneLocal(_transition); }
// Use this for initialization void Awake() { data = GameObject.FindGameObjectWithTag("GameController").GetComponent<GameData>(); scene = GameObject.FindGameObjectWithTag("Fader").GetComponent<SceneTransition>(); }
// Use this for initialization void Awake() { fader = GameObject.FindGameObjectWithTag("Fader").GetComponent<SceneTransition>(); StartCoroutine(load()); }
void StartSceneLocal(SceneTransition _transition) { Application.LoadLevel(_transition.scene); Global.Context ().context = _transition.context; }
IEnumerator InitializeInternal() { initialized = true; Instance = this; DontDestroyOnLoad(this); ThreadingBridge.Initialize(); // for webgl we cannot use custom attributes to find classes, so we rely on a delegate to create the logic instance for us. Initialize(); #if UNITY_WEBGL webGLHelper = this.AddComponentIfNotExists<WebGLPlatformHelper>(); #endif gameOptions = this.AddComponentIfNotExists<GameOptions>(); gameMusic = this.AddComponentIfNotExists<GameMusic>(); gameLoca = this.AddComponentIfNotExists<GameLocalization>(); gameLoca.Initialize(); gameInput = this.AddComponentIfNotExists<GameInput>(); sceneTransition = this.AddComponentIfNotExists<SceneTransition>(); objectPool = new ObjectPool(); yield return new WaitForEndOfFrame(); GameSetupReady(); }