public void Attack() { attack_start = Time.time; attacking = true; atk_seq_n = -1; bell_boss.RunChuckCode(ChuckSynths.Bell(frequency, attack_dur)); Instantiate(note_spray, transform); }
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); } }
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)); } }
public void Play(float freq, float dur) { if (instrument_name == "trumpet") { grand_parent.RunChuckCode(ChuckSynths.Trumpet(freq, dur)); } else if (instrument_name == "violin") { grand_parent.RunChuckCode(ChuckSynths.Violin(freq, dur)); } else if (instrument_name == "bell") { grand_parent.RunChuckCode(ChuckSynths.Bell(freq, dur)); } else if (instrument_name == "flute") { grand_parent.RunChuckCode(ChuckSynths.Flute(freq, dur)); } }
// 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; } }
public void Sing(string note_name, float note_freq) { if (!singing) { singing = true; sing_start = Time.time; sung_pos_orig = sung_note_name.transform.localPosition; sung_pos = sung_note_name.transform.position; Debug.Log(note_name + ", " + note_freq); attack_symbol.SetText(note_name); sung_note_name.SetText(note_name); int enemies_shot = 0; PlayerCloud.shots_fired++; foreach (Transform child in spawner.transform) { ThisTarget targ = child.GetComponent <ThisTarget>(); if (targ == null) { continue; } if (targ.Resonate(note_freq)) { enemies_shot++; ShootTowards(child.gameObject); } } // The player misspelled when a sung note did not result in shooting someone if (enemies_shot == 0) { PlayerCloud.misspellings++; } Debug.Log("Shots fired = " + PlayerCloud.shots_fired); Debug.Log("Misspellings = " + PlayerCloud.misspellings); mouth = (GameObject)Instantiate(mouth_LA, PlayerSpriteHolder.transform); chuck.RunCode(ChuckSynths.Voice(note_freq, sing_time)); } else { Debug.Log("already singing..."); } }