Commit 33986f26 authored by Chae Ho Shin's avatar Chae Ho Shin

add path velocity info

parent ada94d32
......@@ -1886,6 +1886,7 @@ MonoBehaviour:
playercamera: {fileID: 1661408489}
levelManager: {fileID: 279236944}
background: {fileID: 1713675711}
velocityslider: {fileID: 260633610}
--- !u!4 &948598109
Transform:
m_ObjectHideFlags: 0
......
......@@ -17,6 +17,8 @@ public class PathRenderer : MonoBehaviour
LevelManager levelManager;
[SerializeField]
GameObject background;
[SerializeField]
LogScaleSlider velocityslider;
LineRenderer _pathRenderer;
float _originalPathColliderY;
......@@ -70,8 +72,10 @@ public class PathRenderer : MonoBehaviour
{
_ResetPaths();
square.pathList[0] = transform.localPosition;
square.pathVelocity[0] = 0.0f;
var tmp = transform.InverseTransformPoint(point);
square.pathList[1] = new Vector3(tmp.x, tmp.y, 0.0f);
square.pathVelocity[1] = velocityslider.GetLogScaleValue();
_pathRenderer.SetPositions(square.pathList.ToArray());
_InstantiatePathCollider(0);
}
......@@ -80,8 +84,11 @@ public class PathRenderer : MonoBehaviour
{
_pathRenderer.positionCount = 2;
square.pathList.Clear();
square.pathList.Add(transform.position);
square.pathList.Add(transform.position);
square.pathVelocity.Clear();
square.pathList.Add(transform.localPosition);
square.pathVelocity.Add(0.0f);
square.pathList.Add(transform.localPosition);
square.pathVelocity.Add(0.0f);
_pathRenderer.SetPositions(square.pathList.ToArray());
for (int i = 0; i < transform.childCount; i++)
{
......@@ -99,6 +106,7 @@ public class PathRenderer : MonoBehaviour
{
var tmp = transform.InverseTransformPoint(point);
square.pathList.Add(new Vector3(tmp.x, tmp.y, 0.0f));
square.pathVelocity.Add(velocityslider.GetLogScaleValue());
_pathRenderer.positionCount = square.pathList.Count();
_pathRenderer.SetPositions(square.pathList.ToArray());
_InstantiatePathCollider(square.pathList.Count() - 2);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment