public void StartLevel() { currentLevelState = levelState.InProgress; foreach (GameObject star in stars) { star.GetComponent <StarBaseClass>().UnFreezePosition(); } }
public void StartLevel() { currentLevelState = levelState.InProgress; foreach(GameObject star in stars) { star.GetComponent<StarBaseClass>().UnFreezePosition(); } }
public void StarHolderActive() { activeStarHolders += 1; if(activeStarHolders == starHolders.Length) { currentLevelState = levelState.Finished; cbScript.ChooseLineToDraw(); } }
public void StarHolderActive() { activeStarHolders += 1; if (activeStarHolders == starHolders.Length) { currentLevelState = levelState.Finished; cbScript.ChooseLineToDraw(); } }
private void CheckTouch(Vector3 pos) { switch (m_currentState) { case levelState.playing: StopAllCoroutines(); m_audioSource.Stop(); m_currentState = levelState.waiting; break; case levelState.showing: touch = true; break; } RaycastHit2D hitInfo = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(pos), Vector2.zero); if (hitInfo) { m_answerIsCorrect = hitInfo.transform.tag == m_lastClip.name ? true : false; if (!m_answerIsCorrect) { StartCoroutine(PlaySound(m_clickSound, false)); //StartCoroutine(PlaySound(m_tryAgainSound, false)); } else { m_gameManager.clickParticleSystem.transform.position = hitInfo.transform.position; m_gameManager.clickParticleSystem.Play(); m_remainingSounds.Remove(m_lastClip); if (m_remainingSounds.Count == 0) { //SaveManager.Instance.LevelCompleted(); m_gameManager.EndLevel(); //StartCoroutine(PlaySound(m_endLevelSound, false)); } else { StartCoroutine(PlaySound(m_correctSound, false)); hitInfo.transform.GetComponent <Animator>().SetTrigger("Disable"); m_audioSource.PlayOneShot(m_cardFlipSound); hitInfo.transform.GetComponent <Collider2D>().enabled = false; //PlayRandomSound(); } } } }
public void setState(levelState l) { switch (l) { case levelState.available: meshFilter.mesh = red; locked = false; break; case levelState.done: meshFilter.mesh = green; locked = false; break; case levelState.blocked: meshFilter.mesh = grey; locked = true; break; } }
public IEnumerator PlaySound(AudioClip sound, bool save) { m_currentState = levelState.playing; m_audioSource.PlayOneShot(sound); if (save) { m_lastClip = sound; } yield return(new WaitForSeconds(sound.length)); if (sound == m_correctSound) { PlayRandomSound(); } else if (sound == m_clickSound) { StartCoroutine(PlaySound(m_tryAgainSound, false)); } else { m_currentState = levelState.waiting; } }
//====================================================== State Management public void ChangeLevelState(levelState levelState) { _levelState = levelState; }
private void Awake() { Instance = GetComponent <LevelManager>(); _levelState = levelState.waiting; }
void OnEnable() { currentLevelState = levelState.spawnedIn; targetPos[0] = new Vector3(0, -14, 0); targetPos[1] = new Vector3(-40, -14, 0); }
public void GameOver(string _Reason) { currentLevelState = levelState.GameOver; uiScript.GameOver(_Reason); }