public IEnumerator SetupStream(DressupData _data, Vector2Int _size) { while (LoadManager.Instance.IsLoading) { yield return(null); } LoadManager.Instance.IsLoading = true; Data = _data; Size = _size; yield return(null); BackgroundScale _backgroundScale = Instantiate(Data.BackgroundPrefab); Map = new int[_size.x, _size.y]; for (int x = 0; x < _size.x; x++) { for (int y = 0; y < _size.y; y++) { Map[x, y] = -1; } } yield return(null); _backgroundScale.SetSize(_size); Hakos = new HakoAnimation[1 + hakoMaxs * 4]; Hakos[0] = Instantiate(Data.X_Prefab); for (int i = 0; i < 4; i++) { yield return(null); HakoAnimation temp = Data.A_Prefab; if (i == 1) { temp = Data.B_Prefab; } if (i == 2) { temp = Data.C_Prefab; } if (i == 3) { temp = Data.D_Prefab; } for (int j = 0; j < hakoMaxs; j++) { Hakos[i * hakoMaxs + j + 1] = Instantiate(temp); } } LoadManager.Instance.IsLoading = false; }
public void Set(DressupData _data, Vector2Int _size) { dressupData = _data; Size = _size; }
IEnumerator Start() { if (Instance) { Destroy(gameObject); yield break; } Instance = this; if (DressUpSelecter.Instance) { HakoData = DressUpSelecter.Instance.Datas[DressUpSelecter.Current]; } DontDestroyOnLoad(gameObject); if (SceneName != "") { yield return(LoadManager.Instance.LoadSceneAsync(SceneName)); } UnityEngine.SceneManagement.SceneManager.MoveGameObjectToScene(gameObject, UnityEngine.SceneManagement.SceneManager.GetActiveScene()); GameManager.Instance.GameState = GameManager.State.Game; SurvivalUI.Instance.Result.SetActive(false); Camera.main.orthographicSize = Data.CameraSize; yield return(null); SurvivalUI.Instance.ScoreDisplay.Value = 0; SurvivalUI.Instance.LevelDisplay.Value = 0; SurvivalUI.Instance.ModeName = ModeName; while (!HakoManaer.Instance) { yield return(null); } HakoManaer.Instance.hakoMaxs = Data.MaxHakos; yield return(HakoManaer.Instance.SetupStream(HakoData, Data.Size)); SurvivalUI.Instance.Meter.Set(HakoData, Data.Size); ScreenCurtain.Instance.SetColor(ScreenCurtain.State.Open); HakoManaer.Instance.AddHako(HakoType.X, Data.Size / 2); SurvivalUI.Instance.Meter.MaxHakos(Data.LevelUpScore[0]); SwipeMessage.Play("Ready...", new Vector3(), 56, 0.5f); yield return(new WaitForSeconds(1.0f)); GamePlaying = true; SwipeMessage.Play("Go!", new Vector3(), 56, 0.5f); while (!Result) { HakoUpdate(); yield return(null); if (Input.GetKey(KeyCode.Return)) { AddHakoRandom(); } else { yield return(new WaitForSeconds(1.0f)); } } SwipeMessage.Play("GameOver!", new Vector3(), 56, 30.0f); // SurvivalUI.Instance.UserNameText.text = ScoreManager.Instance.PlayerName; SurvivalUI.Instance.UserName = ""; SurvivalUI.Instance.Result.SetActive(true); SoundManager.SEPlay("over"); UnityEngine.EventSystems.EventSystem.current.SetSelectedGameObject(SurvivalUI.Instance.ExitButton.gameObject); // ScoreContent _load = ScoreManager.Instance.LoadScore(ModeName); // if(Score > _load.Score) // { // SwipeMessage.Play("New Record!", new Vector3(0, -1, 0), 28, 30.0f); // ScoreManager.Instance.SaveScore(ModeName, new ScoreContent(Score)); // } NCMB.HighScore myScore = new NCMB.HighScore(ModeName, ScoreManager.Instance.UserName.Id, ScoreManager.Instance.UserName.Name); myScore.fetch(); for (int i = 0; i < Data.Size.x * Data.Size.y - 10; i++) { yield return(null); AddHakoRandom(); } while (myScore.Score == -1) { yield return(null); } if (myScore.Score < Score) { myScore.Score = Score; myScore.Date = ScoreManager.Instance.DateString(); myScore.Name = ScoreManager.Instance.UserName.Name; myScore.save(); SwipeMessage.Play("New Record!", new Vector3(0, -1, 0), 28, 30.0f); } yield return(new WaitForSeconds(1.0f)); SurvivalUI.Instance.ScoreButton.interactable = true; }