예제 #1
0
 // Update is called once per frame
 void Update()
 {
     transform.Translate(Vector3.up * speed * Time.deltaTime);
     life += Time.deltaTime;
     if (life > lifespan * 0.75)
     {
         ctrl.KeyOff();
     }
     if (life > lifespan)
     {
         Destroy(gameObject);
     }
 }
 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);
 }
    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();
        }
    }