コード例 #1
0
 // Use this for initialization
 void Start()
 {
     ctrl        = GetComponentInChildren <pxSnarple>();
     ctrl.length = 0.03f + transform.position.x * 0.02f;
     ctrl.start  = 0.5f + transform.position.z * 0.4f;
     ctrl.speed  = 1f + transform.position.y * 0.5f;
     ctrl.KeyOn();
 }
コード例 #2
0
 void FixedUpdate()
 {
     mags = motion.velocity.magnitude;
     if (motion.velocity.magnitude > 2f)
     {
         if (!playing)
         {
             playing = true;
             synth.KeyOn();
         }
     }
     else if (playing)
     {
         playing = false;
         synth.KeyOff();
     }
     synth.start  = Mathf.Clamp(Mathf.Abs(motion.velocity.y * 0.25f), 0f, 0.9f);
     synth.length = Mathf.Clamp(Mathf.Abs(transform.position.x * 0.001f) + 0.001f, 0.001f, 1f);
 }
コード例 #3
0
    void Update()
    {
        synth.start  = transform.position.x * 0.1f + 0.5f;
        synth.length = transform.position.z * 0.1f + 0.5f;
        synth.speed  = transform.position.y * 3f + 0.5f;

        if (!isPlaying)
        {
            if (transform.position.y > 0.05)
            {
                isPlaying = true;
                synth.KeyOn();
            }
        }
        else if (transform.position.y <= 0.05)
        {
            isPlaying = false;
            synth.KeyOff();
        }
    }