sábado, 26 de febrero de 2022

Pinball detalles con C# game over reinicios de juego y de pantallas niveles del videojuego;

 

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DESTRUYEYPASAANIVEL3 : MonoBehaviour {


        void Start () {

            //tickSource = GetComponent<AudioSource> ();



        }

        void Update () {
        }

        void OnTriggerEnter(Collider other) {
            //if (other.gameObject.CompareTag ("avismo")){
            //if (other.gameObject.CompareTag ("ogri2")){
            if (other.gameObject.CompareTag ("juegopierdo")){
                //transform.Rotate (new Vector3 (0 * Time.deltaTime, 91, 90), Space.Self);

                //tickSource.Play ();
                Destroy (gameObject, 2.0f); 



                    Application.LoadLevel (3);/////7originalllllllllllllllllllllllllllll



            }}

    }

 ------------------------------------------------------------------------------------------------------

 

 -----------------------------------------------------------------

----------

  using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;/// <summary>
public class reiniciojuego2 : MonoBehaviour {


        public Text contador1;
        public Text fin1;
        private float tiempo = 8f;


//    void Awake() {

    //}

        // Use this for initialization
        void Start () {
            contador1.text = " " + tiempo;
            fin1.enabled = false;

        }

        // Update is called once per frame
        void Update ()
        {
        
            tiempo -= Time.deltaTime;
            contador1.text = " " + tiempo.ToString ("f0");
            if (tiempo <= 0) {
                contador1.text = "0";
                fin1.enabled = true;

                {
                    //void OnTriggerEnter(Collider other) {
                    //if (other.gameObject.CompareTag ("ogri2 (1)CAMPEONNNNNNNNNNNNNNNNNNN")){

                //    Destroy (gameObject, 0.0f); 

                    {

                        //Application.LoadLevel (1); ESTE ES EL ORIGINALLLLLLL

                        Application.LoadLevel (0);

                    }
                }
            }
        }

    }
---------------------------------------------------------------------

Detalles que se me olvido comentar en el video son por ejemplo un bug que tenia cuando la bola salia pitando como una bala y no retornaba a sus coordenadas por que no tocaba los gameobjects que producían esa accion, lo resolví poniendo un enorme cubo de color negro de fondo y aplanado como un plano con el correspondiente tag “cordena”, así la bola hiciese lo que hiciese si se salia del juego daba hay y volvia a sus coordenadas…..también añado el script que tiene la escena de gameover para que transcurridos 8 segundos se reinicie el juego si se pierden las 3 bolas…...

miércoles, 23 de febrero de 2022

C# niveles con unity;

 


En breves instantes video explicativo........

  using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class AUMENTAPUNTOSP : MonoBehaviour {

        // Create public variables for player speed, and for the Text UI game objects
        public float speed;
        public Text countText;
        public Text winText;

        // Create private references to the rigidbody component on the player, and the count of pick up objects picked up so far
        private Rigidbody rb;
        private int count;/// <summary>

        void Start ()
        {


            // Assign the Rigidbody component to our private rb variable
            rb = GetComponent<Rigidbody>();

            // Set the count to zero 
            count = 0;

            // Run the SetCountText function to update the UI (see below)
            SetCountText ();

            // Set the text property of our Win Text UI to an empty string, making the 'You Win' (game over message) blank
            winText.text = "";
        }

        // store a reference to that collider in a variable named 'other'..
        void OnTriggerEnter(Collider other) 
        {

            //if (other.gameObject.CompareTag ("ogri2"))
            if (other.gameObject.CompareTag ("MATA"))
        //if (other.gameObject.CompareTag ("lateral"))
            {

                // Make the other game object (the pick up) inactive, to make it disappear
//                other.gameObject.SetActive (false);////ESTO DE AQUI SI ESTA ACTIVADO BORRA EL GRAFICO GIRATORIO MUY OMPORTANTISIMO

                // Add one to the score variable 'count'
                count = count + 1;


                // Run the 'SetCountText()' function (see below)
                SetCountText ();
            }
        }

        // Create a standalone function that can update the 'countText' UI and check if the required amount to win has been achieved
        void SetCountText()
        {
            // Update the text field of our 'countText' variable
            //countText.text = "Count: " + count.ToString ();

            countText.text = "PUNTOS: " + count.ToString ();
            // Check if our 'count' is equal to or exceeded 12
            //if (count == 11) 
                //if (count >= 11) /////////original
                if (count >= 44) ////////7original
            {

        //    Destroy (gameObject);

            Application.LoadLevel (1);/////7originalllllllllllllllllllllllllllll

            }
        }
    }


