Commit e6bc3464 authored by Chae Ho Shin's avatar Chae Ho Shin

ui fix

parent a9afa9d3
......@@ -1693,7 +1693,7 @@ GameObject:
- component: {fileID: 934514727}
- component: {fileID: 934514726}
- component: {fileID: 934514725}
m_Layer: 0
m_Layer: 2
m_Name: Square
m_TagString: Untagged
m_Icon: {fileID: 0}
......@@ -1775,8 +1775,8 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 934514724}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 407.6, y: -300, z: 0}
m_LocalScale: {x: 4, y: 4, z: 4}
m_LocalPosition: {x: 0.1, y: -300, z: -0.06}
m_LocalScale: {x: 3.6, y: 3.6, z: 3.6}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 9
......
......@@ -24,6 +24,8 @@ public class PathRenderer : MonoBehaviour
[SerializeField]
UIManager ui;
public bool pathcreatable { get; set; }
LineRenderer _pathRenderer;
float _originalPathColliderY;
......@@ -46,12 +48,13 @@ public class PathRenderer : MonoBehaviour
_pathRenderer = GetComponent<LineRenderer>();
_ResetPaths();
pathcreatable = true;
}
// Update is called once per frame
void Update()
{
if (Input.GetMouseButtonDown(1) && levelManager.player.isInertial())
if (Input.GetMouseButtonDown(1) && levelManager.player.isInertial() && pathcreatable)
{
RaycastHit hit1;
var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
......@@ -212,6 +215,8 @@ public class PathRenderer : MonoBehaviour
while (i <= finalPathNum)
{
if (i >= _pathRenderer.positionCount - 1)
break;
Vector3 startpos = new Vector3(levelManager.player.transform.position.x, 0, levelManager.player.transform.position.z); // 경로 이동 시작할때 위치
Vector3 dest = new Vector3(square.GetNthPath(i).x, 0f, square.GetNthPath(i).y); // 시작 관성계 기준 startpos에서 목표지점까지 공간 좌표
Vector3 acceleration = dest.normalized;
......@@ -273,8 +278,9 @@ public class PathRenderer : MonoBehaviour
i++;
}
Debug.Log(levelManager.player.transform.position + "test");
shiftPath(finalPathNum + 1, levelManager.player.transform.position - startPosition);
shiftPath(i, levelManager.player.transform.position - startPosition);
Background.Toggle = true;
pathcreatable = true;
//아마 여기에 이동을 다 마친 경로들을 square.pathList랑 square.pathVelocity에서 없애주고, finalPathNum 다음 경로가 square.pathList[1]이 되게 해야할듯
// PathRenderer에 child로 되 있는 Path-n들 이름도 다 바꿔줘야 할꺼임(니가 최종 경로 가 몇번째인지 판정으로 GameObject 이름을 string으로 받아와서 하니까)
......
......@@ -81,7 +81,7 @@ public class PlayerMovement : FlatlandMovement,IInteractor
if (alpha.magnitude > 0.0f)
{
isinertial = false;
var dt = (Constants.c / alpha.magnitude) * MathNet.Numerics.Trig.Sinh(alpha.magnitude * Time.fixedDeltaTime / Constants.c);
var atmp = (alpha.magnitude * dt)
/ Mathf.Sqrt(1 + (float)((alpha.magnitude * dt / Constants.c) * (alpha.magnitude * dt / Constants.c)));
......@@ -112,6 +112,10 @@ public class PlayerMovement : FlatlandMovement,IInteractor
v = finaldeltav;
}
else
{
isinertial = true;
}
if (v.magnitude >= Constants.c) // if floating point errors makes object ftl
v = v.normalized * (float)(0.999995f * Constants.c);
......
......@@ -112,6 +112,8 @@ public class UIManager : MonoBehaviour
//player movement
if (pathRenderer.pathcreatable)
{
if (Input.GetKeyDown("w"))
{
var tmp = accelslider.GetLogScaleValue() * (float)Constants.c;
......@@ -149,6 +151,7 @@ public class UIManager : MonoBehaviour
{
levelManager.player.alpha -= new Vector3(levelManager.player.alpha.x, 0, 0);
}
}
}
......@@ -232,6 +235,7 @@ public class UIManager : MonoBehaviour
{
_pathUI.SetActive(false);
pathRenderer.Background.Toggle = false;
pathRenderer.pathcreatable = false;
StartCoroutine(pathRenderer._StartMovingPath(prevSelectPathNum));
prevSelectPathNum = -1;
}
......@@ -248,7 +252,7 @@ public class UIManager : MonoBehaviour
{
try
{
if (levelManager.player.isInertial())
if (levelManager.player.isInertial() && pathRenderer.pathcreatable)
{
RaycastHit hit;
var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
......
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