コード例 #1
0
    public bool Resonate(float player_note_freq)
    {
        float centsDifference = 1200 * Mathf.Log(frequency / player_note_freq, 2);
        bool  success         = (Mathf.Abs(centsDifference) < centsTolerance);
        Bell  bell            = GetComponent <Bell>();

        if (bell != null && targetable && !success)
        {
            bell.ResonatorUpdate(success);
        }
        return(targetable && success);
    }
コード例 #2
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (target != null && collision.gameObject == target)
     {
         PlayerCloud.score += 1;
         Enemy enemy = target.GetComponent <Enemy>();
         Bell  bell  = target.GetComponent <Bell>();
         if (enemy != null)
         {
             target.GetComponent <Enemy>().GetHit();
         }
         else if (bell != null)
         {
             bell.ResonatorUpdate(true);
         }
         Explode();
     }
 }