Exemple #1
0
    // Update is called once per frame
    void Update()
    {
        if (!Alien.transmitting)
        {
            return;
        }

        if (m_timeToTrigger > 0)
        {
            m_timeToTrigger -= Time.deltaTime;

            if (m_timeToTrigger <= 0)
            {
                Alien.Tone.Trigger();
                Ship.Trigger();

                m_timeToTrigger = Ship.audio.clip.length + 1.0f;
            }
        }

        Ship.oscil.Frequency = m_freqController.Update((int)Ship.oscil.Frequency);
        Ship.mod.Frequency   = m_rateController.Update(Ship.mod.Frequency);

        FreqDisplay.Text      = Ship.oscil.Frequency + "";
        FreqDisplay.color     = Feedback.freqColor;
        FreqDisplay.Frequency = Feedback.glitchAmount;

        RateDisplay.Text      = Ship.mod.Frequency.ToString("0.0");
        RateDisplay.color     = Feedback.rateColor;
        RateDisplay.Frequency = Feedback.glitchAmount;

        if (Input.GetKeyDown("space"))
        {
            audio.Play();
            Alien.ReceiveXMit();
            Ship.Stop();

            FreqDisplay.Text  = "###";
            FreqDisplay.color = Color.white;

            RateDisplay.Text  = "###";
            RateDisplay.color = Color.white;

            m_timeToTrigger = 0.5f;
        }
    }