示例#1
0
 public void StartLevel()
 {
     currentLevelState = levelState.InProgress;
     foreach (GameObject star in stars)
     {
         star.GetComponent <StarBaseClass>().UnFreezePosition();
     }
 }
示例#2
0
 public void StartLevel()
 {
     currentLevelState = levelState.InProgress;
     foreach(GameObject star in stars)
     {
         star.GetComponent<StarBaseClass>().UnFreezePosition();
     }
 }
示例#3
0
    public void StarHolderActive()
    {
        activeStarHolders += 1;

        if(activeStarHolders == starHolders.Length)
        {
            currentLevelState = levelState.Finished;
            cbScript.ChooseLineToDraw();
        }
    }
示例#4
0
    public void StarHolderActive()
    {
        activeStarHolders += 1;

        if (activeStarHolders == starHolders.Length)
        {
            currentLevelState = levelState.Finished;
            cbScript.ChooseLineToDraw();
        }
    }
示例#5
0
    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();
                }
            }
        }
    }
示例#6
0
    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;
        }
    }
示例#7
0
    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;
        }
    }
示例#8
0
 //====================================================== State Management
 public void ChangeLevelState(levelState levelState)
 {
     _levelState = levelState;
 }
示例#9
0
 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);
 }
示例#11
0
 public void GameOver(string _Reason)
 {
     currentLevelState = levelState.GameOver;
     uiScript.GameOver(_Reason);
 }
示例#12
0
 public void GameOver(string _Reason)
 {
     currentLevelState = levelState.GameOver;
     uiScript.GameOver(_Reason);
 }
 void OnEnable()
 {
     currentLevelState = levelState.spawnedIn;
     targetPos[0]      = new Vector3(0, -14, 0);
     targetPos[1]      = new Vector3(-40, -14, 0);
 }