void Start() { RectTf = GetComponent <RectTransform>(); OriginalPosition = new Vector2(RectTf.anchoredPosition.x, RectTf.anchoredPosition.y); switch (PushingDirection) { case ePushDirection.NORTH: MovingDir = Vector2.up; break; case ePushDirection.EAST: MovingDir = Vector2.right; break; case ePushDirection.WEST: MovingDir = Vector2.left; break; case ePushDirection.SOUTH: MovingDir = Vector2.down; break; } ; StartCoroutine(Yielder.GetCoroutine(() => { CrosshairCoroutines[0] = StartCoroutine(_SpreadCrosshair()); CrosshairCoroutines[1] = StartCoroutine(_CloseCrosshair()); }, 0.5f)); }
void Start() { GameObject player = default; if (Utils.IsNull(PlayerSync.LocalPlayerInst)) { player = PhotonNetwork.Instantiate("Player", new Vector3(0.0f, 50.0f, 150.0f), Quaternion.identity); player.name = "LocalPlayer"; LogicEventListener.Invoke(eEventType.FOR_ALL, eEventMessage.ON_LOCAL_PLAYER_CREATED, player); } // Preload all the required scenes for the stage1. //AsyncOperation[] additionalSceneStatus = new AsyncOperation[2]{ // SceneManager.LoadSceneAsync("ChatUI", LoadSceneMode.Additive), // SceneManager.LoadSceneAsync("MenuUI", LoadSceneMode.Additive) //}; SceneManager.LoadScene("ChatUI", LoadSceneMode.Additive); SceneManager.LoadScene("MenuUI", LoadSceneMode.Additive); Scenes[0] = SceneManager.GetSceneAt(1); Scenes[1] = SceneManager.GetSceneAt(2); // GetRootGameObjects works properly after the scene has been fully loaded! StartCoroutine(Yielder.GetCoroutine(() => { Scenes[0].GetRootGameObjects(ChatSceneGOs); SwitchChatUI(false); Scenes[1].GetRootGameObjects(MenuSceneGOs); SwitchMenuUI(false); }, 0.25f)); }
IEnumerator _ScreenFill() { float alpha = Image.color.a; IsMovingNextScene = false; while (alpha <= 1.0f && false == IsMovingNextScene) { alpha += AlphaIncrease * Time.deltaTime; Image.color = new Color(Image.color.r, Image.color.g, Image.color.b, alpha); yield return(Yielder.GetCoroutine(0.03f)); } IsMovingNextScene = true; LogicEventListener.Invoke(eEventType.FOR_SYSTEM, eEventMessage.FADER_FULLY_APPEARED); }
IEnumerator _SplashImageAppear() { float alpha = Image.GetAlpha(); while (alpha <= 1.0f && false == IsFullyAppeared) { alpha += AlphaIncrease * Time.deltaTime; Image.SetAlpha(alpha); yield return(Yielder.GetCoroutine(0.05f)); } LogicEventListener.Invoke(eEventType.FOR_ALL, eEventMessage.SPLASH_FULLY_APPEARED); // 한번만 실행되도록 보장. // Make secured this logic executes once. if (false == IsFullyAppeared) { IsFullyAppeared = true; } }
void Start() { Dbg.LogCheckAssigned(PlayerPf, this); //if (Application.isEditor) //{ // var loadedLevel = SceneManager.GetSceneByName("Stage1"); // if (true == loadedLevel.isLoaded) // { // SceneManager.SetActiveScene(loadedLevel); // } //} if (Utils.IsNull(WeaponView.LocalPlayerInst) && Utils.IsNull(HealthView.LocalPlayerInst)) { var player = PhotonNetwork.Instantiate(PlayerPf.name, new Vector3(0.0f, 50.0f, 150.0f), Quaternion.identity); player.name = "Player"; } // Preload all the required scenes for the stage1. //AsyncOperation[] additionalSceneStatus = new AsyncOperation[2]{ // SceneManager.LoadSceneAsync("ChatUI", LoadSceneMode.Additive), // SceneManager.LoadSceneAsync("MenuUI", LoadSceneMode.Additive) //}; SceneManager.LoadScene("ChatUI", LoadSceneMode.Additive); SceneManager.LoadScene("MenuUI", LoadSceneMode.Additive); Scenes[0] = SceneManager.GetSceneAt(1); Scenes[1] = SceneManager.GetSceneAt(2); // GetRootGameObjects works properly after the scene has been fully loaded! StartCoroutine(Yielder.GetCoroutine(() => { Scenes[0].GetRootGameObjects(ChatSceneGOs); SwitchChatUI(false); Scenes[1].GetRootGameObjects(MenuSceneGOs); SwitchMenuUI(false); }, 0.25f)); }
IEnumerator _UpdateTimeVariables() { while (true) { if (RemainingTime > 0.0f) { RemainingTime -= 1.0f; } else { Dbg.Log($"Remaining Time is zero! Coroutine finished~", this); // TODO: change this coroutine repeatedly turns on and off. break; } ElapsedTime += 1.0f; float timeLeftRatio = RemainingTime / InitialRemainingTime; LogicEventListener.Invoke(eEventType.FOR_UI, eEventMessage.ON_REMAINING_TIME_CHANGED, (object)timeLeftRatio); yield return(Yielder.GetCoroutine(1.0f)); } }