void Awake() { QualitySettings.vSyncCount = 0; // VSync must be disabled Application.targetFrameRate = 60; rbPlayer = player.GetComponent <Rigidbody>(); rbGalaxy = galaxySphere.GetComponent <Rigidbody>(); // recCrossHair = crossHair.GetComponent<RectTransform>(); // recCrossHairA = crossHairA.GetComponent<RectTransform>(); // recCrossHairB = crossHairB.GetComponent<RectTransform>(); playerControll = player.GetComponent <scrPlayerControll>(); recTargetEnemy = ParentTargetEnemy.GetComponent <RectTransform>(); meteorA.poolMeteor = new List <GameObject>(); meteorSide.poolMeteor = new List <GameObject>(); poolTargetEnemy = new List <GameObject>(); poolExplotionMeteor = new List <GameObject>(); item.poolEnergy = new List <GameObject>(); initialGalaxyDust = galaxyDust.transform.position; initialBoundary = traBoundary.transform.position; mv = SaveLoadXml.LoadVectorsFromResources(pathMeteorLevel01); mhv = SaveLoadXml.LoadVectorsFromResources(pathHealthLevel01); //mv = SaveLoadXml.LoadXml(pathMeteorLevel01 + "/" + FileName); //SaveLoadXml.SaveDialogueXml(pathMeteorLevel01 , new ManualVectors()); //GetVectors(); }
public static void SaveDialogueXml(string txtFile, ManualVectors vectors) { try { XmlSerializer serz = new XmlSerializer(typeof(ManualVectors)); StreamWriter writer = new StreamWriter("Assets/Resources/" + txtFile + ".xml"); serz.Serialize(writer, vectors); writer.Close(); Debug.Log("GUARDADO - " + txtFile); } catch (Exception ex) { Debug.Log(ex.Message.ToString()); } }
//public static BinaryFormatter binaryFormatter = new BinaryFormatter(); public static ManualVectors LoadVectorsFromResources(string path) { // if your original XML file is located at // "Ressources/MyXMLFile .xml" //Resources.Load("MyXMLFile"); TextAsset textAsset = (TextAsset)Resources.Load(path); //XmlDocument xmldoc = new XmlDocument(); //xmldoc.LoadXml(textAsset.text); ManualVectors dia = new ManualVectors(); XmlSerializer serz = new XmlSerializer(typeof(ManualVectors)); using (StringReader reader = new StringReader(textAsset.text)) { if (reader.ReadLine() != null) { dia = (ManualVectors)serz.Deserialize(reader); } } Debug.Log("CARGADO - XML METEOR"); return(dia); }