void OnMouseDown()
    {
        GameObject temp;
        Vector3    pos = this.transform.position;

        pos.y = pos.y + 0.3f;
        //pos.x = pos.x + 0.25f;
        temp = (GameObject)Instantiate(torre1, pos, Quaternion.identity);
        temp.transform.position = pos;
        temp.layer = 5;
        hud        = HudG.GetInstance();
        torre      = temp.GetComponentInChildren <Torre>();


        if (torre.Valor_actual1 < hud.Contador_monedas)
        {
            torre.Esta_viva = false;
            Destroy(this.gameObject);
            hud.DescontarSaldo(torre.Valor_actual1);
        }
        else
        {
            Destroy(temp);
            hud.ErrorSaldo();
        }
    }
Exemplo n.º 2
0
    private void OnMouseDown()
    {
        hud = HudG.GetInstance();

        if (Valormejora < hud.Contador_monedas)
        {
            estados.SetInteger("Nivel", 1);
            Instantiate(mejora, this.transform.position, Quaternion.identity);
            ct.CambiarEstadoBotones(false);
            child.SetActive(true);
            hud.DescontarSaldo(Valormejora);
        }
        else
        {
            hud.ErrorSaldo();
        }
    }