Esempio n. 1
0
    //Start is called once, when the scene begins
    void Start()
    {
        note = new bool[8];

        ap = (ArduinoPersistent)GameObject.Find("ArduinoPersistent").GetComponent <ArduinoPersistent>();

        audioSources = new AudioSource[num_notes];
        for (int i = 0; i < num_notes; i++)
        {
            audioSources [i] = gameObject.AddComponent <AudioSource> ();
        }

        audios_0 = new AudioClip[num_notes, num_instruments];
        audios_1 = new AudioClip[num_notes, num_instruments];
        for (int i = 0; i < num_notes; i++)
        {
            for (int j = 0; j < num_instruments; j++)
            {
                audios_0 [i, j] = (AudioClip)Resources.Load("Audios/0/audio_" + i + "_" + j);                   // ex. audio_0_0 is the audio of the first note with the first instrument
                audios_1 [i, j] = (AudioClip)Resources.Load("Audios/1/audio_" + i + "_" + j);                   // ex. audio_2_1 is the audio of the third note with the second instrument
            }
        }

        data = new float[num_notes + num_variables, buffer_dimension];


        prev_strum = 0;
        strum      = 0;


        //REMOVE
        strumento.ChangeStrum(0);
        strumento.Spawn();
    }
Esempio n. 2
0
    private IEnumerator BlinkEgg()
    {
        ArduinoPersistent ap = (ArduinoPersistent)GameObject.Find("ArduinoPersistent").GetComponent <ArduinoPersistent> ();

        for (int i = 0; i < 3; i++)
        {
            ap.SwitchOff();
            yield return(new WaitForSeconds(0.3f));

            ap.SetIntensity(i + 1);
            ap.SetBrightness(20 + (i + 1) * 40);
            yield return(new WaitForSeconds(0.3f));
        }
        ap.SetIntensity(3);
        ap.SetBrightness(200);
    }
Esempio n. 3
0
    void Awake()
    {
        if (_persistent == null)
        {
            DontDestroyOnLoad(gameObject);
            _persistent = this;

            _am = new ArduinoManager("\\\\.\\COM29");
            _am.StartBar();
            _am.SetIntensity(1);
            _am.SetBrightness(20);
        }
        else if (_persistent != this)
        {
            Destroy(gameObject);
        }
    }
Esempio n. 4
0
    void Start()
    {
        ap = (ArduinoPersistent)GameObject.Find("ArduinoPersistent").GetComponent <ArduinoPersistent>();

        sprite = gameObject.GetComponent <SpriteRenderer> ().sprite;
        //particlesEmitter = gameObject.GetComponent<ParticlesAttractorScript> ();
        worldScreenHeight = Camera.main.orthographicSize * 2f;
        worldScreenWidth  = worldScreenHeight / Screen.height * Screen.width;

        x_angle = new float[arduinoBufferSize];
        y_angle = new float[arduinoBufferSize];
        z_angle = new float[arduinoBufferSize];
        x_acc   = new float[arduinoBufferSize];
        y_acc   = new float[arduinoBufferSize];
        z_acc   = new float[arduinoBufferSize];

        LightUpLedBar();

        transform.localScale = new Vector3(100, 100, 1);
    }