IEnumerator LoadAsyncScene(SceneName sceneName) { LoadSceneResult result; AsyncOperation asyncLoad; try { asyncLoad = UnityEngine.SceneManagement.SceneManager.LoadSceneAsync(sceneName.ToString()); } catch (Exception e) { Debug.LogError(e); result = LoadSceneResult.Failed; OnSceneLoadEndedEvent?.Invoke(result, sceneName); yield break; } // Wait until the asynchronous scene fully loads. while (!asyncLoad.isDone) { OnSceneLoadPercentChangedEvent?.Invoke(asyncLoad.progress); yield return(null); } result = LoadSceneResult.Success; OnSceneLoadEndedEvent?.Invoke(result, sceneName); }
public void LoadNextScene(SceneName name) { switch (name) { case SceneName.Zero: SceneManager.LoadScene("0 Preload"); break; case SceneName.One: SceneManager.LoadScene("1 Intro"); break; case SceneName.Two: SceneManager.LoadScene("2 RDW Training"); break; case SceneName.Three: SceneManager.LoadScene("3 Calibration Training"); break; case SceneName.Four: SceneManager.LoadScene("4 Calibration"); break; case SceneName.Five: SceneManager.LoadScene("5 Walkthrough"); break; default: throw new ArgumentOutOfRangeException("name", name, null); } }
// Initializes the NPC if it is in the currently active scene, by activating its SpriteRenderer and BoxCollider, and setting the npcActiveInScene bool. // If it's not in the correct scene, disable the same members private void InitializeNPC() { // If the NPC's current scene is the same as the active scene, set thae NPC to active. Else, set it to inactive if (npcCurrentScene.ToString() == SceneManager.GetActiveScene().name) { // This method enables the spriteRenderer and boxCollider of the NPC in the scene SetNPCActiveInScene(); } else { // This method disables the spriteRenderer and boxCollider of the NPC in the scene SetNPCInactiveInScene(); } // Make sure the NPCs current scene is correct because it can be changing npcPreviousMovementStepScene = npcCurrentScene; // Get the NPC's current grid position npcCurrentGridPosition = GetGridPosition(transform.position); // Set the next Grid position and the target grid position to the current grid position npcNextGridPosition = npcCurrentGridPosition; npcTargetGridPosition = npcCurrentGridPosition; npcTargetWorldPosition = GetWorldPosition(npcTargetGridPosition); // Get the NPC's next world position npcNextWorldPosition = GetWorldPosition(npcCurrentGridPosition); }
public IEnumerator ChangeCoroutine(SceneName scene) { yield return(StartCoroutine(Fade.Instance().FadeOutCoroutine(1.0f, Color.black))); UnityEngine.SceneManagement.SceneManager.LoadScene(scene.String()); Fade.Instance().FadeIn(1.0f, Color.black); }
public static void SceneLoad(SceneName name) { scene = name; switch (name) { case SceneName.Title: UnityEngine.SceneManagement.SceneManager.LoadScene(TITLE_SCENE); break; case SceneName.Main: UnityEngine.SceneManagement.SceneManager.LoadScene(GACHA_SCENE); break; case SceneName.CreateUser: UnityEngine.SceneManagement.SceneManager.LoadScene(CREATE_USER_SCENE); break; case SceneName.LoginPresent: UnityEngine.SceneManagement.SceneManager.LoadScene(LOGIN_PRESENT_SCENE); break; case SceneName.EmmisionGacha: UnityEngine.SceneManagement.SceneManager.LoadScene(EMMISION_GACHA_SCENE); break; case SceneName.Dictionary: UnityEngine.SceneManagement.SceneManager.LoadScene(DICTIONARY_SCENE); break; case SceneName.Shopping: UnityEngine.SceneManagement.SceneManager.LoadScene(STONE_SHOPPING_SCENE); break; } }
protected override void OnUpdate() { SceneName sceneToLoad = SceneName.None; Entities.ForEach((Entity e, in ChangeScene changeScene) => { sceneToLoad = changeScene.Value; EntityManager.DestroyEntity(e); }).WithStructuralChanges().Run(); var gameState = GetSingleton <GameData>(); if (sceneToLoad == SceneName.Menu) { gameState.currentGameState = GameState.Menu; TryUnloadScene <GameSceneTag>(); LoadScene <MainMenuSceneTag>(); } else if (sceneToLoad == SceneName.Gameplay) { gameState.currentGameState = GameState.PreGame; TryUnloadScene <MainMenuSceneTag>(); LoadScene <GameSceneTag>(); } SetSingleton(gameState); }
/// <summary> /// Map and change the current sceneState to the recent loaded scene. /// </summary> /// <param name="sceneName"></param> private void ChangeSceneState(SceneName sceneName) { switch (sceneName) { case SceneName.Scene1: sceneStatesFSM.changeStateTo(scene1State); break; case SceneName.Scene2: sceneStatesFSM.changeStateTo(scene2State); break; case SceneName.Scene3: if (restartBtn) { restartBtn.SetActive(true); } sceneStatesFSM.changeStateTo(scene3State); break; case SceneName.Scene4: sceneStatesFSM.changeStateTo(scene4State); break; case SceneName.Scene5: sceneStatesFSM.changeStateTo(scene5State); break; default: break; } }
// Start is called before the first frame update void Start() { SceneFlag = false; GameFrag = false; GameOverFlag = false; StageNameInstance = instance.GetComponent <SceneName>(); PauseManager = GameObject.Find("PauseManager").GetComponent <PauseManager>(); WhiteFadeTrg = false; Result = GameObject.Find("ResultManager").GetComponent <ResultComponent>(); BGMManager.Instance.Play(TitleAndSelectBGM); //フェード初期処理 if (Fadeobj_In != null && Fadeobj_Out != null) { //Fadeobj.GetComponent<Canvas>().enabled = false; Fadeobj_Out.GetComponent <Canvas>().enabled = false; FadeAni_In = Fadeobj_In.GetComponent <FadeAnim>(); //FadeAni_Out = Fadeobj_Out.GetComponent<FadeAnim>(); FadeAni_Out = Fadeobj_Out.GetComponent <BubbleFadeOpe>(); } else { Debug.Log("Error"); } }
private void InitialiseNPC() { // Active in scene if (npcCurrentScene.ToString() == SceneManager.GetActiveScene().name) { SetNPCActiveInScene(); } else { SetNPCInactiveInScene(); } npcPreviousMovementStepScene = npcCurrentScene; // Get NPC Current Grid Position npcCurrentGridPosition = GetGridPosition(transform.position); // Set Next Grid Position and Target Grid Position to current Grid Position npcNextGridPosition = npcCurrentGridPosition; npcTargetGridPosition = npcCurrentGridPosition; npcTargetWorldPosition = GetWorldPosition(npcTargetGridPosition); // Get NPC WorldPosition npcNextWorldPosition = GetWorldPosition(npcCurrentGridPosition); }
private IEnumerator LoadSceneCor(SceneName sceneName, bool isFade, float waitTime) { // フェード指定があったらアニメーションする if (isFade) { yield return(StartCoroutine(FadeIn())); } doOnceSceneChange = false; var async = SceneManager.LoadSceneAsync(sceneName.ToString()); async.allowSceneActivation = false; // 時が止まっていることも考慮し、とりあえず戻す Time.timeScale = 1; yield return(new WaitForSecondsRealtime(waitTime)); doOnceSceneChange = true; async.allowSceneActivation = true; if (isFade) { yield return(StartCoroutine(FadeOut())); } }
internal void _OnEnter(TTransitionData data) { SceneName = transform.name; SceneName = SceneName.Replace(DELIMITER, ""); Root.SetActive(true); OnEnter(data); }
/// <summary> /// 初期化 /// </summary> protected override void Initialize() { // 音楽データの取得 audioManager = AudioManager.Instance; // BGMの再生 audioManager.PlayBGM(audioManager.BossSceneBGM.name); // フラグ初期化 PauseManager.isPause = false; // BossListsの子要素をすべて取得 bossTransforms = BossLists.GetComponentInChildren <Transform>(); // インスタンス取得 var sceneName = new SceneName(); // 挑戦したステージ名からステージ名リストの要素番号を取得する var activeBossNumber = Array.IndexOf(sceneName.STAGE_NAMES, ChallengeStageName); // bossTransformsの子要素の有効、無効の切り替えを行う for (int i = 0; i < bossTransforms.childCount; i++) { // 該当するBossを有効にする bossTransforms.GetChild(i).gameObject.SetActive(activeBossNumber == i); } }
public void SwitchScene(SceneName scene, SceneSwitchType type, float duration = 1.0f, float delay = 1.0f) { _sceneSwitch.SwitchEnter(type, duration); delay = duration + delay; StartCoroutine(IESwitchScene(scene, delay)); }
public static IBaseSceneState GetScene(SceneName scene) { IBaseSceneState state = null; SceneDict.TryGetValue(scene, out state); return(state); }
public void SetScene(SceneName scene) { if (SceneName.Ignore != scene) { this.scene1 = scene; } }
/// <summary> /// Builds a path for the given sceneName, from the startGridPosition to the endGridPosition, and adds movement steps to the passed in npcMovementStack (a stack of movement steps for the NPC to follow). /// Also returns true if a path is found, or false if no path found /// </summary> /// <param name="sceneName"></param> /// <param name="startGridPosition"></param> /// <param name="endGridPosition"></param> /// <param name="npcMovementStepStack"></param> /// <returns> Returns a bool true if a path is found, and false if not. The NPC movement steps are also passed into NPCMovementStepStack </returns> public bool BuildPath(SceneName sceneName, Vector2Int startGridPosition, Vector2Int endGridPosition, Stack <NPCMovementStep> npcMovementStepStack) { // Make sure pathFound always starts off as false, i.e. for when we call BuildPath a second time after it already found a path earlier! pathFound = false; // This method will populate all of the GridNodes array nodes with the isPath and isNPCObstacle properties from the GridPropertiesDictionary for this scene, and also set up // the starting/ending grid nodes, and the open/closed nodes lists. It will return true if this was successful. if (PopulateGridNodesFromGridPropertiesDictionary(sceneName, startGridPosition, endGridPosition)) { // If we successfully populated the GridNodes properties, Now we run the FindShortestPath algorithm which runs the AStar algorithm (add the startNode to the OpenNodeList, // loop through the openList until it's empty, sort the openList by fCost tie-broken by hCost, set the best-case to the currentNode (remove it from open list and add to closedList) // Then evaluate the new h/g/f costs of the 8 neighbors to the currentNode. Repeat until currentNode = targetNode, or openNodeList is empty. if (FindShortestPath()) { // If we've found a shortest path from startNode -> targetNode, we know that currentNode = targetNode. And currentNode's list of parent nodes // Will lead us back to the startNode. This method loops through all of the currentNodes parents back to the startNode, and adds each step // to the npcMovementStepStack, which NPCs will be able to follow UpdatePathOnNPCMovementStepStack(sceneName, npcMovementStepStack); // If we found a path, return true. Else, return false and no npcMovementStepStack gets updated return(true); } } return(false); }
public void ShowAds(SceneName sceneName) { showAds = true; Time.timeScale = 1f; Application.LoadLevel(sceneName.ToString()); }
public void GoToScene(SceneName name) { lastSceneState = currentSceneState; currentSceneState = SceneType.GetScene(name); currentSceneState.scene = name; ExitSceneComplete(); }
public void MainLobby() { SoundManager.Instance.play(LoadManager.Instance.GetSFXData(SFXType.Tabsound).clip, AudioSettings.dspTime + Time.deltaTime, 0F, 1F); string sceneName = SceneName.GetMainLobby(GameManager.Instance.LocalPlayer.playerInfo.Race); TransitionManager.Instance.OnSceneTransition(sceneName, TransitionType.Loading01_Blank, null); }
public void LoadScene(SceneName sceneName, int level = 0) { _zenjectSceneLoader.LoadScene(sceneName.ToString(), LoadSceneMode.Single, container => { container.BindInstance(level); }); }
/// <summary> /// 指定した名前でシーンを追加する /// </summary> /// <param name="sceneName">シーンの名前</param> /// <param name="sceneInstance">対応するシーンのインスタンス</param> public static void AddScene(SceneName sceneName, IScene sceneInstance) { if (!Scenes.ContainsKey(sceneName)) { Scenes.Add(sceneName, sceneInstance); } }
private bool PopulateGridNodesFromGridPropertiesDictionary(SceneName sceneName, Vector2Int startGridPosition, Vector2Int endGridPosition) { // Get grid properties dictionary for the scene // SceneSave sceneSave; // if (GridPropertiesManager.Instance.GameObjectSave.sceneData.TryGetValue(sceneName.ToString(), out sceneSave)) // { // Get Dict grid property details // if (sceneSave.gridPropertyDetailsDictionary != null) // { // Get grid height and width if (GridPropertiesManager.Instance.GetGridDimensions(sceneName, out Vector2Int gridDimensions, out Vector2Int gridOrigin)) { // Create nodes grid based on grid properties dictionary gridNodes = new GridNodes(gridDimensions.x, gridDimensions.y); gridWidth = gridDimensions.x; gridHeight = gridDimensions.y; originX = gridOrigin.x; originY = gridOrigin.y; // Create openNodeList openNodeList = new List <Node>(); // Create closed Node List closedNodeList = new HashSet <Node>(); }
/// <summary> /// Will find and move to Prioritized Scene's based on Scene SNOId or Name /// </summary> /// <returns></returns> private Composite PrioritySceneCheck() { return (new Decorator(ret => !(SceneId == 0 && String.IsNullOrEmpty(SceneName.Trim())), new Sequence( new DecoratorContinue(ret => DateTime.Now.Subtract(lastCheckedScenes).TotalMilliseconds > 1000, new Sequence( new Action(ret => lastCheckedScenes = DateTime.Now), new Action(ret => FindPrioritySceneTarget()) ) ), new Decorator(ret => PrioritySceneTarget != Vector3.Zero, new PrioritySelector( new Decorator(ret => PrioritySceneTarget.Distance2D(myPos) <= PathPrecision, new Sequence( new Action(ret => Logger.DBLog.DebugFormat("Successfully navigated to priority scene {0} {1} center {2} Distance {3:0}", CurrentPriorityScene.Name, CurrentPriorityScene.SceneInfo.SNOId, PrioritySceneTarget, PrioritySceneTarget.Distance2D(myPos))), new Action(ret => isDone = true) ) ), new Action(ret => MoveToPriorityScene()) ) ) ) )); }
public void SetCurrentScene(SceneName sceneName) { var scene = UnitySceneManager.GetSceneByName(sceneName.ToString()); UnitySceneManager.SetActiveScene(scene); loadedSceneNames.Add(sceneName.ToString()); }
/// <summary> /// Given a sceneName, this method returns true and two Vector2Ints with the grid dimensions and origin for that scene, or false and Vector2Int.zero's if the scene was not found /// </summary> public bool GetGridDimensions(SceneName sceneName, out Vector2Int gridDimensions, out Vector2Int gridOrigin) { // Start off with 0 grid dimensions and origin, to e changed if we found a scene with that sceneName gridDimensions = Vector2Int.zero; gridOrigin = Vector2Int.zero; // Loop through all of the scenes foreach (SO_GridProperties so_GridProperties in so_gridPropertiesArray) { // If we find a scene with the given sceneName, populate the corresponding grid dimensions and origin and return true if (so_GridProperties.sceneName == sceneName) { gridDimensions.x = so_GridProperties.gridWidth; gridDimensions.y = so_GridProperties.gridHeight; gridOrigin.x = so_GridProperties.originX; gridOrigin.y = so_GridProperties.originY; return(true); } } // If we didn't find that scene name, return false and keep the dimensions and origin as 0 return(false); }
public void RealLoadScene(SceneName name, PanelLoading ui) { ui.SetUI(LoadingType.Scene); AsyncOperation op = null; Action callback = () => { }; switch (name) { case SceneName.A_SceneEnter: break; case SceneName.B_SceneLoading: op = SceneManager.LoadSceneAsync("B_SceneLoading"); callback = OnEnterSceneLoading; break; case SceneName.C_SceneLogin: op = SceneManager.LoadSceneAsync("C_SceneLogin"); callback = OnEnterSceneLogin; break; case SceneName.D_SceneGameInit: break; case SceneName.E_SceneGame_1: op = SceneManager.LoadSceneAsync("E_SceneGame_1"); callback = OnEnterSceneGame1; break; case SceneName.F_SceneGame_2: break; } StartCoroutine(Loading(op, callback, ui)); }
private void LoadScoreAttack(SceneName sceneName, LoadType loadType) { _gameTypeUseCase.SetGameType(GameType.ScoreAttack); _levelView.SetMaxStageCount(GameConfig.STAGE_COUNT); _levelView.SetPlayLevelUpSe(true); switch (loadType) { case LoadType.Direct: case LoadType.Reload: { var level = _levelUseCase.GetLevel(); LoadSceneAsync(GameType.ScoreAttack, sceneName, level, _tokenSource.Token).Forget(); break; } case LoadType.Next: { var nextLevel = _levelUseCase.GetNextLevel(); if (nextLevel < GameConfig.STAGE_COUNT) { _levelUseCase.CountUp(); LoadSceneAsync(GameType.ScoreAttack, sceneName, nextLevel, _tokenSource.Token).Forget(); } else { LoadSceneAsync(GameType.ScoreAttack, SceneName.Ranking, 0, _tokenSource.Token).Forget(); } break; } default: throw new ArgumentOutOfRangeException(nameof(loadType), loadType, null); } }
public void LoadScene(SceneName scene) { if (!isLoading) { StartCoroutine(LoadSceneWithTransition(scene)); } }
/// <summary> /// シーン遷移 /// </summary> /// <param name="sceneName">シーン名</param> public void ChangeScene(SceneName name) { StartCoroutine(Fade(name)); var eventSystem = FindObjectOfType <EventSystem>(); eventSystem.enabled = false; }
private async Task <bool> Moving() { if (AdvDia.CurrentWorldScene.Name.ToLower().Contains(SceneName.ToLower())) { State = States.Completed; return(false); } if (_zergEnabled) { SafeZerg.Instance.EnableZerg(); } if (await NavigationCoroutine.MoveTo(_objectiveLocation, 10)) { if (AdvDia.MyPosition.Distance(_objectiveLocation) > 30 && NavigationCoroutine.LastResult == CoroutineResult.Failure && _failureCount < 10) { _failureCount++; _previouslyFoundLocation = _objectiveLocation; _returnTimeForPreviousLocation = PluginTime.CurrentMillisecond; _objectiveLocation = Vector3.Zero; _objectiveScanRange = Math.Max(ActorFinder.LowerSearchRadius(_objectiveScanRange), 250); Core.Logger.Log($"Search Radius changed to {_objectiveScanRange}"); State = States.Searching; return(false); } State = States.Completed; return(false); } return(false); }
public void TransitionToScene (SceneName scenename) { m_NextLevel = scenename; if (transitionState == TransitionEvent.None) { transitionState = TransitionEvent.onCloseTransition; } CloseScene (); // LoadScene() in animation //OpenScene() in update }
void Update () { if (Application.loadedLevelName == m_NextLevel.ToString () && m_CurrentLevel != m_NextLevel) { //GameManager.resetScore(); OpenScene (); m_CurrentLevel = m_NextLevel; } }
public void SceneChange(SceneName sceneName, Color fadeColor, float fadeSpeed = 0.05f) { if(isLock == false) { speed = fadeSpeed; col = fadeColor; StartCoroutine(FadeIn(sceneName.ToString(), fadeSpeed, fadeColor)); } }
public void SetScene(int sc) { Debug.Log("Calling scene " + sc); Debug.Log("Switch " + sceneName); switch (sceneName) { case SceneName.Eart: if(sc!=0) DisappearEarth(); Debug.Log("Dissapear earth "); break; case SceneName.SlicedEarth: Debug.Log("Dissapear slicedearth "); if (sc != 1) DisappearSlicedEarth(); break; case SceneName.Translacion: Debug.Log("Dissapear translacion "); if (sc != 2) DisappearTranslacion(); break; case SceneName.Eclipses: Debug.Log("Dissapear translacion "); if (sc != 3) DisappearEclipses(); break; case SceneName.None: break; } foreach (GameObject g in GameObject.FindGameObjectsWithTag("GUI")) { g.GetComponent<Canvas>().enabled=false; g.GetComponent<GraphicRaycaster>().enabled =false; } switch (sc) { case 0: // AppearEarth(); EarthGUI.GetComponent<Canvas>().enabled=true; EarthGUI.GetComponent<GraphicRaycaster>().enabled =true; sceneName = SceneName.Eart; break; case 1: // AppearSlicedEarth(); sceneName = SceneName.SlicedEarth; break; case 2: // AppearTranslacion(); sceneName = SceneName.Translacion; break; case 3: // AppearTranslacion(); sceneName = SceneName.Eclipses; break; } }
public void SceneChange(SceneName sceneName, float fadeSpeed = 0.05f) { SceneChange(sceneName, new Color(0, 0, 0, 0), fadeSpeed); }
public void AddScene(SceneName sceneName) { SceneManager.LoadScene(sceneName.ToString(), LoadSceneMode.Additive); }
public int GetPort(SceneName scene) { return (int)scene; }
/// <summary> /// 切換到場景 /// </summary> public static void ChangeScene(SceneName _name) { AsyncOperation async = Application.LoadLevelAsync(_name.ToString()); }
public static string GetLevelName(SceneName _name) { string name = string.Empty; switch (_name) { case SceneName.page0: name = "page0"; break; case SceneName.page1: name = "page1"; break; case SceneName.page2: name = "page2"; break; case SceneName.page3: name = "page3"; break; case SceneName.page4: name = "page4"; break; case SceneName.page5: name = "page5"; break; case SceneName.page7: name = "page7"; break; case SceneName.page8: name = "page8"; break; case SceneName.page9: name = "page9"; break; case SceneName.page11: name = "page11"; break; case SceneName.page14: name = "page14"; break; case SceneName.page15: name = "page15"; break; case SceneName.page17: name = "page17"; break; case SceneName.page18: name = "page18"; break; case SceneName.page19: name = "page19"; break; case SceneName.page20: name = "page20"; break; case SceneName.page21: name = "page21"; break; case SceneName.page24: name = "page24"; break; case SceneName.page27: name = "page27"; break; default: break; } return name; }