-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDataRecorder.cs
More file actions
107 lines (85 loc) · 3.98 KB
/
Copy pathDataRecorder.cs
File metadata and controls
107 lines (85 loc) · 3.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using System.IO;
using UnityEngine;
/*
* this class is developed by for asdakjsd..sd.as.d
*/
public class DataRecorder : MonoBehaviour {
public string m_path;
public string m_filename = "GarenHeatmap";
public PlayerController playerController;
// Use this for initialization
void Start () {
}
//open the file, empty contents save. Or create new file and replace old one.
public void clearFile() {
}
/*
* This function will open the file using the path variable
* and then adds whatever the user is sending to the beginning of the file
* If you don't specify a seperator for this function, it will automatically uses ;
*/
public bool addToStart(string _whatever,string _seperator = ";") {
return true;
}
/*
* This function will open the file using the path variable
* and then adds whatever the user is sending to the end of the file
* If you don't specify a seperator for this function, it will automatically uses ;
* if the user doesn'tspecity whether to add timestamp. by default this funciton will add it as the last column for each line or before the seperator.
*/
public bool appendToEnd(string _whatever, string _seperator = ";", bool _addTimeStape = true)
{
string path = "Assets/Resources/DeathPositions.txt";
//Write death position vector to text file
StreamWriter writer = new StreamWriter(path, true);
//Write death position in the form of 3 individual floats with commas to split values & semicolon to break vector3's
writer.WriteLine(playerController.deathPos.x + "," + playerController.deathPos.y + "," + playerController.deathPos.z + ";"); //writer.WriteLine(playerController.deathPos + ";"); /*<<optional variant for position grab>>*/
writer.Close();
////Re-import the file to update the reference in the editor
AssetDatabase.ImportAsset("Assets/Resources/DeathPositions");
TextAsset asset = Resources.Load<TextAsset>("Assets/Resources/DeathPositions.txt");
////Print the text from the file
print(playerController.myDeathPoss.text);
return true;
}
public bool appendToEnd(Vector3 _pos, string _seperator = ";", bool _addTimeStape = true)
{
string path = "Assets/Resources/DeathPositions.txt";
//Write death position vector to text file
StreamWriter writer = new StreamWriter(path, true);
//writer.WriteLine(deathPos.x + "," + deathPos.y + "," + deathPos.z + ";");
writer.WriteLine(_pos + ";");
writer.Close();
////Re-import the file to update the reference in the editor
AssetDatabase.ImportAsset("Assets/Resources/DeathPositions");
TextAsset asset = Resources.Load<TextAsset>("Assets/Resources/DeathPositions.txt");
////Print the text from the file
print(playerController.myDeathPoss.text);
return true;
}
public bool appendToEnd(Vector2 _pos, string _seperator = ";", bool _addTimeStape = true)
{
//string path = "Assets/Resources/DeathPositions.txt";
////Write death position vector to text file
//StreamWriter writer = new StreamWriter(path, true);
////writer.WriteLine(deathPos.x + "," + deathPos.y + "," + deathPos.z + ";");
//writer.WriteLine(deathPos + ";");
//writer.Close();
//////Re-import the file to update the reference in the editor
//AssetDatabase.ImportAsset("Assets/Resources/DeathPositions");
//TextAsset asset = Resources.Load<TextAsset>("Assets/Resources/DeathPositions.txt");
//////Print the text from the file
//print(myDeathPoss.text);
return true;
}
public bool createNewFile(string _name)
{
return true;
}
// Update is called once per frame
void Update () {
}
}