public void ToGameHard() { CoinPick.HardMode(); SceneManager.LoadScene("Game"); }
public void ToGameMedium() { CoinPick.MediumMode(); SceneManager.LoadScene("Game"); }
public void ToGame() { CoinPick.EasyMode(); SceneManager.LoadScene("Game"); }
//call death and reset CoinPick indexes private void Death() { isDeath = true; GetComponent <Score>().OnDeath(); CoinPick.ResetVars(); }
//when character collides with an object private void OnControllerColliderHit(ControllerColliderHit hit) { if (hit.point.z > transform.position.z + 0.1f && hit.gameObject.tag == "Enemy") { anim.Play("DAMAGED01", -1, 0f); Death(); } //for hitting the collectible if (hit.point.z > transform.position.z + 0.1f && hit.gameObject.tag == "collectible") { Destroy(hit.gameObject); ScoreforCoin.CoinScore++; if (GameObject.FindGameObjectWithTag("butterfly").transform.localScale == new Vector3(1, 1, 1)) { ScoreforCoin.CoinScore = ScoreforCoin.CoinScore + 2; } DBSaveLoad.UpdateData("student", "StuID", SubmitName.getStuID(), "Coin", ScoreforCoin.CoinScore); } if (hit.point.z > transform.position.z + 0.1f && hit.gameObject.tag == "Coin") { //remove the coin from field of play Destroy(hit.gameObject); //take the letter associated with the coin grabLetter = hit.gameObject.GetComponentInChildren <TextMesh>().text.ToString(); Debug.Log("LastLetterIssued: " + CoinPick.getCurrentLetter() + " CoinLetter " + grabLetter); //determine if that letter was correct if (grabLetter.Equals(CoinPick.getCurrentLetter())) { //update the partial word text partialWordText.text = null; partialWord = partialWord + grabLetter; partialWordText.text = partialWord; CoinPick.currentLetterIndex++; //give a score boost Score.score = Score.score + 5; //check if word was spelled and then reset CoinPick indexes //while maintaining the word index if (partialWord.Equals(CoinPick.currentWord)) { int oldWordIndex = CoinPick.wordArrayIndex; CoinPick.wordEndCount = CoinPick.counter; CoinPick.ResetVars(); CoinPick.wordArrayIndex = oldWordIndex + 1; partialWord = null; //this if statement checks to see how fast a player spelled a word //if fast enough we give them a score bonus if ((CoinPick.wordEndCount - CoinPick.wordStartCount) <= (CoinPick.currentWord.Length * 2)) { Score.score = Score.score + 10; } } //increment letter index and return out of method return; } //end the game if the letter was incorrect else if (grabLetter.Equals(null)) { return; } else { WrongWordText.text = ("Word spelled incorrectly: " + CoinPick.currentWord); anim.Play("DAMAGED00", -1, 0f); Death(); return; } } }
void Start() { player = FindObjectOfType <PlayerMovement> (); coinPick = FindObjectOfType <CoinPick> (); }