// 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); } }
// 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>(); }
void Awake() { instance = this; }
private void Awake() { Instance1 = this; }
void Start() { vidaEnemigo = GameObject.Find("Reptile").GetComponent <DestroyEnemy> (); }
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 }
void Awake() { destroyEnemyEffect = GetComponent<DestroyEnemy>(); }
public void DestroyingEnemy(Vector3 where) { where.y = 2; DestroyEnemy.transform.position = where; DestroyEnemy.Play(); }