コード例 #1
0
    void Start()
    {
        backgroundMusic = GetComponent <AudioSource>();

        if (!GameManager.instance.isGameComplete)
        {
            StartCoroutine(AudioFadeIn.FadeIn(backgroundMusic, 3f));
        }
        else
        {
            backgroundMusic.Stop();
        }
        //set up door locks every time the hub scene is loaded
        for (int ctr = 0; ctr < levelDoors.Length; ctr++)
        {
            levelDoors[ctr].isDoorlocked = GameManager.instance.doorLocks[ctr];
            levelDoors[ctr].SetWorldObject();
        }
        if (!GameManager.instance.doorLocks[4])
        {
            ladderLevel5.SetActive(true);
            ladderLevel5.GetComponent <Animator>().SetBool("Freeze", GameManager.instance.isGameComplete);
        }

        //place player at spawn point
        GameManager.instance.SetPlayerLocation(PlayerSpawn);
        //show score
        score.gameObject.SetActive(true);
        //show highscore
        h_score.SetActive(true);
        //unlock the player's movement
        Player.instance.ChangeMovementLock(true);
    }
コード例 #2
0
ファイル: Level.cs プロジェクト: saketepe/Solitary
 // Use this for initialization
 void Start()
 {
     backgroundMusic = GameObject.FindGameObjectWithTag("music").GetComponent <AudioSource> ();
     StartCoroutine(AudioFadeIn.FadeIn(backgroundMusic, 3f));
     //set the player spawn in the level
     GameManager.instance.SetPlayerLocation(PlayerSpawn);
     //set timer
     startTime = Time.time;
     //set the current score to levelScore
     currentLevelScore = 0;
     //turn on some UIs
     timerText.gameObject.SetActive(true);
     //set audio transition fade in
     //set level ID based on the door
     levelID = backToHub.levelID;
 }
コード例 #3
0
ファイル: EndScreen.cs プロジェクト: saketepe/Solitary
    // Use this for initialization
    void Start()
    {
        StartCoroutine(AudioFadeIn.FadeIn(GetComponent <AudioSource>(), 3f));
        goToMainMenu.onClick.AddListener(GoToMainMenu);

        //Call Game End
        GameManager.instance.GameEnd();

        if (Player.instance.playerProgress.goToPhobos)
        {
            myText.text = "Attempts were made by the USSR to send probes to Phobos in 1988, and again in 2011. All attempts were classified as failures.\n\nYou set your course for Phobos.\n\n\n\nThe End";
        }
        else
        {
            myText.text = "Attempts were made by the USSR to send probes to Phobos in 1988, and again in 2011. All attempts were classified as failures.\n\nYou set your course for Mars to continue your mission to terraform Mars.\n\n\n\nThe End";
        }
    }
コード例 #4
0
    void FixedUpdate()
    {
        for (int i = 0; i < gameObject.transform.childCount; i++)
        {
            if (sceneCount != whichIsPlaying)
            {
                StartCoroutine(AudioFadeOut.FadeOut(gameObject.transform.GetChild(whichIsPlaying).GetComponent <AudioSource>(), 0.8f));
                whichIsPlaying = sceneCount;

                if (!gameObject.transform.GetChild(sceneCount).GetComponent <AudioSource>().isPlaying)
                {
                    gameObject.transform.GetChild(whichIsPlaying).GetComponent <AudioSource>().Play();
                }

                StartCoroutine(AudioFadeIn.FadeIn(gameObject.transform.GetChild(whichIsPlaying).GetComponent <AudioSource>(), 0.5f));
            }
        }
    }