// Update is called once per frame void Update() { nextParbola = false; if (Animation && parabolaFly != null && animationTime < parabolaFly.GetDuration()) { int parabolaIndexBefore; int parabolaIndexAfter; parabolaFly.GetParabolaIndexAtTime(animationTime, out parabolaIndexBefore); animationTime += Time.deltaTime; parabolaFly.GetParabolaIndexAtTime(animationTime, out parabolaIndexAfter); transform.position = parabolaFly.GetPositionAtTime(animationTime); if (parabolaIndexBefore != parabolaIndexAfter) { nextParbola = true; } //if (transform.position.y > HighestPoint.y) //HighestPoint = transform.position; } else if (Animation && parabolaFly != null && animationTime > parabolaFly.GetDuration()) { animationTime = float.MaxValue; Animation = false; } else if (!objName.Equals(ParabolaRoot.name)) { parabolaFly = new ParabolaFly(ParabolaRoot.transform); RefreshTransforms(Speed); FollowParabola(); objName = ParabolaRoot.name; } }
void OnDrawGizmos() { if (gizmo == null) { if (ParabolaRoot == null) { return; } gizmo = new ParabolaFly(ParabolaRoot.transform, max, min); } gizmo.RefreshTransforms(1f); if ((gizmo.Points.Length - 1) % 2 != 0) { return; } int accur = 50; Vector3 prevPos = gizmo.Points[0].position; for (int c = 1; c <= accur; c++) { float currTime = c * gizmo.GetDuration() / accur; Vector3 currPos = gizmo.GetPositionAtTime(currTime); float mag = (currPos - prevPos).magnitude * 2; Gizmos.color = new Color(mag, 0, 0, 1); Gizmos.DrawLine(prevPos, currPos); Gizmos.DrawSphere(currPos, 0.01f); prevPos = currPos; } }
// Use this for initialization void Start() { parabolaFly = new ParabolaFly(ParabolaRoot.transform); if (Autostart) { RefreshTransforms(Speed); FollowParabola(); } }
public void FollowParabola() { parabolaFly = new ParabolaFly(ParabolaRoot.transform); RefreshTransforms(Speed); animationTime = 0f; transform.position = parabolaFly.Points[0].position; Animation = true; //HighestPoint = points[0].position; }
public void SetNewParabola() { parabolaFly = new ParabolaFly(ParabolaParent.GetChild(mCurrIndex).transform); mCurrIndex++; if (mCurrIndex > ParabolaParent.childCount - 1) { mCurrIndex = 0; } gizmo = null; }
// Use this for initialization void Start() { finish = new UnityEvent(); parabolaFly = new ParabolaFly(ParabolaRoot.transform); if (Autostart) { RefreshTransforms(Speed); FollowParabola(); } }
// Use this for initialization void Start() { parabolaFly = new ParabolaFly(ParabolaRoot.transform); objName = ParabolaRoot.name; //Debug.Log(objName); if (Autostart) { RefreshTransforms(Speed); FollowParabola(); } }
// Use this for initialization void Start() { car = GetComponent <Car>(); if (Autostart) { parabolaFly = new ParabolaFly(ParabolaRoot.transform); RefreshTransforms(Speed); FollowParabola(); } }
public void OnParabola() { parabolaFly = new ParabolaFly(ParabolaRoot.transform); if (Autostart) { //inParabola = true; RefreshTransforms(Speed); FollowParabola(); } }
//void OnDrawGizmos() //{ // if (gizmo == null) // { // gizmo = new ParabolaFly(ParabolaRoot.transform); // } // gizmo.RefreshTransforms(1f); // if ((gizmo.Points.Length - 1) % 2 != 0) // return; // int accur = 50; // Vector3 prevPos = gizmo.Points[0].position; // for (int c = 1; c <= accur; c++) // { // float currTime = c * gizmo.GetDuration() / accur; // Vector3 currPos = gizmo.GetPositionAtTime(currTime); // float mag = (currPos - prevPos).magnitude * 2; // Gizmos.color = new Color(mag, 0, 0, 1); // Gizmos.DrawLine(prevPos, currPos); // Gizmos.DrawSphere(currPos, 0.01f); // prevPos = currPos; // } //} // Use this for initialization void Start() { ParabolaRoot = GameObject.Find("PointFamily"); parabolaFly = new ParabolaFly(ParabolaRoot.transform); if (Autostart) { RefreshTransforms(Speed); FollowParabola(); } }
/*void DrawLine() * { * int accur = 50; * Vector3 prevPos = gizmo.Points[0].position; * for (int c = 1; c <= accur; c++) * { * float currTime = c * GetDuration() / accur; * Vector3 currPos = GetPositionAtTime(currTime); * float mag = (currPos - prevPos).magnitude * 2; * line.SetPosition(c, prevPos); * //Gizmos.color = new Color(mag, 0, 0, 1); * //Gizmos.DrawLine(prevPos, currPos); * //Gizmos.DrawSphere(currPos, 0.01f); * prevPos = currPos; * } * } */ // Use this for initialization void Start() { line = GetComponent <LineRenderer>(); player = GetComponentInParent <PlayerMovement>(); parabolaFly = new ParabolaFly(ParabolaRoot.transform, this); if (Autostart) { RefreshTransforms(Speed); FollowParabola(); } }
void Start() { parabolaFly = new ParabolaFly(ParabolaRoot.transform, max, min); RefreshTransforms(Speed); }
public void Reset() //when a new round starts, change the position of all { parabolaFly = new ParabolaFly(ParabolaRoot.transform, max, min); RefreshTransforms(Speed); }
public void ResetParabolaFly() { parabolaFly = new ParabolaFly(ParabolaRoot.transform); }
/*void OnDrawGizmos() * { * if (gizmo == null) * { * gizmo = new ParabolaFly(ParabolaRoot.transform); * } * * gizmo.RefreshTransforms(1f); * if ((gizmo.Points.Length - 1) % 2 != 0) * return; * * int accur = 50; * Vector3 prevPos = gizmo.Points[0].position; * for (int c = 1; c <= accur; c++) * { * float currTime = c * gizmo.GetDuration() / accur; * Vector3 currPos = gizmo.GetPositionAtTime(currTime); * float mag = (currPos - prevPos).magnitude * 2; * Gizmos.color = new Color(mag, 0, 0, 1); * Gizmos.DrawLine(prevPos, currPos); * Gizmos.DrawSphere(currPos, 0.01f); * prevPos = currPos; * } * }*/ // Use this for initialization /*void Start() * { * * parabolaFly = new ParabolaFly(ParabolaRoot.transform); * * if (Autostart) * { * RefreshTransforms(Speed); * FollowParabola(); * } * }*/ public void initParabola() { parabolaFly = new ParabolaFly(ParabolaRoot.transform); }