Commit 5fe2ef65 authored by 17김현학's avatar 17김현학

implement cancel button in path ui

parent 7cac6c44
...@@ -178,4 +178,15 @@ public class PathRenderer : MonoBehaviour ...@@ -178,4 +178,15 @@ public class PathRenderer : MonoBehaviour
_pathCollider.transform.localPosition = (square.pathList[n] + square.pathList[n + 1]) / 2; _pathCollider.transform.localPosition = (square.pathList[n] + square.pathList[n + 1]) / 2;
} }
public void DeletePathsAfterNthPath(int n)
{
square.pathList.RemoveRange(n, _pathRenderer.positionCount - n);
square.pathVelocity.RemoveRange(n, _pathRenderer.positionCount - n);
for (int i = 0; i < transform.childCount; i++)
{
if (i + 1 >= n) Destroy(transform.GetChild(i).gameObject);
}
_pathRenderer.positionCount = square.pathList.Count();
}
} }
...@@ -11,6 +11,8 @@ public class UIManager : MonoBehaviour ...@@ -11,6 +11,8 @@ public class UIManager : MonoBehaviour
[SerializeField] [SerializeField]
Square square; Square square;
[SerializeField] [SerializeField]
PathRenderer pathrenderer;
[SerializeField]
Camera playercamera; Camera playercamera;
[SerializeField] [SerializeField]
LogScaleSlider velocityslider; LogScaleSlider velocityslider;
...@@ -230,7 +232,7 @@ public class UIManager : MonoBehaviour ...@@ -230,7 +232,7 @@ public class UIManager : MonoBehaviour
var positions = pathRenderer.PathPositionsXZ; var positions = pathRenderer.PathPositionsXZ;
var velocitys = pathRenderer.PathVelocitys; var velocitys = pathRenderer.PathVelocitys;
if(positions.Count<=1 || velocitys.Count <= 1) if (positions.Count <= 1 || velocitys.Count <= 1)
{ {
return; return;
} }
...@@ -238,7 +240,7 @@ public class UIManager : MonoBehaviour ...@@ -238,7 +240,7 @@ public class UIManager : MonoBehaviour
positions.RemoveAt(0); positions.RemoveAt(0);
velocitys.RemoveAt(0); velocitys.RemoveAt(0);
result = levelManager.player.MoveToRetivePosition(positions,velocitys); result = levelManager.player.MoveToRetivePosition(positions, velocitys);
if (result) if (result)
{ {
...@@ -246,6 +248,13 @@ public class UIManager : MonoBehaviour ...@@ -246,6 +248,13 @@ public class UIManager : MonoBehaviour
} }
} }
public void PathCancel()
{
pathrenderer.DeletePathsAfterNthPath(prevSelectPathNum + 1);
_pathUI.SetActive(false);
prevSelectPathNum = -1;
}
public void OnDoubleClicked() public void OnDoubleClicked()
{ {
try try
......
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