Пример #1
0
    void Shoot()
    {
        flashGun.Play();
        audioS.Play();
        RaycastHit hit;

        if (Physics.Raycast(fpsCam.transform.position, fpsCam.transform.forward, out hit, range, 9))
        {
            Target           target  = hit.transform.GetComponent <Target>();
            Bicho_ADistancia target2 = hit.transform.GetComponent <Bicho_ADistancia>();
            Bicho_Reina      target3 = hit.transform.GetComponent <Bicho_Reina>();
            MiniSpider       target4 = hit.transform.GetComponent <MiniSpider>();
            if (target != null)
            {
                target.TakeDamge(damage);
            }
            if (target2 != null)
            {
                target2.TakeDamge(damage);
            }
            if (target3 != null)
            {
                target3.TakeDamge(damage);
            }
            if (target4 != null)
            {
                target4.TakeDamage(damage);
            }
            GameObject impactGO = Instantiate(ImpactEffect, hit.point, Quaternion.LookRotation(hit.normal));
            Destroy(impactGO, 0.5f);
        }
    }
Пример #2
0
 // Start is called before the first frame update
 void Start()
 {
     miniS       = FindObjectOfType <MiniSpider>();
     level2Start = FindObjectOfType <DetectorA2>();
     nucleo      = FindObjectOfType <Nucleo>();
     RespawnPos  = puntRespawn.transform.position;
     playerMove  = FindObjectOfType <PlayerMove>();
     healthBar   = FindObjectOfType <HealthBar>();
     actOleadas  = FindObjectOfType <ActivarOleadas>();
     spawnEnemy  = FindObjectOfType <SpawnEnemigos>();
     timer       = FindObjectOfType <TimerNucleo>();
 }