private void OnMouseDown() { //Destroy Hint if (hintManager != null) { hintManager.DestroyHint(); } if (board.currentState == GameState.move) { firstClickPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition); } SpriteRenderer mySprite = GetComponent <SpriteRenderer>(); mySprite.color = clickedColor; clickCounter++; audioSource.enabled = true; if (!audioSource.isPlaying) { audioSource.clip = click; audioSource.Play(); } }
private void OnMouseDown() { //destroy the hint if (hintManager != null) { hintManager.DestroyHint(); } if (board.curState == GameState.move) { firstTouchPos = Camera.main.ScreenToWorldPoint(Input.mousePosition); } }
private void OnMouseDown() { if (hintManager != null) { hintManager.DestroyHint(); } if (mBoard.currentState == GameState.move) { mFirstTouchPos = Camera.main.ScreenToWorldPoint(Input.mousePosition); } //Debug.Log(mFirstTouchPos); }
//la position du premier clique (quand on clique sur la souris) private void OnMouseDown() { //détruire le hint après l'avoir utilisé (en cliquant sur le dot en question) if (hintManager != null) { hintManager.DestroyHint(); } //on ne sauvegarde la première position que si le jeu est en état move(la souris est entrai de bouger) if (board.currentState == GameState.move) { firstTouchPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition); //Debug.Log(firstTouchPosition); } }
IEnumerator DestroyHint() { while (true) { if (hintManager != null) { yield return(new WaitForSeconds(4f)); hintManager.DestroyHint(); //hintManager.move = anim.SetBool("touch", false); //anim.SetBool("touch", false); } } }
private void OnMouseDown() { // Destroy hint if (hintManager != null) { hintManager.DestroyHint(); } // If the boards game state is equal to move if (board.currentState == GameState.move) { // Set the firstTouchPosition value equal to the mousePosition (ScreenToWorldPoint) firstTouchPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition); } }
//Get positon of the mouse when pressed private void OnMouseDown() { //Destroy the Hint if (hintManager != null) { hintManager.DestroyHint(); } //https://docs.unity3d.com/ScriptReference/Camera.ViewportToWorldPoint.html //Can only move if its in the move state if (board.currentState == GameState.move) { firstTouchPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition); } //Debug.Log(firstTouchPosition); }
private void OnMouseDown() { //if(anim != null) //{ // anim.SetBool("Touched", true); //} //Уничтожаем подсказку if (hintManager != null) { hintManager.DestroyHint(); } if (board.currentState == GameState.move) { firstTouchPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition); } }
private void OnMouseDown() { if (anim != null) { anim.SetBool("Touched", true); } //Destroy the hint if (hintManager != null) { hintManager.DestroyHint(); } if (board.currentState == GameState.move) { firstTouchPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition); } }
// Pauses game for menu that requires it public void PauseGame() { hint.DestroyHint(); AudioManager.main.PlaySingle(Confirm); Debug.Log("Game Paused"); Time.timeScale = 0; IsPaused = true; // Hide Board gameObject GameObject boardFound = gameObject.transform.Find("Board").gameObject; boardFound.SetActive(false); board.currentState = GameState.wait; Screens[PauseScreen].screen.SetActive(true); //AudioManager.main.MusicSource.Pause(); }
public void toggleHint() { hintManager = FindObjectOfType <HintManager>(); if (board != null && board.GetComponent <HintManager>().enabled == true) { hintManager.DestroyHint(); board.GetComponent <HintManager>().enabled = false; Debug.Log("Hint System Disabled"); } else if (board != null) { board.GetComponent <HintManager>().enabled = true; Debug.Log("Hint System Enabled"); } }
private void DestroyMatchesAt(int column, int row) { if (allDots[column, row].GetComponent <Dot>().isMatched) { if (findMatches.currentMatches.Count >= 4) { CheckToMakeBombs(); } // Does a tile need to break? if (breakableTiles[column, row] != null) { // give 1 damage to tile. breakableTiles[column, row].TakeDamage(1); if (breakableTiles[column, row].hitPoints <= 0) { breakableTiles[column, row] = null; } } if (goalManager != null) { goalManager.CompareGoal(allDots[column, row].tag.ToString()); goalManager.UpdateGoals(); } if (hintManager != null) { hintManager.DestroyHint(); } if (soundManager != null) { soundManager.PlayRandomDestroyNoise(); } GameObject particle = Instantiate(destroyEffect, allDots[column, row].transform.position, Quaternion.identity); Destroy(particle, destroyParticleAfterNSeconds); Destroy(allDots[column, row]); scoreManager.IncreaseScore(defaultScoreValue * streakValue); allDots[column, row] = null; } }
void CalculateAngle() { if (hintManager != null) { hintManager.DestroyHint(); } if (Mathf.Abs(finalTouchPos.y - firstTouchPos.y) > swipeAngleLimt || Mathf.Abs(finalTouchPos.x - firstTouchPos.x) > swipeAngleLimt) { board.playState = PlayState.Wait; swipeAngle = Mathf.Atan2(finalTouchPos.y - firstTouchPos.y, finalTouchPos.x - firstTouchPos.x) * 180 / Mathf.PI; MovePieces(); board.currentDot = this; } else { board.playState = PlayState.Move; } }
IEnumerator CheckGameWin() { int width = theBoard.width; int height = theBoard.height; yield return(new WaitForSeconds(0.3f)); if (currentScore < maxScore && theBoard.moveCounter <= 0) { theBoard.currentState = GameState.wait; //Time.timeScale = 0; for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { //Destory the board and current Hint Particle Destroy(theBoard.allIcons[j, i]); Hint.DestroyHint(); yield return(new WaitForSeconds(0.030f)); } } //Change Values on TryAgain Screen earnedScore.text = getScore().ToString(); previousHighScore.text = theScore.GetHighScore().ToString(); //If player gets a new HighScore display "New Highscore!" if (getScore() > previousHIGHscore) { NewHighScore.transform.gameObject.SetActive(true); } //Show Progress Screen theBoard.currentState = GameState.move; gameOver = true; UIManager.main.ShowScreen("TryAgain"); } if (currentScore >= maxScore && theBoard.moveCounter >= 0) { theBoard.currentState = GameState.wait; for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { //Destory the board and current Hint Particle Destroy(theBoard.allIcons[j, i]); Hint.DestroyHint(); yield return(new WaitForSeconds(0.030f)); } } Debug.Log("Level Complete!"); gameOver = true; //Play Victory Animation then Show Win Screen if (doOnce == 0) { StartCoroutine(ShowVictoryScreen(VictoryDelay)); doOnce++; } } }
private void OnMouseDown() { //Destroy Hint Particle if (hintManager != null) { hintManager.DestroyHint(); } if (board.currentState == GameState.move) { firstTouchPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition); if (buttonManager.clickedTiger == true) { //Destroy(this.gameObject); //Destroy(board.allIcons[column, row]); isAreaBomb = true; GameObject area = Instantiate(areaBomb, transform.position, Quaternion.identity); area.transform.parent = this.transform; powerUpPoints.points -= powerUpPoints.tigerReached; buttonManager.clickedTiger = false; StartCoroutine(WaitandDestroy()); } if (buttonManager.clickedDragon == true) { isRowBomb = true; GameObject bomb = Instantiate(rowBomb, transform.position, Quaternion.identity); bomb.transform.parent = this.transform; isColumnBomb = true; GameObject cBomb = Instantiate(columnBomb, transform.position, Quaternion.identity); cBomb.transform.parent = this.transform; powerUpPoints.points -= powerUpPoints.dragonReached; buttonManager.clickedDragon = false; StartCoroutine(WaitandDestroy()); } if (buttonManager.clickedRat == true) { isColorBomb = true; GameObject color = Instantiate(colorBomb, transform.position, Quaternion.identity); color.transform.parent = this.transform; powerUpPoints.points -= powerUpPoints.ratMaxReached; buttonManager.clickedRat = false; StartCoroutine(WaitandDestroy()); } } //Debug.Log(firstTouchPosition); }