public void End()
 {
     base.Close();
     if (variable != null)
     {
         variable.MainAnchor = variable.SubAnchor;
         variable.SubAnchor  = null;
         variable.Anchorable.anchorLerpCoeffPerSec = variable.MainAnchor.LerpCoeficient;
         variable.Anchorable.anchor     = variable.MainAnchor;
         variable.Anchorable.isAttached = true;
         variable.Anchorable.anchor.NotifyAttached(variable.Anchorable);
         variable.Interaction.ignoreGrasping = false;
         variable = null;
     }
     if (objeto != null)
     {
         Contraer();
         objeto.MainAnchor = objeto.SubAnchor;
         objeto.SubAnchor  = null;
         objeto.Anchorable.anchorLerpCoeffPerSec = objeto.MainAnchor.LerpCoeficient;
         objeto.Anchorable.anchor     = objeto.MainAnchor;
         objeto.Anchorable.isAttached = true;
         objeto.Anchorable.anchor.NotifyAttached(objeto.Anchorable);
         objeto.Interaction.ignoreGrasping = false;
         objeto = null;
     }
 }
    public void Open(VariableObjeto _variable)
    {
        Open();
        variable            = _variable;
        variable.SubAnchor  = variable.MainAnchor;
        variable.MainAnchor = anchorVariable;
        variable.Anchorable.anchorLerpCoeffPerSec = anchorVariable.LerpCoeficient;
        variable.Anchorable.anchor     = anchorVariable;
        variable.Anchorable.isAttached = true;
        variable.Anchorable.anchor.NotifyAttached(variable.Anchorable);
        anchorMetodo.gameObject.SetActive(false);
        if (Manager.Instance.english)
        {
            info.text = "To run methods, asign an object to the variable";
        }
        else
        {
            info.text = "Para poder ejecutar metodos, asigna un objeto a la variable";
        }

        if (variable.objetoReferenciado != null)
        {
            objeto            = variable.objetoReferenciado;
            objeto.SubAnchor  = objeto.MainAnchor;
            objeto.MainAnchor = anchorObjeto;
            objeto.Anchorable.anchorLerpCoeffPerSec = anchorObjeto.LerpCoeficient;
            objeto.Anchorable.anchor     = anchorObjeto;
            objeto.Anchorable.isAttached = true;
            objeto.Anchorable.anchor.NotifyAttached(objeto.Anchorable);
            anchorMetodo.gameObject.SetActive(true);
            info.text  = "";
            title.text = "Variable: " + variable.nombre;
            Expandir();
        }
    }
Example #3
0
 public void RemoveAllVariables()
 {
     for (int i = 0; i < variables.Count; i++)
     {
         CustomAnchor   anchor    = gridVariable.FirstOrDefault(x => x.objectAnchored == variables[i]);
         VariableObjeto oldObject = anchor.objectAnchored as VariableObjeto;
         variables.Remove(oldObject);
         anchor.NotifyDetached(oldObject.Anchorable);
         Destroy(oldObject.gameObject);
         anchor.gameObject.SetActive(false);
         activeVariableAnchors--;
         i--;
         m.NumberVariables--;
     }
 }
Example #4
0
 public void SpawnVariable(string clase, string nombre, Material colorVariable, Material colorClase)
 {
     if (activeVariableAnchors < gridVariable.Count)
     {
         CustomAnchor   anchor   = gridVariable.FirstOrDefault(x => !x.gameObject.activeSelf);
         VariableObjeto variable = Instantiate(Manager.Instance.variableObjetoPrefab, anchor.transform.position, anchor.transform.rotation, variablesPivot);
         anchor.gameObject.SetActive(true);
         anchor.objectAnchored = variable;
         variables.Add(variable);
         activeVariableAnchors++;
         variable.ColorClase    = colorClase;
         variable.ColorVariable = colorVariable;
         variable.Init(nombre, clase, anchor, colorVariable, colorClase);
         c.Write("<#" + ColorUtility.ToHtmlStringRGB(colorClase.color) + ">" + clase + "</color>" + " " + "<#" + ColorUtility.ToHtmlStringRGB(colorVariable.color) + ">" + nombre + "</color>" + ";");
     }
 }
