Algoritmo de Búsqueda 12/05/2022
Algoritmo de Búsqueda
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BehaviourTraining : MonoBehaviour
{
public bool vaALlover = true;
public bool soyMujer = true;
public int edad = 29;
public int dinero = 100;
public bool amigomilloneti = true;
public ArrayList userInfo = new ArrayList();
public int[] number = new int[4];
public int[] cumpleaños = new int[] { 10, 21, 32, 22 };
public string[] jugadores = new string[8];
public string[] enemigos = new string[] { "malo", "ciclope", "murcielago", "coche", "jefe" };
public Hashtable personalInfo = new Hashtable();
void Awake()
{
int posicionCoche = -1;
for (int n = 0; n<enemigos.Length; n++)
{
if (enemigos[n] == "batman")
{
Debug.Log("he encontrado el coche");
posicionCoche = n;
break;
}
}
if (posicionCoche != -1)
{
Debug.Log("Batman esta en la posicion" + posicionCoche);
}
else
{
Debug.Log ("No hemos encontrado lo que buscabas. Aqui no esta");
}
int cumpleaño = cumpleaños[2];
Debug.Log("El primer numero es" + cumpleaño);
userInfo.Add(10);
userInfo.Add(3.5);
userInfo.Add("Teresa Cruz");
userInfo.Add("TuJefa");
userInfo.Add(GameObject.Find("Cube"));
userInfo.Add("Hashtable");
Debug.Log(userInfo[2] + "Es del Tipo" + userInfo[2].GetType());
Debug.Log(userInfo[4] + "Es del Tipo" + userInfo[4].GetType());
personalInfo.Add("user Level", 10);
personalInfo.Add("time player", 3.5);
personalInfo.Add("user name", "Teresa Cruz");
personalInfo.Add("NickName", "TuJefa");
personalInfo.Add("BullshitFromScene", GameObject.Find("Cube"));
personalInfo.Add("Respuesta", "Hashtable");
Debug.Log((string)personalInfo["NickName"]);
Debug.Log((int)personalInfo["user Level"]);
Debug.Log((double)personalInfo["time player"]);
Debug.Log((string)personalInfo["user name"]);
Debug.Log((GameObject)personalInfo["BullshitFromScene"]);
Debug.Log((string)personalInfo["Respuesta"]);
if (personalInfo.Contains("user name"))
{
Debug.Log("hola Respuesta" + (string)personalInfo["user name"] + "Bienvenido a Nuestro juego , Diviertete!");
}
else
{
Debug.Log("Hola desconocido resgistrate");
}
}
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
//Debug.Log (Time.time);
}
}

Comentarios
Publicar un comentario