Example #1
0
 void playRandomMusic()
 {
     if (dnc.isNight)
     {
         if (dnc.GetNightNumber() == dnc.GetFinalNight())
         {
             audioo.clip = finalBossMusic;
         }
         else
         {
             audioo.clip = musicNight[Random.Range(0, musicNight.Length)] as AudioClip;
         }
     }
     else
     {
         audioo.clip = musicDay[Random.Range(0, musicDay.Length)] as AudioClip;
     }
     audioo.Play();
 }
Example #2
0
    private void Start()
    {
        duck           = GameObject.Find("Duck");
        dnc            = GameObject.Find("Sun").GetComponent <DayNightCycle>();
        spikes         = (GameObject)Resources.Load("Prefabs/Spikes");
        aud            = GameObject.Find("AudioController").GetComponent <AudioSource>();
        spikeWarning   = (AudioClip)Resources.Load("Sound Effects/TempleBell");
        laser          = (GameObject)Resources.Load("Prefabs/Laser");
        missile        = (GameObject)Resources.Load("Prefabs/Missile");
        searcherPrefab = (GameObject)Resources.Load("Prefabs/Searcher");

        night = dnc.GetNightNumber();

        rayCastLayerMask = ~LayerMask.GetMask("Turing", "Player");

        // Start with a lower charge time and faster charge speed in the later nights.
        timeForCharge -= 1f * (night - 1);
        chargeSpeed   += 0.125f * (night - 1);
        chargeTimer    = timeForCharge;

        timeForSpike -= 2f * (night - 1);
        spikeTimer    = timeForSpike;

        maxNumberOfSearchers = night;

        laserTimer = timeForLaser;

        // Night 3 onwards has spotlights.
        if (night > 2)
        {
            while (numberOfSearchers < maxNumberOfSearchers)
            {
                ++numberOfSearchers;
                Vector3 searcherSpawnPoint = new Vector3(250f, -30f, 250f);
                Instantiate(searcherPrefab, searcherSpawnPoint, Quaternion.identity);
            }
        }
    }