------------------------------------------------------------------------

-------------------------------------------------------------------

------------------------------------------------------------------------


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class AUMENTAPUNTOSPlateral : MonoBehaviour {

        // Create public variables for player speed, and for the Text UI game objects
        public float speed;
        public Text countText;
        public Text winText;

        // Create private references to the rigidbody component on the player, and the count of pick up objects picked up so far
        private Rigidbody rb;
        private int count;/// <summary>

        void Start ()
        {

            // Assign the Rigidbody component to our private rb variable
            rb = GetComponent<Rigidbody>();

            // Set the count to zero 
            count = 44;

            // Run the SetCountText function to update the UI (see below)
            SetCountText ();

            // Set the text property of our Win Text UI to an empty string, making the 'You Win' (game over message) blank
            winText.text = "";
        }

        // store a reference to that collider in a variable named 'other'..
        void OnTriggerEnter(Collider other) 
        {

            //if (other.gameObject.CompareTag ("ogri2"))
            //if (other.gameObject.CompareTag ("MATA"))
        if (other.gameObject.CompareTag ("lateral"))
            {


                // Make the other game object (the pick up) inactive, to make it disappear
//                other.gameObject.SetActive (false);////ESTO DE AQUI SI ESTA ACTIVADO BORRA EL GRAFICO GIRATORIO MUY OMPORTANTISIMO


                // Add one to the score variable 'count'
                count = count + 10;


                // Run the 'SetCountText()' function (see below)
                SetCountText ();
            }
        }

        // Create a standalone function that can update the 'countText' UI and check if the required amount to win has been achieved
        void SetCountText()
        {
            // Update the text field of our 'countText' variable
            //countText.text = "Count: " + count.ToString ();

            countText.text = "PUNTOS: " + count.ToString ();
            // Check if our 'count' is equal to or exceeded 12
            //if (count == 11) 
                //if (count >= 11) /////////original
                if (count >= 4) ////////7original
            {

        //    Destroy (gameObject);

            //Application.LoadLevel (1);/////7originalllllllllllllllllllllllllllll

            }
        }
    }




lunes, 21 de febrero de 2022

Como hacer un pinball con unity sin tener ni idea y asu vez meterlo en otro videojuego echo tambien sin tener ni idea.;

Como hacer un pinball con unity sin tener ni idea y asu vez meterlo en otro videojuego echo tambien sin tener ni idea.;

 

Videojuego THE WOLF MAN OF THE UNDERGROUND beta;

siguiendo este videojuego voy a insertar minijuegos en el, la idea es que en momentos dados el jugador que maneja al hombre lobo desconecte del entorno y se baya por ejemplo a un salón recreativo a jugar a la maquina del millón, la de pegarle a la bola y sumar puntos asta conseguir partidas extra,,,, en este caso seria avanzar en otros niveles del videojuego…..lo estoy haciendo así para ver si descanso del juego de su construcción y luego vuelvo a retomarlo alternando unos temas con otros y compaginándolos en el mismo videojuego de THE WOLF MAN OF THE UNDERGROUND

domingo, 13 de febrero de 2022

