Exemplo n.º 1
0
 private void OnTriggerStay2D(Collider2D collision)
 {
     if (collision.GetComponent <BaseBall>())
     {
         shakeTimer += Time.deltaTime;
         if (shakeTimer < shakeLimit)
         {
             if (!shaker || shaker.shaking)
             {
                 return;
             }
             FX_Spawner.instance.SpawnFX(FXType.TreeRustle, transform.position, Quaternion.identity);
             shaker.Activate(0.2f);
             EmitLeaves(shakeLeafCount);
         }
     }
 }
Exemplo n.º 2
0
    IEnumerator DestroyCo()
    {
        destroyed = true;
        shaker.Activate(destroy_timer);
        float timer = destroy_timer;

        while (timer > 0)
        {
            foreach (var r in renderers)
            {
                r.color = Color.Lerp(
                    new Color(r.color.r, r.color.g, r.color.b, 1),
                    new Color(r.color.r, r.color.g, r.color.b, 0),
                    (destroy_timer - timer) / destroy_timer);
            }
            timer -= Time.deltaTime;
            yield return(null);
        }
        Destroy(gameObject);
    }