Commit 748a100c authored by 17김현학's avatar 17김현학

bug fix

parent 6d9196b3
......@@ -207,6 +207,9 @@ public class PathRenderer : MonoBehaviour
//square.PathList에서 0에서 시작해 finalPathNum까지 이동
var startPosition = levelManager.player.transform.position;
Debug.Log(startPosition + "test");
while (i <= finalPathNum)
{
Vector3 startpos = new Vector3(levelManager.player.transform.position.x, 0, levelManager.player.transform.position.z); // 경로 이동 시작할때 위치
......@@ -264,10 +267,13 @@ public class PathRenderer : MonoBehaviour
// INSERT CODE TO REMOVE PATH FROM PATH RENDERER HERE
// 여기에 방금 이동한 경로를 안보이게 해야 함
HideNthPath(i);
i++;
}
Debug.Log(levelManager.player.transform.position + "test");
shiftPath(finalPathNum + 1, levelManager.player.transform.position - startPosition);
Background.Toggle = true;
//아마 여기에 이동을 다 마친 경로들을 square.pathList랑 square.pathVelocity에서 없애주고, finalPathNum 다음 경로가 square.pathList[1]이 되게 해야할듯
......@@ -280,10 +286,39 @@ public class PathRenderer : MonoBehaviour
{
square.pathList.RemoveRange(n, _pathRenderer.positionCount - n);
square.pathVelocity.RemoveRange(n, _pathRenderer.positionCount - n);
for (int i = 0; i < transform.childCount; i++)
for (int i = n - 1; i < transform.childCount; i++)
{
Destroy(transform.GetChild(i).gameObject);
}
_pathRenderer.positionCount = square.pathList.Count();
}
public void HideNthPath(int n)
{
transform.GetChild(n).gameObject.GetComponent<MeshRenderer>().enabled=false;
}
public void shiftPath(int times, Vector3 deltaPosition)
{
square.pathList.RemoveRange(1, times);
square.pathVelocity.RemoveRange(1, times);
deltaPosition = ui.getXYVectorfromXZVector(deltaPosition);
Debug.Log(deltaPosition + "test");
int i;
for (i = 0; i < times; i++)
{
if (i + 1 >= n) Destroy(transform.GetChild(i).gameObject);
Destroy(transform.GetChild(i).gameObject);
}
for (i = 0; i < transform.childCount - times; i++)
{
GameObject obj = transform.GetChild(i + times).gameObject;
obj.name = "PathCollider-" + i;
obj.transform.localPosition -= deltaPosition;
square.pathList[i + 1] -= deltaPosition;
}
_pathRenderer.positionCount = square.pathList.Count();
_pathRenderer.SetPositions(square.pathList.ToArray());
}
}
......@@ -174,7 +174,7 @@ public class UIManager : MonoBehaviour
return ret;
}
private Vector3 getXYVectorfromXZVector(Vector3 v)
public Vector3 getXYVectorfromXZVector(Vector3 v)
{
return new Vector3(v.x, v.z, 0.0f);
}
......@@ -230,11 +230,10 @@ public class UIManager : MonoBehaviour
/// </summary>
public void PathStart()
{
_pathUI.SetActive(false);
pathRenderer.Background.Toggle = false;
StartCoroutine(pathRenderer._StartMovingPath(prevSelectPathNum));
_pathUI.SetActive(false);
prevSelectPathNum = -1;
pathRenderer.PathClear();
}
......@@ -287,7 +286,6 @@ public class UIManager : MonoBehaviour
updatePathInfo(pathNum);
var mouseClickPosition = getMouseClickPosition(hit);
_pathUI.transform.position = mouseClickPosition;
Debug.Log(pathNum + "test");
_pathUI.SetActive(true);
}
}
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