Ejemplo n.º 1
0
    void Shoot()
    {
        lightningBoltScript.Trigger();
        AudioSource.PlayClipAtPoint(Electricity, transform.position);
        RaycastHit hit;

        if (Physics.Raycast(fpsCam.transform.position, fpsCam.transform.forward, out hit, range))
        {
            //Debug.Log(hit.transform.name);
            Target  target  = hit.transform.GetComponent <Target>();
            Target2 target2 = hit.transform.GetComponent <Target2>();
            Target3 target3 = hit.transform.GetComponent <Target3>();
            Target4 target4 = hit.transform.GetComponent <Target4>();
            if (target != null)
            {
                target.TakeDamage(damage);
                GetComponent <AudioSource>().Play();
            }

            if (target2 != null)
            {
                target2.TakeDamage(damage);
                GetComponent <AudioSource>().Play();
            }

            if (target3 != null)
            {
                target3.TakeDamage(damage);
                GetComponent <AudioSource>().Play();
            }

            if (target4 != null)
            {
                target4.TakeDamage(damage);
                GetComponent <AudioSource>().Play();
            }
        }
    }
Ejemplo n.º 2
0
 public static T Call <T>(this Target4 <T> target, T arg1, T arg2, T arg3, T arg4) => target.ToTailCall()(arg1, arg2, arg3, arg4);
Ejemplo n.º 3
0
 public static Func <T, T, T, T, T> ToTailCall <T>(
     this Target4 <T> target) => ToTailCall <T, T, T, T, T>((recurse, arg1, arg2, arg3, arg4) => target((_arg1, _arg2, _arg3, _arg4) => recurse(_arg1, _arg2, _arg3, _arg4), arg1, arg2, arg3, arg4));