public void DragboxOnEnd(bool bl) { isHoldingDragBox = false; SendRaycast(); if (isOnHower) { //Right place if (bl) { //Right word HoverText.text = selectedDragBox.GetComponentInChildren <Text>().text; selectedDragBox.SetActive(false); if (PlayerPrefs.GetInt("VIBRATION") == 1) { TapticManager.Impact(ImpactFeedback.Light); } StartCoroutine(WaitAndOpenWinPanel()); } else {//Wrong word if (PlayerPrefs.GetInt("VIBRATION") == 1) { TapticManager.Impact(ImpactFeedback.Medium); } WrongPanel.GetComponent <Animation>().Play(); StartCoroutine(WaitAndOpenLosePanel()); } } else {//Wrong place selectedDragBox.transform.position = firstRectTransform.transform.position; } }
public void CheckArrestSuccess() { Debug.Log("Checking Arrest..."); Debug.Log(ArrestUIPointer.transform.eulerAngles.z); RoomConfigurations[selectedRoom].SearchCamera.GetComponent <Animator>().SetTrigger("TryArrest"); if (ArrestUIPointer.transform.eulerAngles.z > 0 && ArrestUIPointer.transform.eulerAngles.z < 16 || ArrestUIPointer.transform.eulerAngles.z < 360 && ArrestUIPointer.transform.eulerAngles.z > 344) { ArrestUI.GetComponent <Animator>().enabled = false; StartCoroutine(WaitAndArrest()); } else { Debug.Log("Arrest unsuccessfull!"); if (ArrestTryCount >= 2) { // FAİL FailPanel.SetActive(true); TapticManager.Impact(ImpactFeedback.Medium); SoundManager.Instance.playSound(SoundManager.GameSounds.Lose); } else { Debug.Log("Try Again"); RoomConfigurations[selectedRoom].SearchCamera.GetComponent <Animator>().SetTrigger("ArrestFail"); ArrestUI.GetComponent <Animator>().SetTrigger("Start"); ArrestTryCount++; } } }
public void LoseLive() { live--; SoundManager.Instance.StopAllSounds(); SoundManager.Instance.playSound(SoundManager.GameSounds.LiveLose); if (PlayerPrefs.GetInt("VIBRATION") == 1) { TapticManager.Impact(ImpactFeedback.Light); } switch (live) { case 2: LiveImages[0].gameObject.SetActive(true); break; case 1: LiveImages[1].gameObject.SetActive(true); break; case 0: LiveImages[2].gameObject.SetActive(true); break; default: break; } }
private void OnTriggerEnter2D(Collider2D collision) { // if the ball hits the coin if (collision.gameObject == gm.ballCoinCollider) { TapticManager.Impact(ImpactFeedback.Light); // if coinCount is being tracked (via a daily challenge), add one more to the count. if (PlayerPrefs.GetInt("trackCoinAmount", 1) == 0) { PlayerPrefs.SetInt("coinsGathered", PlayerPrefs.GetInt("coinsGathered", 0) + 1); } CoinParticle(this.transform); startTrackingPos = true; StartCoroutine("CoinCollect"); coinTrail = Instantiate(coinTrailPrefab, this.transform); } // if the ball has an active Coin Magnet if (collision.gameObject.GetComponent <coinMagnet_Controller>() != null) { inCoinMagnetRadius = true; StartCoroutine("CoinMagnetCollect"); } }
private void OnTriggerEnter(Collider other) { if (other.CompareTag("ScoreTrigger")) { if (GameManager.Instance.isGameStarted) { other.GetComponentInChildren <ParticleSystem>().Play(); } GameManager.Instance.AddScore(); } else if (other.CompareTag("Obstacle") && !isPowerUpActive) { Debug.Log("hit"); if (PlayerPrefs.GetInt("VIBRATION") == 1) { TapticManager.Impact(ImpactFeedback.Medium); } SoundManager.Instance.playSound(SoundManager.GameSounds.Hit); Instantiate(playerExplotionPrefab, transform.position, Quaternion.identity); GameManager.Instance.GameLose(); Destroy(gameObject); } else if (other.CompareTag("PowerUp")) { Debug.Log(other); currentSpeed = normalSpeed * 2; GameManager.Instance.currentLevelObject.GetComponent <LevelObject>().speed *= 2; GetComponent <MeshRenderer>().material = PowerUpMaterial; Destroy(other.gameObject); isPowerUpActive = true; StartCoroutine(WAitAndDeactivatePowerUp()); } }
public static void Notification(NotificationFeedback notificationFeedback) { #if UNITY_IOS TapticManager.Notification(notificationFeedback); #elif UNITY_ANDROID AndroidHapticManager.Notification(notificationFeedback); #endif }
public static void Selection() { #if UNITY_IOS TapticManager.Selection(); #elif UNITY_ANDROID AndroidHapticManager.Selection(); #endif }
public static void Impact(ImpactFeedback impactFeedback) { #if UNITY_IOS TapticManager.Impact(impactFeedback); #elif UNITY_ANDROID AndroidHapticManager.Impact(impactFeedback); #endif }
public void RestartButton() { if (PlayerPrefs.GetInt("onOrOffVibration") == 1) { TapticManager.Impact(ImpactFeedback.Light); } SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); }
public void ChangeState() { TouchPhase touch; Ray ray; RaycastHit hit; if (Input.touchCount > 0) { if (stateManager.currentState == state.Game) { ray = Camera.main.ScreenPointToRay(Input.GetTouch(0).position); touch = Input.GetTouch(0).phase; if (Physics.Raycast(ray, out hit)) { if (hit.transform.tag == "Background") { switch (touch) { case TouchPhase.Began: if (!IsPointerOverUIObject()) { TapticManager.Impact(ImpactFeedback.Light); if (currentState == State.Paused || currentState == State.Continue) { //currentState = State.Active; ResetGame(); } else { currentState = State.Start; currentState = State.Reset; // ResetGame and FullReset } } break; case TouchPhase.Moved: case TouchPhase.Stationary: break; case TouchPhase.Ended: currentState = State.Dead; break; default: //currentState = State.Fresh; break; } } } } } if (Input.touchCount > 1) { currentState = State.Reset; } }
void Win() { for (int i = 0; i < 3; i++) { TapticManager.Impact(ImpactFeedback.Medium); } BallFactory.Instance.Stop(); UIController.Instance.ShowWin(); player.isActive = false; timeManager.DoSlowMotion(); }
public static void Vibrate(ImpactFeedback feedback) { if (Utility.IsOldIphone || !GameData.IsVibrationOn) { return; } if (Application.platform == RuntimePlatform.IPhonePlayer) { TapticManager.Impact(feedback); } }
public void TapToNextButtonClick() { if (PlayerPrefs.GetInt("VIBRATION") == 1) { TapticManager.Impact(ImpactFeedback.Light); } PlayerPrefs.SetInt("UseMenu", 0); InitializeLevel(); GameWinPanel.SetActive(false); isGameStarted = true; isGameOver = false; ChangeColor(currentColor++); }
public void WrongImageClicked() { if (PlayerPrefs.GetInt("VIBRATION") == 1) { TapticManager.Impact(ImpactFeedback.Medium); } if (isTexting) { lastText.GetComponent <Animator>().enabled = false; lastText.GetComponent <Image>().sprite = falseSprite; } StartCoroutine(WaitAndOpenLosePanel()); }
IEnumerator WaitAndGameLose() { //SoundManager.Instance.StopAllSounds(); SoundManager.Instance.playSound(SoundManager.GameSounds.Lose); yield return(new WaitForSeconds(.5f)); if (PlayerPrefs.GetInt("VIBRATION") == 1) { TapticManager.Impact(ImpactFeedback.Light); } cubeManager.CloseAllCubeScripts(); LosePanel.SetActive(true); //InGamePanel.SetActive(false); }
public static void SelectionHaptic() { if (SystemInfo.supportsVibration) { if (isAndroid()) { //any for now } else { TapticManager.Selection(); } } }
public static void Vibrate(HapticIntensity intensity) { if (GameplayController.HAPTIC == false) { return; } #if UNITY_IPHONE && !UNITY_EDITOR switch (intensity) { case HapticIntensity.Light: { TapticManager.Impact(ImpactFeedback.Light); break; } case HapticIntensity.Medium: { TapticManager.Impact(ImpactFeedback.Midium); break; } case HapticIntensity.Heavy: { TapticManager.Impact(ImpactFeedback.Heavy); break; } } #else switch (intensity) { case HapticIntensity.Light: { Vibration.Vibrate(3); break; } case HapticIntensity.Medium: { Vibration.Vibrate(5); break; } case HapticIntensity.Heavy: { Vibration.Vibrate(7); break; } } #endif }
public IEnumerator WaitAndGameLose() { SoundManager.Instance.playSound(SoundManager.GameSounds.Lose); yield return(new WaitForSeconds(1f)); if (PlayerPrefs.GetInt("VIBRATION") == 1) { TapticManager.Impact(ImpactFeedback.Light); } LosePanel.SetActive(true); //InGamePanel.SetActive(false); }
void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Enemy") { hitPoints--; if (hitPoints == 0) { roundManager.KillPlayer(); audioSource.PlayOneShot(audioDeath); Instantiate(bloodSplatter, transform.position, Quaternion.identity); TapticManager.Notification(NotificationFeedback.Error); } } }
IEnumerator ObstacleTimer() { if (PlayerPrefs.GetInt("onOrOffVibration") == 1) { TapticManager.Impact(ImpactFeedback.Light); } IsStart = false; transform.GetComponent <Animator>().SetTrigger("FallBack"); rb.velocity = Vector3.zero; transform.DOMove(new Vector3(transform.position.x, transform.position.y, transform.position.z - 5), 1); yield return(new WaitForSeconds(1f)); IsStart = true; transform.GetComponent <Animator>().SetTrigger("NoShoulder"); }
public void VibrateButtonClick() { if (PlayerPrefs.GetInt("VIBRATION").Equals(1)) {//Vibration is on PlayerPrefs.SetInt("VIBRATION", 0); VibrationButton.GetComponent <Image>().sprite = off; } else {//Vibration is off PlayerPrefs.SetInt("VIBRATION", 1); VibrationButton.GetComponent <Image>().sprite = on; } TapticManager.Impact(ImpactFeedback.Light); }
IEnumerator StartPhysics(Rigidbody rb, float delayTime) { yield return(new WaitForSeconds(delayTime)); SceneManager.SetActiveScene(SceneManager.GetSceneByName(SceneConstants.Levels[ActiveLevel].Id)); playerRigidbody.isKinematic = false; player.isActive = true; TapticManager.Impact(ImpactFeedback.Medium); if (ActiveLevel == 0) { UIController.Instance.ShowTutorial(); yield return(new WaitForSeconds(2f)); } UIController.Instance.ShowPlay(); }
public void NextButton() { if (PlayerPrefs.GetInt("onOrOffVibration") == 1) { TapticManager.Impact(ImpactFeedback.Light); } PlayerPrefs.SetInt("LevelIndex", PlayerPrefs.GetInt("LevelIndex") + 1); if (PlayerPrefs.GetInt("LevelIndex") > 10) { SceneManager.LoadScene("Level" + Random.Range(1, 10)); } else { SceneManager.LoadScene("Level" + PlayerPrefs.GetInt("LevelIndex")); } }
public static void VibrateWithDuration(long duration) { if (SystemInfo.supportsVibration) { if (isAndroid()) { vibrator.Call("vibrate", duration); } else { TapticManager.ImpactFeedback feedback; feedback = TapticManager.ImpactFeedback.Heavy; TapticManager.Impact(feedback); } } }
public IEnumerator WaitAndGameLose() { isGameOver = true; PeopleBarParent.SetActive(false); Destroy(BullAnimator.gameObject.GetComponentInParent <AutoMover>()); SoundManager.Instance.playSound(SoundManager.GameSounds.Lose); yield return(new WaitForSeconds(1f)); if (PlayerPrefs.GetInt("VIBRATION") == 1) { TapticManager.Impact(ImpactFeedback.Medium); } LosePanel.SetActive(true); }
public IEnumerator WaitAndGameWin() { SoundManager.Instance.StopAllSounds(); SoundManager.Instance.playSound(SoundManager.GameSounds.Win); yield return(new WaitForSeconds(1f)); if (PlayerPrefs.GetInt("VIBRATION") == 1) { TapticManager.Impact(ImpactFeedback.Light); } currentLevel++; PlayerPrefs.SetInt("LevelId", currentLevel); WinPanel.SetActive(true); //InGamePanel.SetActive(false); }
//################################################## public static void NotificationSuccessTaptic() { if (SystemInfo.supportsVibration) { long duration = 25; if (isAndroid()) { vibrator.Call("vibrate", duration); } else { TapticManager.NotificationFeedback feedback; feedback = TapticManager.NotificationFeedback.Success; TapticManager.Notification(feedback); } } }
public void Die() { if (CurrentState != State.DEAD) { if (m_deathFx != null) { Instantiate(m_deathFx, transform.position, transform.rotation); } GetComponent <MeshRenderer>().enabled = false; CurrentState = State.DEAD; CameraShake shake = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraShake>(); shake.StartShake(m_deathShake); TapticManager.Impact(ImpactFeedback.Heavy); m_main.ShowEventText("GAME OVER"); } }
private void OnCollisionEnter(Collision collision) { Debug.Log(collision); if (collision.gameObject.CompareTag("Obstacle") && !isPowerUpActive) { // Lose Debug.Log("hit"); if (PlayerPrefs.GetInt("VIBRATION") == 1) { TapticManager.Impact(ImpactFeedback.Medium); } SoundManager.Instance.playSound(SoundManager.GameSounds.Hit); Instantiate(playerExplotionPrefab, transform.position, Quaternion.identity); GameManager.Instance.GameLose(); Destroy(gameObject); } }
public static void MediumTaptic() { if (SystemInfo.supportsVibration) { long duration = 50; if (isAndroid()) { vibrator.Call("vibrate", duration); } else { TapticManager.ImpactFeedback feedback; feedback = TapticManager.ImpactFeedback.Medium; TapticManager.Impact(feedback); } } }