void Initialize(List <Vector3> Path) { PlayerPrefs.SetInt("Points", 0); PlayerPrefs.SetInt("Collision", 0); float D = CalculateDistance(Path); PlayerPrefs.SetString("StartTime", System.DateTime.Now.ToString()); FilePath = Application.dataPath + "/Resources/Records/" + PlayerPrefs.GetInt("UserID").ToString() + "-" + Round + ".txt"; PlayerPrefs.SetString("FilePath", FilePath); if (!File.Exists(FilePath)) { //Directory.CreateDirectory(Application.dataPath + "/Resources/Records/" + PlayerPrefs.GetInt("UserID").ToString() + "/" + TaskID + ".txt"); File.WriteAllText(FilePath, "TaskID: " + Round.ToString() + " \n" + "StartTime: " + PlayerPrefs.GetString("StartTime") + PlayerPrefs.GetString("SetString") + " \n" + "Distance: " + D + " \n"); } WaypointIndex = 0; // for headUp and plane PathForPlane = new List <Vector3>(Path); //set all things invisible GameObject[] Arrows = GameObject.FindGameObjectsWithTag("Arrows"); foreach (GameObject a in Arrows) { Destroy(a); } Plane.SetActive(false); HeadUp.SetActive(false); NextRound.SetActive(false); DisplayNext = false; //invisit all waypoints GameObject[] WayPointSets = GameObject.FindGameObjectsWithTag("WayPointSet"); foreach (GameObject WayPointSet in WayPointSets) { WayPointSet.SetActive(false); } //invisit all obstacles GameObject[] ObstacleSets = GameObject.FindGameObjectsWithTag("ObstacleSet"); foreach (GameObject ObstacleSet in ObstacleSets) { ObstacleSet.SetActive(false); } //user at starting point, diamond at destination Diamond.transform.position = Path.Last(); Diamond.SetActive(true); Player.transform.position = Path[0]; Plane.transform.position = Path[0]; ShowWayPoint(Round); ShowObstacle(Round); }
void Start() { _instance = this; _wayPointSet = transform.GetComponentsInChildren <WayPointController>(); /* Vector3 _offeset = new Vector3(-6, 0, -6); * int count = 0; * for (int i = 0; i < 10; i++) * { * for (int j = 0; j < 5; j++) * { * GameObject go = GameObject.Instantiate(wayPointPrefab) as GameObject; * go.transform.parent = transform; * go.transform.localPosition = new Vector3((i * 1.3f + _offeset.x), 0, (j * 1.4f + _offeset.z)); * go.name = "waypoint_" + count; * count++; * } * }*/ }