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 void RestartButton() { if (PlayerPrefs.GetInt("onOrOffVibration") == 1) { TapticManager.Impact(ImpactFeedback.Light); } SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); }
public static void Impact(ImpactFeedback impactFeedback) { #if UNITY_IOS TapticManager.Impact(impactFeedback); #elif UNITY_ANDROID AndroidHapticManager.Impact(impactFeedback); #endif }
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 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); }
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(); }
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 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 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 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); } } }
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 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 void OnObjectDestruction() { CameraShake shake = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraShake>(); shake.StartShake(m_obstacleDestructionShake); m_main.AddScore(transform, 15); m_main.ShowEventText("BOOM!"); TapticManager.Impact(ImpactFeedback.Medium); CurrentHeight = 0.0f; if (m_boostDistanceLeft <= 0.0f) { SetStopTimer(m_stopMoveAfterObstacleDestruction); CurrentState = State.STOP_TIME; } }
public void GameWin() { SoundManager.Instance.StopAllSounds(); SoundManager.Instance.playSound(SoundManager.GameSounds.Win); NextLevelText.GetComponentInParent <Image>().color = Color.white; currentScore = 0; Debug.Log("Game Win"); isGameStarted = false; GameWinPanel.SetActive(true); Destroy(currentLevelObject); currentLevel++; PlayerPrefs.SetInt("LevelId", currentLevel); if (PlayerPrefs.GetInt("VIBRATION") == 1) { TapticManager.Impact(ImpactFeedback.Light); } }
private void OnTriggerEnter(Collider other) { if (!GameManager.Instance.isGameStarted || GameManager.Instance.isGameOver) { return; } if (other.CompareTag("People")) { if (!other.GetComponent <People>().isTaken) { rand = Random.Range(0, SpawnPoints.Count); Instantiate(particlePuff, other.transform.position, Quaternion.identity); Instantiate(particlePuff, SpawnPoints[rand].transform.position, Quaternion.identity); other.gameObject.transform.parent = SpawnPoints[rand].transform; ObiRopes[rand].GetComponent <MeshRenderer>().enabled = true; other.GetComponent <People>().HoldTheRope(ObiRopes[rand]); ObiRopes.Remove(ObiRopes[rand] ); CollectedPeoples.Add(other.GetComponent <People>()); SpawnPoints.Remove(SpawnPoints[rand]); currentPeopleCount++; GameManager.Instance.UpdateCurrentPeopleCount(currentPeopleCount); if (PlayerPrefs.GetInt("VIBRATION") == 1) { TapticManager.Impact(ImpactFeedback.Light); } SoundManager.Instance.playSound(SoundManager.GameSounds.Pick); StartCoroutine(ScaleSpeed(m_moveSpeed, (m_moveSpeed - moveStep), .5f)); } } else if (other.CompareTag("Obstacle")) { OnFinishLine(); GameManager.Instance.FinishTransform.gameObject.SetActive(false); GameManager.Instance.BullAnimator.gameObject.transform.DOMoveZ( GameManager.Instance.BullAnimator.gameObject.transform.position.z + 100, 10); StartCoroutine(GameManager.Instance.WaitAndGameLose()); } }
public IEnumerator WaitAndGameWin() { isGameOver = true; PeopleBarParent.SetActive(false); DestroyImmediate(BullAnimator.gameObject.GetComponentInParent <AutoMover>()); 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); }
void Update_Crash() { float gravity = Physics.gravity.y; gravity *= m_forceFallMultiplier; JumpVelocity += gravity * Time.deltaTime; CurrentHeight += JumpVelocity * Time.deltaTime; if (CurrentHeight <= 0.0f) { CurrentHeight = 0.0f; CameraShake shake = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraShake>(); shake.StartShake(m_forceFallShake); SetStopTimer(m_stopMoveAfterForceFallTimer); TapticManager.Impact(ImpactFeedback.Light); CurrentState = State.STOP_TIME; } UpdateMove(); }