public void Init() { m_PlayerData = Load(); GameObject[] gos = GameObject.FindGameObjectsWithTag("spot"); foreach (GameObject go in gos) { spotObjects.Add(ColorEx.GetRainbow(go.name), go); } m_GoldObject = GameObject.Find("Button_Spot_Gold"); m_Slider = GameObject.Find("LeftTime").GetComponent <UISlider>(); m_SliderSprite = GameObject.Find("FG").GetComponent <UISprite>(); m_FeverSprite = GameObject.Find("fever").GetComponent <UISprite>(); m_BackGround = GameObject.Find("BackGround_Game"); m_OptionBGM = GameObject.Find("Option_BGM").GetComponent <UIToggle>(); m_OptionSound = GameObject.Find("Option_Sound").GetComponent <UIToggle>(); m_OptionBGM.value = m_PlayerData.BGM.ToBool(); m_OptionSound.value = m_PlayerData.Sound.ToBool(); GoIntro(); // GoHome(); #if !UNITY_EDITOR // PlayGamesPlatform.DebugLogEnabled = true; // PlayGamesPlatform.Activate(); // Social.localUser.Authenticate((bool success) => { // if ( success ) { // // } else { // PlayGamesPlatform.Instance.SignOut(); // } // }); #endif // Create a 320x50 banner at the top of the screen. BannerView bannerView = new BannerView( "ca-app-pub-4566735050109706/3877683272", AdSize.Banner, AdPosition.Bottom); // Create an empty ad request. AdRequest request = new AdRequest.Builder().Build(); // Load the banner with the request. bannerView.LoadAd(request); cStyle.normal.textColor = Color.white; cStyle.alignment = TextAnchor.MiddleRight; cStyle.fontSize = 30 * Screen.height / 720; gStyle.normal.textColor = Color.yellow; gStyle.alignment = TextAnchor.MiddleLeft; gStyle.fontSize = 30 * Screen.height / 720; m_Combo = this.gameObject.AddComponent <ComboSystem>(); isInitialize = true; }
void OnClick() { if (this.gameObject.name == "Button_Spot_Gold") { if (GameMain.Instance.m_GameState == GameState.READY) { GameMain.Instance.StartGame(); } GameMain.Instance.GetGold(); return; } switch (GameMain.Instance.m_GameState) { case GameState.READY: if (GameMain.Instance.m_curRainbow == ColorEx.GetRainbow(this.gameObject.name)) { // GameMain.Instance.m_Count ++; GameMain.Instance.Spot(this.gameObject); Camera.main.audio.PlayOneShot(rightClip); GameMain.Instance.StartGame(); } else { Camera.main.audio.PlayOneShot(wrongClip); GameMain.Instance.WrongSpot(); } break; case GameState.INGAME: if (GameMain.Instance.isFeverTime) { GameMain.Instance.Spot(this.gameObject); Camera.main.audio.PlayOneShot(rightClip); GameMain.Instance.RePositionSpots(); } else if (GameMain.Instance.m_curRainbow == ColorEx.GetRainbow(this.gameObject.name)) { if (GameMain.Instance.m_curRainbow == Rainbow.VIOLET) { GameMain.Instance.OneCycle(); } GameMain.Instance.Spot(this.gameObject); Camera.main.audio.PlayOneShot(rightClip); GameMain.Instance.RePositionSpots(); } else { Camera.main.audio.PlayOneShot(wrongClip); GameMain.Instance.WrongSpot(); } break; } }
public IEnumerator Fever() { Rainbow rainbow = ColorEx.GetRainbow(this.gameObject.name); while (GameMain.Instance.isFeverTime) { rainbow = ColorEx.Next(rainbow); sprite.color = ColorEx.GetColor(rainbow); particle.startColor = ColorEx.GetColor(rainbow); yield return(new WaitForSeconds(0.1f)); } }