new void Morir() { Debug.Log("Jugador Murio"); TextoHit textoDeMuerte = GenerartextHit("FELIZ CUMPLEAÑOS!!!!", 10, Color.red, 0.5f, new Vector2(0, 0), new Vector2(4, 4)); textoDeMuerte.transform.parent = null; textoDeMuerte.transform.position = transform.position + new Vector3(0, 2, 0); OnMorir?.Invoke(); Destroy(gameObject); }
public TextoHit CrearTextoHit(string contenido, Transform parent, float tamaño, Color color, Vector2 desfaseX, Vector2 desfaseY, float tiempoDeVida) { textoHit.tiempoDeVida = tiempoDeVida; Vector3 desfase = new Vector2(Random.Range(desfaseX.x, desfaseX.y), Random.Range(desfaseY.x, desfaseY.y)); TextoHit texto = Instantiate(textoHit, parent.transform.position + desfase, Quaternion.identity, parent); //Inicializar primero, luego definir parámetros texto.textMesh.color = color; texto.textMesh.characterSize = tamaño; texto.textMesh.text = contenido; return(texto); }