void Start() { __cooldownDeDisparo = naveInfo.cooldown; __cooldownDeHabilidad = naveInfo.cooldownHabilidad; __duracionHabilidad = naveInfo.duracionHabilidad; laserSND = gameObject.GetComponent <AudioSource>(); __cooldownDeDisparo_cp = naveInfo.cooldown; __cooldownDeHabilidad_cp = naveInfo.cooldownHabilidad; __duracionHabilidad_cp = naveInfo.duracionHabilidad; _habilidad = naveInfo.habilidad; _tiempo_cp = _tiempo; _repeticiones_cp = _repeticiones; }
//Devuelve true solo si entró a alguno de los if protected bool usarHabilidad(EnemigoInfo.habilidades habilidad, GameObject self) { #region Visible if (habilidad == EnemigoInfo.habilidades.VISIBLE) { Color c = self.GetComponentInChildren <MeshRenderer>().material.color; c.a = 1f; self.GetComponentInChildren <MeshRenderer>().material.color = c; } #endregion #region Invisible else if (habilidad == EnemigoInfo.habilidades.INVISIBLE) { Color c = self.GetComponentInChildren <MeshRenderer>().material.color; c.a = 0f; self.GetComponentInChildren <MeshRenderer>().material.color = c; } #endregion #region Invisibilidad else if (habilidad == EnemigoInfo.habilidades.INVISIBILIDAD) { float alpha = self.GetComponentInChildren <MeshRenderer>().material.color.a; _esInvisible = (alpha <= 0.01) ? true : false; if (_esInvisible || _convertirVisible) { visible(self); _convertirVisible = true; if (alpha >= 1f) { _convertirVisible = false; } } else if (!_convertirVisible) { invisible(self); } return(true); } #endregion return(false); }