Beispiel #1
0
 private void Play(float dur, bool hit = false)
 {
     if (!hit)
     {
         GetComponentInChildren <Instrument>().Play(note_freq, dur);
         Instantiate(note_spray, transform);
     }
     else if (hit)
     {
         parent.RunChuckCode(ChuckSynths.BG_Plucked_String(note_freq, dur));
     }
 }
Beispiel #2
0
 public void ResonatorUpdate(bool b)
 {
     if (b)
     {
         bell_boss.BellHitSignal(this.gameObject);
         bell_boss.RunChuckCode(ChuckSynths.BG_Plucked_String(frequency, attack_dur));
     }
     else if (!b)
     {
         bell_boss.PlayerMissedSignal(this.gameObject);
     }
 }
    // Update is called once per frame
    void FixedUpdate()
    {
        t -= Time.fixedDeltaTime;
        if (t <= 0f)
        {
            int [,] notes = BackgroundMusic.GetNextEvent();
            for (int inst = 0; inst < 4; inst++)
            {
                int   degree     = notes[inst, 0] - 1;
                int   alteration = notes[inst, 1];
                float frequency  = 0f;
                int   power      = 0;
                if (degree >= 0)
                {
                    switch (inst)
                    {
                    case 0:
                        frequency = Scale.GetNoteFrequency(degree, alteration) / 4f;
                        chuck.RunCode(ChuckSynths.BG_Plucked_String(frequency));
                        break;

                    case 1:
                        power = degree;
                        chuck.RunCode(ChuckSynths.BG_Bass(power));
                        break;

                    case 2:
                        power = degree;
                        chuck.RunCode(ChuckSynths.BG_Snare(power));
                        break;

                    case 3:
                        power = degree;
                        chuck.RunCode(ChuckSynths.BG_Hi_Hat(power));
                        break;
                    }
                }
            }
            // Debug.Log(notes);
            t = eventDelta;
        }
    }