Example #5
0
 public void RemoveOneVariable(CustomAnchorable c)
 {
     if (activeVariableAnchors > 0)
     {
         CustomAnchor   anchor    = gridVariable.FirstOrDefault(x => x.objectAnchored == c);
         VariableObjeto oldObject = anchor.objectAnchored as VariableObjeto;
         variables.Remove(oldObject);
         anchor.NotifyDetached(oldObject.Anchorable);
         Destroy(oldObject.gameObject);
         anchor.gameObject.SetActive(false);
         activeVariableAnchors--;
         Debug.Log(activeObjectAnchors);
         m.NumberVariables--;
     }
     else
     {
         Debug.Log("No existen objetos creados");
     }
 }
Example #6
0
    // Start is called before the first frame update
    void Start()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        else
        {
            Destroy(this.gameObject);
        }

        languageControl.selectedLanguage = 1;
        languageControl.UpdateTextTranslation();

        prefabsPivot = GameObject.FindGameObjectWithTag("PrefabPivot").transform;

        AssetBundle bundle = AssetBundle.LoadFromFile(Path.Combine(Application.streamingAssetsPath, "objeto"));

        objetoBasePrefab = Instantiate(bundle.LoadAsset <GameObject>("ObjetoBasico"), new Vector3(400, 400, 400), Quaternion.Euler(0, 0, 0), prefabsPivot).GetComponent <ObjetoBase>();
        bundle.Unload(false);

        bundle = AssetBundle.LoadFromFile(Path.Combine(Application.streamingAssetsPath, "variable_objeto"));
        variableObjetoPrefab = Instantiate(bundle.LoadAsset <GameObject>("VariableObjeto"), new Vector3(500, 500, 500), Quaternion.Euler(0, 0, 0), prefabsPivot).GetComponent <VariableObjeto>();
        bundle.Unload(false);

        bundle              = AssetBundle.LoadFromFile(Path.Combine(Application.streamingAssetsPath, "variables"));
        intVariablePrefab   = Instantiate(bundle.LoadAsset <GameObject>("IntVariable"), new Vector3(700, 700, 700), Quaternion.Euler(0, 0, 0), prefabsPivot).GetComponent <IntVariable>();
        floatVariablePrefab = Instantiate(bundle.LoadAsset <GameObject>("FloatVariable"), new Vector3(700, 700, 700), Quaternion.Euler(0, 0, 0), prefabsPivot).GetComponent <FloatVariable>();
        boolVariablePrefab  = Instantiate(bundle.LoadAsset <GameObject>("BoolVariable"), new Vector3(700, 700, 700), Quaternion.Euler(0, 0, 0), prefabsPivot).GetComponent <BoolVariable>();
        bundle.Unload(false);

        bundle = AssetBundle.LoadFromFile(Path.Combine(Application.streamingAssetsPath, "metodos"));
        List <GameObject> metodos = bundle.LoadAllAssets <GameObject>().ToList();

        foreach (GameObject g in metodos)
        {
            MetodoBase m = Instantiate(g, new Vector3(800, 800, 800), Quaternion.Euler(0, 0, 0), prefabsPivot).GetComponent <MetodoBase>();
            metodosPrefab.Add(m.nombre, m);
        }
        bundle.Unload(false);

        menus = new Dictionary <string, CustomMenu>();

        List <CustomMenu> menusList = FindObjectsOfType <CustomMenu>().ToList();

        foreach (CustomMenu c in menusList)
        {
            menus.Add(c.name, c);
        }

        foreach (CustomMenu c in menus.Values)
        {
            c.Init();
        }

        StringExtension.Init();

        mg  = (MenuGrid)GetMenu("MenuGrid");
        mc  = (MenuClases)GetMenu("MenuClases");
        c   = (Consola)GetMenu("Consola");
        co  = (CreadorObjetos)GetMenu("CreadorObjetos");
        ca  = (CreadorAtributos)GetMenu("CreadorAtributos");
        cm  = (CreadorMetodos)GetMenu("CreadorMetodos");
        ini = (MenuInicio)GetMenu("MenuInicio");

        aud = GetComponent <AudioSource>();

        string path = Path.Combine(Application.streamingAssetsPath, "save.sv");

        if (!File.Exists(path))
        {
            ini.GetButton("Cargar").Blocked = true;
        }
    }