Exemple #1
0
 // Use this for initialization
 void Awake()
 {
     bell_boss              = GetComponentInParent <BellBoss>();
     this_target            = GetComponent <ThisTarget>();
     this_target.frequency  = frequency;
     this_target.targetable = targetable;
     bubble = transform.Find("bubble").gameObject;
     bell1  = transform.Find("bell_1").gameObject;
     ApplyDifficulty();
     Spawn(false);
 }
 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...");
     }
 }
Exemple #3
0
 // Use this for initialization
 void Start()
 {
     parent             = transform.parent.gameObject.GetComponent <EnemySpawnerController>();
     hp_slider.maxValue = max_hp;
     hp_slider.value    = hit_points;
     ChooseNewPitch();
     choose_new_pitch = false;
     ApplyDifficulty();
     instrument_used = instrument_choices[Random.Range(0, instrument_choices.Length)];
     Instantiate(instrument_used, transform);
     particleSys    = GetComponentsInChildren <ParticleSystem>();
     childSprites   = GetComponentsInChildren <SpriteRenderer>();
     float_behavior = GetComponent <FloatBehavior>();
     allSprites.Add(GetComponent <SpriteRenderer>());
     foreach (SpriteRenderer sprite in childSprites)
     {
         allSprites.Add(sprite);
     }
     reloading_time         = Random.Range(0.0f, reload_in_sec);
     this_target            = GetComponent <ThisTarget>();
     this_target.frequency  = note_freq;
     this_target.targetable = targetable;
 }