public void GetGuard()
    {
        combateWitchEnemy = false;
        player.StartPlayer();
        GameObject guardaContainer = GameObject.FindGameObjectWithTag("Guarda");

        tempGuard = guardaContainer.gameObject.GetComponent <Guarda>();
        type.Add(tempGuard.type);
        life.Add(tempGuard.life);
        CombatMode();
    }
Exemple #2
0
    // Use this for initialization
    void Start()
    {
        botoncillo = GameObject.Find("Boton");
        botoncillo.SetActive(false);
        Time.timeScale = 1;
        tiempoJuego    = Time.realtimeSinceStartup;
        nLosas         = 0;
        punt           = 0;
        GameObject ob = GameObject.Find("Guardar");
        Guarda     g  = (Guarda)ob.GetComponent(typeof(Guarda));

        puntMax = g.GetPuntuacion();
        posLosa = new Vector3(2f, 0f, 2f);
    }
    void Start()
    {
        containerGuarda = GameObject.FindGameObjectWithTag("Guarda");
        scriptGuarda    = containerGuarda.GetComponent <Guarda>();

        ScriptInventario = this.gameObject.GetComponent <Inventario> ();

        ScriptInventario.level = 1;
        segueMouse             = true;
        escondido = false;
        canHidde  = false;
        agent     = GetComponent <NavMeshAgent> ();
        zero      = new Vector3(0, 0, 0);

        scriptAudios.audioViking();
    }
Exemple #4
0
    // Update is called once per frame
    void Update()
    {
        //Juego Acabado
        if (this.transform.position.y <= 0)
        {
            GameObject ob = GameObject.Find("Terreno");
            Main       m  = (Main)ob.GetComponent(typeof(Main));
            if (!pausa)
            {
                tiempo = Time.realtimeSinceStartup - m.tiempo();
                pausa  = true;
            }

            m.botoncillo.SetActive(true);
            ob = GameObject.Find("Text");
            Text t = ob.GetComponent <Text>();
            t.text = ("Puntuacion: " + m.puntuacion() + "\nPuntuacion Maxima: " + m.puntuacionMax() + "\nTiempo: " + tiempo);

            ob = GameObject.Find("Guardar");
            Guarda g = (Guarda)ob.GetComponent(typeof(Guarda));

            if (m.puntuacionMax() < m.puntuacion())
            {
                g.SetPuntuacion(m.puntuacion());
            }

            Time.timeScale = 0;
        }
        //En otro caso
        else
        {
            //if (Input.GetKeyDown(KeyCode.Space))
            if (Input.touchCount == 1 && Input.GetTouch(0).phase == TouchPhase.Ended)
            {
                derecha = !derecha;
            }

            if (derecha)
            {
                this.transform.Translate(new Vector3(velocidad, 0f, 0f));
            }
            else
            {
                this.transform.Translate(new Vector3(0f, 0f, velocidad));
            }
        }
    }