public void shareText() { SoundFXPlayer.PlayClickSFX(); //execute the below lines if being run on a Android device #if UNITY_ANDROID string subject = "Helios"; string body = "I scored " + ScoreController.scoreInt + " points in Helios! Get it on the play store and try to beat me. \n\n http://www.play.google.com/store/apps/details?id=xyz.mattpowell.helios"; //Refernece of AndroidJavaClass class for intent AndroidJavaClass intentClass = new AndroidJavaClass("android.content.Intent"); //Refernece of AndroidJavaObject class for intent AndroidJavaObject intentObject = new AndroidJavaObject("android.content.Intent"); //call setAction method of the Intent object created intentObject.Call <AndroidJavaObject> ("setAction", intentClass.GetStatic <string> ("ACTION_SEND")); //set the type of sharing that is happening intentObject.Call <AndroidJavaObject> ("setType", "text/plain"); //add data to be passed to the other activity i.e., the data to be sent intentObject.Call <AndroidJavaObject> ("putExtra", intentClass.GetStatic <string> ("EXTRA_SUBJECT"), subject); intentObject.Call <AndroidJavaObject> ("putExtra", intentClass.GetStatic <string> ("EXTRA_TEXT"), body); //get the current activity AndroidJavaClass unity = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); AndroidJavaObject currentActivity = unity.GetStatic <AndroidJavaObject> ("currentActivity"); //start the activity by sending the intent data currentActivity.Call("startActivity", intentObject); #elif UNITY_IOS diffusion.Share("I scored " + ScoreController.scoreInt + " points in Helios! Can you beat me?", "https://itunes.apple.com/us/app/helios-orbital-escape/id1073325324?ls=1&mt=8", null); #endif }
IEnumerator TransitionToGameScene() { SoundFXPlayer.PlayClickSFX(); yield return(new WaitForSeconds(1f)); SceneManager.LoadScene("Game"); }
public void ReplayGame() { SoundFXPlayer.PlayClickSFX(); Reset(); StartCoroutine(TransitionToGameScene()); gameOverMenuAnim.Play("UIFastFadeOut"); BlackCoverScreen.GetComponent <Animator> ().Play("TransitionFastFadeIn"); }
/*public void DisplaySettingsUI () * { * SettingsMenuUIGroup.GetComponent<Animator> ().Play ("HalfSlideUp"); * homeMenuAnim.Play ("HomeMenuFadeOut"); * earth.GetComponent<Animator> ().Play ("HalfColor"); * player.GetComponent<Animator> ().Play ("HalfColor"); * HomeMenuUIGroup.interactable = false; * HomeMenuUIGroup.blocksRaycasts = false; * SettingsMenuUIGroup.interactable = true; * SettingsMenuUIGroup.blocksRaycasts = true; * * settingsMenuIsOpen = true; * } * * public void HideSettingsUI () * { * SettingsMenuUIGroup.GetComponent<Animator> ().Play ("HalfSlideDown"); * homeMenuAnim.Play ("HomeMenuFadeIn"); * earth.GetComponent<Animator> ().Play ("FullColor"); * player.GetComponent<Animator> ().Play ("FullColor"); * HomeMenuUIGroup.interactable = true; * HomeMenuUIGroup.blocksRaycasts = true; * SettingsMenuUIGroup.interactable = false; * SettingsMenuUIGroup.blocksRaycasts = false; * * settingsMenuIsOpen = false; * }*/ public void DisplayAboutUI() { AboutMenuUIGroup.GetComponent <Animator> ().Play("SlideUp"); homeMenuAnim.Play("HomeMenuFadeOut"); earth.GetComponent <Animator> ().Play("HalfColor"); player.GetComponent <Animator> ().Play("HalfColor"); HomeMenuUIGroup.interactable = false; HomeMenuUIGroup.blocksRaycasts = false; AboutMenuUIGroup.interactable = true; AboutMenuUIGroup.blocksRaycasts = true; aboutMenuIsOpen = true; SoundFXPlayer.PlayClickSFX(); }
public void ToggleMusic() //When music toggle button is clicked { if (musicPref == 1) //If the music preference was previously true { PlayerPrefs.SetInt("allowMusicToPlay", 0); //set it to zero/false musicToggle.GetComponent <Image> ().sprite = musicOff; //Render Music off sprite } else if (musicPref == 0) //If the music preferebce was previously false { PlayerPrefs.SetInt("allowMusicToPlay", 1); //Set it to 1/true musicToggle.GetComponent <Image> ().sprite = musicOn; //Render Music on sprite } SoundFXPlayer.PlayClickSFX(); }
public void ShowAchievements() { #if UNITY_ANDROID if (PlayGamesPlatform.Instance.IsAuthenticated() == true) { PlayGamesPlatform.Instance.ShowAchievementsUI(); PlayerPrefs.SetInt("LoggedIn", 1); } else { PlayGamesPlatform.Instance.localUser.Authenticate((bool success) => { if (PlayGamesPlatform.Instance.IsAuthenticated() == true) { PlayGamesPlatform.Instance.ShowAchievementsUI(); PlayerPrefs.SetInt("LoggedIn", 1); } }); } #elif UNITY_IOS Social.ShowAchievementsUI(); #endif SoundFXPlayer.PlayClickSFX(); }