Menú

Mostrar Mensajes

Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.

Mostrar Mensajes Menú

Temas - kalm97

#21
General (Antiguo) / Problemas con botones UI
Enero 09, 2016, 08:59:12 PM
Muy buenas a todos tengo un problema, quiero hacer botones que cuando se pase el mouse encima sin hacer click aparesca una informacion...porque cuando hace click aparece un menu donde se escribe el nombre, de ahi quiero hacer que cuando escriba el nombre en el Input field aparesca en un objeto text... si me ayudan con esas 2 cositas me arian el hombre mas feliz del mundo....!!!! grasias por su atencion
#22
General (Antiguo) / Guardar y cargar datos
Enero 02, 2016, 07:43:04 PM
Hola a todos tengo una duda un poco complicada y que no llego a entender disene este codigo para guardar y cargar datos de experiencia y funciona muy bien y ahora le instale para que me guarde en que nivel esta el jugador pero cuando inicio la partida ningun deja de funcionar el codigo entero, aqui les dejo todo el script... using UnityEngine;
using System.Collections;
using System;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
using UnityEngine.UI;public class GameControl : MonoBehaviour {    public static GameControl control;    public float experienceunos;
    public Text InputTextuno;
    public Text pointsTextuno;    public float experiencedoss;
    public Text InputTextdos;
    public Text pointsTextdos;    public float experiencetress;
    public Text InputTexttres;
    public Text pointsTexttres;     public bool uno = false;
    public bool dos = false;
    public bool tres = false;    private Player player;
    private DoorNivel dn;    void Update(){
        if (uno) {
            InputTextuno.enabled = true;
            pointsTextuno.enabled = true;
            pointsTextuno.text = ("Points :  " + experienceunos);
        } else {
            InputTextuno.enabled = false;
            pointsTextuno.enabled = false;
        }
        if (dos) {
            InputTextdos.enabled = true;
            pointsTextdos.enabled = true;
            pointsTextdos.text = ("Points :  " + experiencedoss);
        } else {
            InputTextdos.enabled = false;
            pointsTextdos.enabled = false;
        }
        if (tres) {
            InputTexttres.enabled = true;
            pointsTexttres.enabled = true;
            pointsTexttres.text = ("Points :  " + experiencetress);
        } else {
            InputTexttres.enabled = false;
            pointsTexttres.enabled = false;
        }
    }    void Start (){
        player = gameObject.GetComponent<Player> ();
        dn = gameObject.GetComponent<DoorNivel> ();
    }
        void Awake(){
        if (control == null) {
            control = this;
            DontDestroyOnLoad (gameObject);
        } else if (control != this) {
            Destroy(gameObject);
        }
    }    
    // Update is called once per frame
    void OnGUI () {
    
//        GUI.Button (new Rect (10, 40, 100, 60), "Experience: " + experience);    }
    public void Save(){
        if (uno) {
            BinaryFormatter bf = new BinaryFormatter ();
            FileStream file = File.Create (Application.persistentDataPath + "/playerInfo.dat.uno");
            PlayerData data = new PlayerData ();
//            PlayerData data1 = new PlayerData ();
            data.experienceuno = experienceunos;
//            data1.levelReacheduno = dn.levelReacheduno;
            bf.Serialize (file, data);
            file.Close ();
        }
        if (dos) {
            BinaryFormatter bf = new BinaryFormatter ();
            FileStream file = File.Create (Application.persistentDataPath + "/playerInfo.dat.dos");
            PlayerData data = new PlayerData ();
//            PlayerData data1 = new PlayerData ();
            data.experiencedos = experiencedoss;
//            data1.levelReacheddos = dn.levelReacheddos;
            bf.Serialize (file, data);
            file.Close ();
        }    }
    public void Load(){
        if (uno) {
            if (File.Exists (Application.persistentDataPath + "/playerInfo.dat.uno")) {
                BinaryFormatter bf = new BinaryFormatter ();
                FileStream file = File.Open (Application.persistentDataPath + "/playerInfo.dat.uno", FileMode.Open);
                PlayerData data = (PlayerData)bf.Deserialize (file);
//                PlayerData data1 = (PlayerData)bf.Deserialize (file);
                file.Close ();                experienceunos = data.experienceuno;
//                dn.levelReacheduno = data1.levelReacheduno;
            }        }
        if (dos) {
            if (File.Exists (Application.persistentDataPath + "/playerInfo.dat.uno")) {
                BinaryFormatter bf = new BinaryFormatter ();
                FileStream file = File.Open (Application.persistentDataPath + "/playerInfo.dat.dos", FileMode.Open);
                PlayerData data = (PlayerData)bf.Deserialize (file);
//                PlayerData data1 = (PlayerData)bf.Deserialize (file);
                file.Close ();
                
                experiencedoss = data.experiencedos;
//                dn.levelReacheddos = data1.levelReacheddos;
            }
            
        }    }}
[Serializable]
class PlayerData{
    
    public float experienceuno;
    public float experiencedos;
    public float experiencetres;
    public int levelReacheduno;
    public int levelReacheddos;
    public int levelReachedtres;
} anote en rojo el codigo que adjunte para guardar los datos de cuantos niveles paso el jugador.
#23
General (Antiguo) / rotar true y false con la misma accion
Diciembre 02, 2015, 01:41:51 AM
Buenas a todos tengo una duda quiero que cuando el enemigo choque con otro se den la vuelta y sigan su curso ya logre q giren y avancen pero solo lo hacen una vez y no se como hacer un bucle o algo asi aqui les dejo el script que tengo...    void Update () {
        if (!right) {
            transform.Translate (Vector3.left * Time.deltaTime * velocidad, Camera.main.transform);
        }
        if (right) {
            transform.Translate (Vector3.right * Time.deltaTime * velocidad, Camera.main.transform);
        }
    }    void OnTriggerEnter2D(Collider2D col){
        
        if(col.isTrigger != true){
            
            if(col.CompareTag("Player")){
                col.GetComponent<Player>().Damage(1);
            }
        }
        if (col.isTrigger != true) {
            if(col.CompareTag("Enemy")){
                this.transform.Rotate (Vector3.up, 180);
                right = true;
            }
        }
    }marque en rojo lo que quiero hacer q cada vez que compare Enemy eso aga true false true false asi no se si me entendieron.....
#24
General (Antiguo) / Crear juegos profesionalmente
Noviembre 29, 2015, 03:36:37 AM
Que necesito o que estudio para trabajar creando juegos de forma profesional como para llegar a trabajar con Infinity Ward, e tenido esta duda por este mes y no encuentro una información consistente, voy a viajar a francia despues de terminar el bachillerato y no se que estudiar en francia para ser un Game Designer si alguien me puede ayudar seria muy feliz.. 
#25
Buenas a todos tengo la duda de como ago un menu a seleccionar partidas ya echas, que cuando inicie el juego exista un menu con 3 partidas vacias y cuando aga click en alguna se inicie el juego y se guarde todo avance.. osea que cuando aga un UI de botton a hacer click en el boton se cree una partida nueva y que pueda cargar la partida y cuando aga click en el segundo boton se aga otra partida y asi con el tercer boton... No se si me di a entender.. Grasias de antemano...
#26
General (Antiguo) / Disparar projectil
Noviembre 16, 2015, 05:17:53 PM
como ago para que el clon cuando aga spawn se mueva hacia delanteVoid Update(){if (Input.GetButtonDown ("Fire1")) {              shoot();        }}void shoot(){
        GameObject clone;
        if (projectile) {        
            clone = Instantiate (projectile, transform.position, transform.rotation) as GameObject;
            
        }
    } Grasias de antemano
#27
como podría hacer que cuando yo este a la derecha el proyectil vaya a la derecha y cuando yo este viendo a la izquierda el se dispare hacia la izquierda tengo este código para que se mueva...using UnityEngine;
using System.Collections;public class MoverR : MonoBehaviour {    public float velocidad = 4;
    public GameObject F;

    public float L = 0.8f;
    void Start () {    }    void Update () {
         transform.Translate (Vector3.right * Time.deltaTime * velocidad, Camera.main.transform);

        Destroy (F, L);
        }
} con esto se mueve y despues de un sierto tiempo se destruye, como ven el vector es right como ago para que cuando yo este en otro sentido eso cambie a left...
#28
General (Antiguo) / C# Disparar magia
Noviembre 14, 2015, 06:11:33 AM
Tengo un problema con un codigo intento hacer q el personaje dispare una magia,, el ataque aparece pero no se mueve, se queda quieto, este es el comando, porfavor ayudenme antes q me vuelva loco using UnityEngine;
using System.Collections;public class Disparar : MonoBehaviour {    public Rigidbody2D projectile;
    void Update() {
        if (Input.GetButtonDown("Fire1")) {
            Rigidbody2D clone;            clone = Instantiate(projectile, transform.position, transform.rotation) as Rigidbody2D;
            clone.velocity = transform.TransformDirection(Vector3.forward * 10);
        }
    }
}Grasias por su atencion..
#29
Tengo esta script con animaciones para una puerta deslizable  pero lo quiero cambiar a una script general para no hacer muchas animaciones y q crasheen el juego, en vez de una animacion quisiera que e #pragma strictprivate var guiShow : boolean = false;var isOpen : boolean = false;
var door : GameObject;
var rayLength = 10;function Update()
{    var hit : RaycastHit;
    var fwd = transform.TransformDirection(Vector3.forward);
    
    if(Physics.Raycast(transform.position, fwd, hit, rayLength))
    {
        if(hit.collider.gameObject.tag == "Door")
        {
            guiShow = true;
            if(Input.GetKeyDown("e") && isOpen == false)
            {
                door.animation.Play("Door1");
                isOpen = true;
                guiShow = false;
            }
            
            else if(Input.GetKeyDown("e") && isOpen == true)
            {
                door.animation.Play("Door2");
                isOpen = false;
                guiShow = false;
            }
        }
    }
    
    else
    {
        guiShow = false;
    }
}function OnGUI()
{
    if(guiShow == true && isOpen == false)
    {
        GUI.Box(Rect(Screen.width / 2, Screen.height / 2, 100, 25), "E");
    }
    if(guiShow == true && isOpen == true)
    {
        GUI.Box(Rect(Screen.width / 2, Screen.height / 2, 100, 25), "E");
  }
} Ya este script ya lo subi con la misma intencion pero no comprendo lo q me quieren desir no soy bueno asiendo codigos...
#30
General (Antiguo) / Mover una puerta deslizable
Julio 20, 2015, 09:47:54 PM
Quiero hacer una puerta delizable para una nave sci-fi y quiero q la puerta se translade pero en un tiempo determinado marque el parrafo en rojo cuando ago click E se mueve pero de golpe llega a la ubicacion y no como hacerprivate var guiShow : boolean = false;var isOpen : boolean = false;
var objVel:int = 10;
var door : GameObject;var rayLength = 10;function Update()
{
    var hit : RaycastHit;
    var fwd = transform.TransformDirection(Vector3.forward);
    
    if(Physics.Raycast(transform.position, fwd, hit, rayLength))
    {
        if(hit.collider.gameObject.tag == "Door")
        {
            guiShow = true;
            if(Input.GetKeyDown("e") && isOpen == false)
            {
                door.transform.Translate(Vector3(0,20,0) * objVel * Time.deltaTime);
                isOpen = true;
                guiShow = false;

            }
            
            else if(Input.GetKeyDown("e") && isOpen == true)
            {
                door.animation.Play("Door2");
                isOpen = false;
                guiShow = false;
            }
        }
    }
    
    else
    {
        guiShow = false;
    }
}function OnGUI()
{
    if(guiShow == true && isOpen == false)
    {
        GUI.Box(Rect(Screen.width / 2, Screen.height / 2, 100, 25), "E");
    }
    if(guiShow == true && isOpen == true)
    {
        GUI.Box(Rect(Screen.width / 2, Screen.height / 2, 100, 25), "E");
    }
}