void _ShowTheHitedPoint(bool _flagHit, Vector3 pos, Vector3 direction, float enableTime) { // Firstly, set the jet point. if (jetPoint == null) { // Get the quaternion from direction. Quaternion quaternion = Quaternion.identity; if (direction != Vector3.zero) { quaternion = Quaternion.LookRotation(direction); } // Instance a jet point. GameObject objHiter = Instantiate(objectHiter, pos, quaternion, transform); jetPoint = new JetPoint(true, enableTime, jettingForce, forceInterval, jettingSize, forceType, objHiter.transform); // Setting jet prepoping if (jPrepoping != null) { jPrepoping.jPoints.listPoint.Add(jetPoint); jPrepoping.PrePoping(); //Debug.Log("pre poping"); } } else { // Refresh the jet point. jetPoint.Refresh(_flagHit, enableTime, pos); } }
public void Forcast() { JetPoint point = new JetPoint(true, Time.time + shootAI.GetRemainTime, force, forceInterval, forceAreaSize, forceType, shootAI._ballTarget); JetPrePoping prepoing = jprcontroller.GetPrePop(); prepoing.jPoints.listPoint.Add(point); prepoing.PrePoping(); }
IEnumerator _Setting() { // Stop to update. flagSetup = false; // Set the reading path. string path; if (pathRecorderFolder != "") { path = Application.dataPath + "/" + pathRecorderFolder + "/" + nameAnimation + ".txt"; } else { path = Application.dataPath + "/" + nameAnimation + ".txt"; } // Read the file. string[] listPos = null; try { listPos = File.ReadAllLines(path); } catch (FileNotFoundException e) { Debug.Log(e.ToString()); yield break; } // Get the rate of recording. rateRecord = float.Parse(listPos[0]); timeEnd = (listPos.Length - 1) * rateRecord + timeStart; Vector3 start = new Vector3(); Vector3 end = new Vector3(); GameObject hitObject; string[] datas; // Parse the file. for (int i = 1; i < listPos.Length; i++) { datas = listPos[i].Split(' '); if (datas.Length == 6) { start.x = float.Parse(datas[0]); start.y = float.Parse(datas[1]); start.z = float.Parse(datas[2]); // Transform the point from local to world. start = transRecorderBase.TransformPoint(start.x, start.y, start.z); end.x = float.Parse(datas[3]); end.y = float.Parse(datas[4]); end.z = float.Parse(datas[5]); // Transform the point from local to world. end = transRecorderBase.TransformPoint(end.x, end.y, end.z); listStartNode.Add(start); listEndNode.Add(end); // Prepare hited objects. hitObject = Instantiate(objectHiter, start, Quaternion.identity, transform); hitObject.SetActive(true); // Set jet point. JetPoint point = new JetPoint((timeStart + timeWaitToPlayAnimation + i * rateRecord), jettingForce, rateRecord, jettingSize, forceType, hitObject.transform); listJetPoint.Add(point); // Show debug line render. if (debugHitedLineRender != null) { LineRenderer lr = Instantiate(debugHitedLineRender, transform).GetComponent <LineRenderer>(); if (lr != null) { Debug.Log("show debug hited line render."); lr.positionCount = 2; lr.SetPosition(0, start); lr.SetPosition(1, end); } } } else { _ChecksSetting("The file format does not correct. path: " + path, true); } } // Update hited position. _DectectHit(); // Show the predicted points to jet. if (jPrepoping != null) { jPrepoping.jPoints.listPoint = listJetPoint; jPrepoping.PrePoping(); //Debug.Log("Prepoping jetpoints"); } // Recorve to update. flagSetup = true; }