Пример #1
0
    void FixedUpdate()
    {
        if (withinView)
        {
            // Spin antenna
            foreach (Transform child in transform)
            {
                if (child.name.Contains("transmitter.antenna"))
                {
                    child.Rotate(Vector3.up * Time.fixedDeltaTime * 200f, Space.World);
                }
            }

            // Play the note
            if (!transform.Find("EmitSound").GetComponent <AudioSource> ().isPlaying)
            {
                transform.Find("EmitSound").GetComponent <AudioSource> ().Play();
            }

            // Look for matching pitch
            if (micAnalyzer.curDb < micAnalyzer.DbThresh)
            {
                transmitting = false;
                transform.parent.GetComponent <Locomotion> ().Stop();
                return;
            }

            float           pitch = micAnalyzer.curPitch;
            TransmitterInfo matchingTransmitter = rangeDetector.getTransmitterFromPitch(pitch);
            if (matchingTransmitter.name == transType)
            {
                //Debug.Log (string.Format ("Transmitter {0} - Within View: {1} ; Transmitting: {2}", transType, withinView.ToString (), transmitting.ToString ()));
                transmitting = true;

                // JASPER:  Here is where we do the thing
                transform.parent.GetComponent <Locomotion> ().Move();
            }
            else
            {
                transmitting = false;
                transform.parent.GetComponent <Locomotion> ().Stop();
            }
        }
        else
        {
            transmitting = false;
            transform.parent.GetComponent <Locomotion> ().Stop();
        }
    }
Пример #2
0
    void Update()
    {
        _transmitterName = rd.getTransmitterFromPitch(ma.curPitch).name;
        if (_transmitterName != "None")
        {
            //Debug.Log ("name " +_transmitterName);
        }

        foreach (GameObject go in _list_o_jects)
        {
            go.GetComponent <AlphaLerp>().canLerp = false;
        }

        CheckTransmitterName(_transmitterName);

        pitchIndicator.currentValue = ma.curPitch;
    }