PINBALL SCRIPTS EN C# PARA CONSTRUIR EL VIDEOJUEGO;

 


 

 

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class empujafuerteportagestenombre : MonoBehaviour {



        // public float thrust;
        public Rigidbody rb;

        void Start()
        {
            rb = GetComponent<Rigidbody>();
        }

        void OnTriggerEnter(Collider other)
        {
            if (other.gameObject.CompareTag("empujafuerte"))
            {

                rb.AddForce(0.0f, 0f, 177.0f, ForceMode.Impulse);


            }
        }


    }


---------------------------------------------------------------------

--------------------------------------------------------------------

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class altocartagcambialascoordenadas : MonoBehaviour {


        // Use this for initialization
        void Start()
        {

            //transform.rotation = Quaternion.Euler (0,45, 0);
        }



    void Update()
    {
    }

    //void OnCollisionEnter (Collision collision){
    //    if (collision.gameObject.tag == "PUYO modelo"){


    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag("cordena"))
        {


            transform.position = new Vector3 (-38.5f,8.6f, -14.7f);


        }
    }

}

-----------------------------------------------------------------------

------------------------------------------------------------------------


using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class altocartaggiraluzfoco : MonoBehaviour {



        // Use this for initialization
        void Start()
        {

            //transform.rotation = Quaternion.Euler (0,45, 0);
        }


//    float x;/// imbentado


        void Update()
        {
        }

        //void OnCollisionEnter (Collision collision){
        //    if (collision.gameObject.tag == "PUYO modelo"){


        void OnTriggerEnter(Collider other)
        {
            //if (other.gameObject.CompareTag("luzgira"))
        if (other.gameObject.CompareTag("MATA"))
            {


                transform.position = new Vector3 (29.24f,38.13f, -60.19f);//////este funcionaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
            //transform.rotation = new Vector3 (-38.5f,8.6f, -14.7f);

            //transform.rotation = new Vector3  (0.4f, 5.1f, 1.1f);
            //transform.rotation = Quaternion.Euler (0, 5, 0);


            //x += Time.deltaTime * 0.2f;
             
        //    transform.rotation = Quaternion.Euler (x, 0, 0);


            }
        }

    }


--------------------------------------------------------------------

----------------------------------------------------------------------

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class AUMENTAPUNTOSP : MonoBehaviour {

        // Create public variables for player speed, and for the Text UI game objects
        public float speed;
        public Text countText;
        public Text winText;

        // Create private references to the rigidbody component on the player, and the count of pick up objects picked up so far
        private Rigidbody rb;
        private int count;/// <summary>

        void Start ()
        {


            // Assign the Rigidbody component to our private rb variable
            rb = GetComponent<Rigidbody>();

            // Set the count to zero 
            count = 0;

            // Run the SetCountText function to update the UI (see below)
            SetCountText ();

            // Set the text property of our Win Text UI to an empty string, making the 'You Win' (game over message) blank
            winText.text = "";
        }

        // store a reference to that collider in a variable named 'other'..
        void OnTriggerEnter(Collider other) 
        {

            //if (other.gameObject.CompareTag ("ogri2"))
            if (other.gameObject.CompareTag ("MATA"))

            {








                // Make the other game object (the pick up) inactive, to make it disappear
//                other.gameObject.SetActive (false);////ESTO DE AQUI SI ESTA ACTIVADO BORRA EL GRAFICO GIRATORIO MUY OMPORTANTISIMO







                // Add one to the score variable 'count'
                count = count + 1;


                // Run the 'SetCountText()' function (see below)
                SetCountText ();
            }
        }

        // Create a standalone function that can update the 'countText' UI and check if the required amount to win has been achieved
        void SetCountText()
        {
            // Update the text field of our 'countText' variable
            //countText.text = "Count: " + count.ToString ();

            countText.text = "PUNTOS: " + count.ToString ();
            // Check if our 'count' is equal to or exceeded 12
            //if (count == 11) 
                //if (count >= 11) /////////original
                if (count >= 40) ////////7original
            {







            Application.LoadLevel (1);





            }
        }
    }



CONTINUARA......ESTA EN CONSTRUCCION.........................................................................

..........................