Ejemplo n.º 1
0
 public void Update()
 {
     if (_control == Control.Off)
     {
         _level = _defaultLevel;
     }
     else if (_control == Control.MidiKnob)
     {
         _level = MidiJack.GetKnob(_midiChannel, _knobIndex, _defaultLevel);
     }
     else if (_control == Control.MidiNote)
     {
         _level = MidiJack.GetKey(_midiChannel, _noteNumber);
     }
     else // _control == Control.InputAxis
     {
         if (string.IsNullOrEmpty(_inputAxis))
         {
             _level = _defaultLevel;
         }
         else
         {
             _level = Input.GetAxis(_inputAxis);
         }
     }
     _level = _curve.Evaluate(_level);
 }
Ejemplo n.º 2
0
    void moveToTarget()
    {
        GetComponent <Rigidbody2D>().AddForce(-GetComponent <Rigidbody2D>().velocity.normalized *m_dragspeed);

        float move = MidiJack.GetKey(calcKey());

        //Debug.Log (move);
        if (move > .1)
        {
            Vector2 dif = m_target.transform.position - transform.position;
            if ((dif).magnitude > 1)
            {
                GetComponent <Rigidbody2D>().AddForce(dif.normalized * m_speed * move * 10);
            }
        }
    }
Ejemplo n.º 3
0
    private ArrayList getInput()
    {
        ArrayList notes_pressed = new ArrayList();

        for (int i = 68; i < 88; i += 1)
        {
            if (MidiJack.GetKey(i) > .1)
            {
                //Debug.Log("key pressed");
                notes_pressed.Add(i);
            }
        }

//		if (notes_pressed.Count > 0) {
//			foreach (int note in notes_pressed) {
//				Debug.Log (midiStr[note]);
//			}
//		}
        return(notes_pressed);
    }
Ejemplo n.º 4
0
    void testingMove()
    {
        float upKey = MidiJack.GetKey(65), downKey = MidiJack.GetKey(67), leftKey = MidiJack.GetKey(69), rightKey = MidiJack.GetKey(71);

        GetComponent <Rigidbody2D>().AddForce(-GetComponent <Rigidbody2D>().velocity.normalized *m_dragspeed);
        if (upKey > 0.1)
        {
            GetComponent <Rigidbody2D>().AddForce(transform.up.normalized * m_speed * upKey * 10);
        }
        if (downKey > 0.1)
        {
            GetComponent <Rigidbody2D>().AddForce(-transform.up.normalized * m_speed * downKey * 10);
        }
        if (leftKey > 0.1)
        {
            GetComponent <Rigidbody2D>().AddForce(-transform.right.normalized * m_speed * leftKey * 10);
        }
        if (rightKey > 0.1)
        {
            GetComponent <Rigidbody2D>().AddForce(transform.right.normalized * m_speed * rightKey * 10);
        }
    }
Ejemplo n.º 5
0
 // Update is called once per frame
 void Update()
 {
     Debug.Log(MidiJack.GetKey(53));
 }
Ejemplo n.º 6
0
 void Update()
 {
     transform.localScale = Vector3.one * (0.1f + MidiJack.GetKey(noteNumber));
     GetComponent <Renderer>().material.color = MidiJack.GetKeyDown(noteNumber) ? Color.red : Color.white;
 }