void OnCollisionStay2D(Collision2D col) { if (outOfBoundsWithoutOrbit) { if (col.gameObject == GameScreenManager.leftWall || col.gameObject == GameScreenManager.rightWall || col.gameObject == GameScreenManager.bottomWall) { if (!coRoutineInProgress) { StartCoroutine(OutOfBoundsEndGameCheck()); coRoutineInProgress = true; } } if (col.gameObject == GameScreenManager.earth) { PlayerExplosion(); SoundFXPlayer.PlayCrashSFX(); GameScreenManager.playerHasCrashed = true; isOutOfBounds = true; #if UNITY_ANDROID PlayGamesPlatform.Instance.ReportProgress("CgkIja6x2owHEAIQDA", 100.0f, (bool success) => { }); #elif UNITY_IOS GameCenterPlatform.ShowDefaultAchievementCompletionBanner(true); Social.ReportProgress("xyz.mattpowell.helios.earthcrash", 100.0f, (bool success) => { }); #endif } } }
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"); }
void OnTriggerEnter2D(Collider2D col) { if (col.gameObject.name == "Player") { SoundFXPlayer.PlayCrashSFX(); PlayerController.PlayerExplosion(); GameScreenManager.playerHasCrashed = true; } }
void Awake() { if (instance == null) { instance = this; cachedTransform = transform; GameObject.DontDestroyOnLoad(gameObject); disabledAudioSources = new Stack <AudioSource>(); } else if (instance != null) { Destroy(gameObject); } }
/*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(); }
void Start() { if (instance != null) //if there are multiple music players running, delete any extras { Destroy(gameObject); } else //else let the single music player run entirely and mark it as the single instance { instance = this; GameObject.DontDestroyOnLoad(gameObject); } crashSFX = Resources.Load <AudioClip> ("Sounds/SFX/Crash"); clickSFX = Resources.Load <AudioClip> ("Sounds/SFX/UIClick"); SwooshSFX = Resources.Load <AudioClip> ("Sounds/SFX/Swoosh"); audioSource = instance.GetComponent <AudioSource> (); }
IEnumerator OutOfBoundsEndGameCheck() { playerCantOrbit = true; yield return(new WaitForSeconds(.33f)); if (player.position.x < GameScreenManager.dynamicMiddleOfScreen / 2 || player.position.x > GameScreenManager.dynamicMiddleOfScreen * 2) { GameScreenManager.playerHasCrashed = true; isOutOfBounds = true; if (!sfxHasPlayed) { SoundFXPlayer.PlaySwooshSFX(); sfxHasPlayed = true; } } playerCantOrbit = false; coRoutineInProgress = false; }
void Awake() { Debug.Log("Sound FX Player Awake: " + GetInstanceID()); if (instance) { Destroy(gameObject); print("Duplicate Sound FX Player " + GetInstanceID() + " self-destructing"); } else { instance = this; this.transform.SetParent(null); GameObject.DontDestroyOnLoad(gameObject); } if (Mute.soundFXMuted) { Destroy(gameObject); } }
public void destroySelectedPawns() { SoundFXPlayer sfx = FindObjectOfType <SoundFXPlayer>(); if (sfx) { sfx.pawnDestroyEffect(); } GameObject[] selectedObjects = GameObject.FindGameObjectsWithTag("Selected"); if (selectedObjects.Length > 0) { foreach (GameObject so in selectedObjects) { so.GetComponentInChildren <Pawn> ().destroyPawn(); } Board.numPawnsSelected = 0; board = FindObjectOfType <Board> (); if (!board.winCheck()) { gameManager.nextTurn(); } } }
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(); }
private void Awake() { SoundFXPlayer.SFX = this; }