// se ejecuta animacion y sonido de disparo la currentAmno baja
    // se dispara un raycast al centro de la camara si este tiene inpacto con el enemigo se le ara daño y se instanciara una particula
    void Shoot()
    {
        sound.Play();
        anim.Play("Fire");
        currentAmno--;
        disparo.Play();
        RaycastHit hit;

        if (Physics.Raycast(fpscam.transform.position, fpscam.transform.forward, out hit, rangoDisparo))
        {
            DestroyEnemy destroyEnemy = hit.transform.GetComponent <DestroyEnemy>();
            if (destroyEnemy != null)
            {
                destroyEnemy.TakeDamage(daño);
            }
            GameObject impacGo = Instantiate(efectoImpacto, hit.point, Quaternion.LookRotation(hit.normal));
            Destroy(impacGo, 2f);
        }
    }
Пример #2
0
 // Start is called before the first frame update
 void Start()
 {
     player             = GameObject.FindGameObjectWithTag("Player");
     destroyenemyscript = thisenemy.GetComponent <DestroyEnemy>();
     fire = GameObject.FindGameObjectWithTag("Sound").transform.Find("EnemyFire").GetComponent <AudioSource>();
 }
Пример #3
0
 void Awake()
 {
     instance = this;
 }
Пример #4
0
 private void Awake()
 {
     Instance1 = this;
 }
Пример #5
0
 void Start()
 {
     vidaEnemigo = GameObject.Find("Reptile").GetComponent <DestroyEnemy> ();
 }
Пример #6
0
    public int vida;                    // vida a la cual le va a aumentar la velosidad al enemigo

    void Start()
    {
        SubirVelosidad = GetComponent <DestroyEnemy> (); //subirVelosidad coje el componente del script DestroyEnemy
        agent          = GetComponent <NavMeshAgent> (); // aget coje el componente del navmesh del enemigo
    }
Пример #7
0
 void Awake()
 {
     instance = this;
 }
Пример #8
0
 void Awake()
 {
     destroyEnemyEffect = GetComponent<DestroyEnemy>();
 }
Пример #9
0
 public void DestroyingEnemy(Vector3 where)
 {
     where.y = 2;
     DestroyEnemy.transform.position = where;
     DestroyEnemy.Play();
 }