예제 #1
0
 void Update()
 {
     if (!pickup.IsBeingCarried() &&
         nearbyCorruption != null &&
         nearbyCorruption.IsActivated() &&
         nearbyCorruption.GetRadioTag() == radioTag)
     {
         nearbyCorruption.DeactivateCorruption();
     }
 }
    private IEnumerator GameCoroutine()
    {
        SetInputLocked(true);
        GameObject tutorialPanel = Instantiate(tutorialPanelPrefab, popupParent);

        while (tutorialPanel != null)
        {
            yield return(null);
        }
        SetInputLocked(false);

        yield return(new WaitForSeconds(1));

        audioController.PlayVoiceOver();

        yield return(new WaitForSeconds(4));

        tutorialCorruption.ActivateCorruption();
        corruptionController.ExpandFromPoint(tutorialCorruption.transform.position, 60, 50);


        // Wait until game over or radio delivered
        while (true)
        {
            if (corruptionController.GameIsOver())
            {
                tutorialCorruption.MakeUnstoppable();
                GameOver();
                yield break;
            }
            else if (!tutorialCorruption.IsActivated())
            {
                corruptionController.Dissappear(2);
                break;
            }

            yield return(null);
        }


        // Make bridge appear
        tutorialBridge.GoToNextPosition();


        for (int i = 0; i < shuffledCorruptions.Count; i++)
        {
            Corruption corruption = shuffledCorruptions[i];
            corruption.transform.position = shuffledCorruptionLocations[i].position;
            corruption.ActivateCorruption();
            corruptionController.ExpandFromPoint(corruption.transform.position, corruptionDurations[i], 80);

            // Wait until game over or radio delivered
            while (true)
            {
                if (corruptionController.GameIsOver())
                {
                    corruption.MakeUnstoppable();
                    GameOver();
                    yield break;
                }
                else if (!corruption.IsActivated())
                {
                    corruptionController.Dissappear(2);
                    StartCoroutine(ReturnAllRadios());
                    break;
                }

                yield return(null);
            }
        }

        yield return(new WaitForSeconds(4));

        Win();
    }