Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
curvedflats
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
6
Issues
6
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Flatland
curvedflats
Commits
e6bc3464
Commit
e6bc3464
authored
Aug 19, 2019
by
Chae Ho Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ui fix
parent
a9afa9d3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
41 deletions
+55
-41
Test.unity
Assets/Scenes/Test.unity
+3
-3
PathRenderer.cs
Assets/Scripts/PathRenderer.cs
+8
-2
PlayerMovement.cs
Assets/Scripts/PlayerMovement.cs
+5
-1
UIManager.cs
Assets/Scripts/UIManager.cs
+39
-35
No files found.
Assets/Scenes/Test.unity
View file @
e6bc3464
...
@@ -1693,7 +1693,7 @@ GameObject:
...
@@ -1693,7 +1693,7 @@ GameObject:
-
component
:
{
fileID
:
934514727
}
-
component
:
{
fileID
:
934514727
}
-
component
:
{
fileID
:
934514726
}
-
component
:
{
fileID
:
934514726
}
-
component
:
{
fileID
:
934514725
}
-
component
:
{
fileID
:
934514725
}
m_Layer
:
0
m_Layer
:
2
m_Name
:
Square
m_Name
:
Square
m_TagString
:
Untagged
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_Icon
:
{
fileID
:
0
}
...
@@ -1775,8 +1775,8 @@ Transform:
...
@@ -1775,8 +1775,8 @@ Transform:
m_PrefabAsset
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
934514724
}
m_GameObject
:
{
fileID
:
934514724
}
m_LocalRotation
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
1
}
m_LocalRotation
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
1
}
m_LocalPosition
:
{
x
:
407.6
,
y
:
-300
,
z
:
0
}
m_LocalPosition
:
{
x
:
0.1
,
y
:
-300
,
z
:
-0.06
}
m_LocalScale
:
{
x
:
4
,
y
:
4
,
z
:
4
}
m_LocalScale
:
{
x
:
3.6
,
y
:
3.6
,
z
:
3.6
}
m_Children
:
[]
m_Children
:
[]
m_Father
:
{
fileID
:
0
}
m_Father
:
{
fileID
:
0
}
m_RootOrder
:
9
m_RootOrder
:
9
...
...
Assets/Scripts/PathRenderer.cs
View file @
e6bc3464
...
@@ -23,6 +23,8 @@ public class PathRenderer : MonoBehaviour
...
@@ -23,6 +23,8 @@ public class PathRenderer : MonoBehaviour
LogScaleSlider
velocityslider
;
LogScaleSlider
velocityslider
;
[
SerializeField
]
[
SerializeField
]
UIManager
ui
;
UIManager
ui
;
public
bool
pathcreatable
{
get
;
set
;
}
LineRenderer
_pathRenderer
;
LineRenderer
_pathRenderer
;
float
_originalPathColliderY
;
float
_originalPathColliderY
;
...
@@ -46,12 +48,13 @@ public class PathRenderer : MonoBehaviour
...
@@ -46,12 +48,13 @@ public class PathRenderer : MonoBehaviour
_pathRenderer
=
GetComponent
<
LineRenderer
>();
_pathRenderer
=
GetComponent
<
LineRenderer
>();
_ResetPaths
();
_ResetPaths
();
pathcreatable
=
true
;
}
}
// Update is called once per frame
// Update is called once per frame
void
Update
()
void
Update
()
{
{
if
(
Input
.
GetMouseButtonDown
(
1
)
&&
levelManager
.
player
.
isInertial
())
if
(
Input
.
GetMouseButtonDown
(
1
)
&&
levelManager
.
player
.
isInertial
()
&&
pathcreatable
)
{
{
RaycastHit
hit1
;
RaycastHit
hit1
;
var
ray
=
Camera
.
main
.
ScreenPointToRay
(
Input
.
mousePosition
);
var
ray
=
Camera
.
main
.
ScreenPointToRay
(
Input
.
mousePosition
);
...
@@ -212,6 +215,8 @@ public class PathRenderer : MonoBehaviour
...
@@ -212,6 +215,8 @@ public class PathRenderer : MonoBehaviour
while
(
i
<=
finalPathNum
)
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
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
dest
=
new
Vector3
(
square
.
GetNthPath
(
i
).
x
,
0f
,
square
.
GetNthPath
(
i
).
y
);
// 시작 관성계 기준 startpos에서 목표지점까지 공간 좌표
Vector3
acceleration
=
dest
.
normalized
;
Vector3
acceleration
=
dest
.
normalized
;
...
@@ -273,8 +278,9 @@ public class PathRenderer : MonoBehaviour
...
@@ -273,8 +278,9 @@ public class PathRenderer : MonoBehaviour
i
++;
i
++;
}
}
Debug
.
Log
(
levelManager
.
player
.
transform
.
position
+
"test"
);
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
;
Background
.
Toggle
=
true
;
pathcreatable
=
true
;
//아마 여기에 이동을 다 마친 경로들을 square.pathList랑 square.pathVelocity에서 없애주고, finalPathNum 다음 경로가 square.pathList[1]이 되게 해야할듯
//아마 여기에 이동을 다 마친 경로들을 square.pathList랑 square.pathVelocity에서 없애주고, finalPathNum 다음 경로가 square.pathList[1]이 되게 해야할듯
// PathRenderer에 child로 되 있는 Path-n들 이름도 다 바꿔줘야 할꺼임(니가 최종 경로 가 몇번째인지 판정으로 GameObject 이름을 string으로 받아와서 하니까)
// PathRenderer에 child로 되 있는 Path-n들 이름도 다 바꿔줘야 할꺼임(니가 최종 경로 가 몇번째인지 판정으로 GameObject 이름을 string으로 받아와서 하니까)
...
...
Assets/Scripts/PlayerMovement.cs
View file @
e6bc3464
...
@@ -81,7 +81,7 @@ public class PlayerMovement : FlatlandMovement,IInteractor
...
@@ -81,7 +81,7 @@ public class PlayerMovement : FlatlandMovement,IInteractor
if
(
alpha
.
magnitude
>
0.0f
)
if
(
alpha
.
magnitude
>
0.0f
)
{
{
isinertial
=
false
;
var
dt
=
(
Constants
.
c
/
alpha
.
magnitude
)
*
MathNet
.
Numerics
.
Trig
.
Sinh
(
alpha
.
magnitude
*
Time
.
fixedDeltaTime
/
Constants
.
c
);
var
dt
=
(
Constants
.
c
/
alpha
.
magnitude
)
*
MathNet
.
Numerics
.
Trig
.
Sinh
(
alpha
.
magnitude
*
Time
.
fixedDeltaTime
/
Constants
.
c
);
var
atmp
=
(
alpha
.
magnitude
*
dt
)
var
atmp
=
(
alpha
.
magnitude
*
dt
)
/
Mathf
.
Sqrt
(
1
+
(
float
)((
alpha
.
magnitude
*
dt
/
Constants
.
c
)
*
(
alpha
.
magnitude
*
dt
/
Constants
.
c
)));
/
Mathf
.
Sqrt
(
1
+
(
float
)((
alpha
.
magnitude
*
dt
/
Constants
.
c
)
*
(
alpha
.
magnitude
*
dt
/
Constants
.
c
)));
...
@@ -112,6 +112,10 @@ public class PlayerMovement : FlatlandMovement,IInteractor
...
@@ -112,6 +112,10 @@ public class PlayerMovement : FlatlandMovement,IInteractor
v
=
finaldeltav
;
v
=
finaldeltav
;
}
}
else
{
isinertial
=
true
;
}
if
(
v
.
magnitude
>=
Constants
.
c
)
// if floating point errors makes object ftl
if
(
v
.
magnitude
>=
Constants
.
c
)
// if floating point errors makes object ftl
v
=
v
.
normalized
*
(
float
)(
0.999995f
*
Constants
.
c
);
v
=
v
.
normalized
*
(
float
)(
0.999995f
*
Constants
.
c
);
...
...
Assets/Scripts/UIManager.cs
View file @
e6bc3464
...
@@ -112,42 +112,45 @@ public class UIManager : MonoBehaviour
...
@@ -112,42 +112,45 @@ public class UIManager : MonoBehaviour
//player movement
//player movement
if
(
Input
.
GetKeyDown
(
"w"
)
)
if
(
pathRenderer
.
pathcreatable
)
{
{
var
tmp
=
accelslider
.
GetLogScaleValue
()
*
(
float
)
Constants
.
c
;
if
(
Input
.
GetKeyDown
(
"w"
))
levelManager
.
player
.
alpha
+=
new
Vector3
(
0
,
0
,
tmp
);
{
}
var
tmp
=
accelslider
.
GetLogScaleValue
()
*
(
float
)
Constants
.
c
;
else
if
(
Input
.
GetKeyDown
(
"a"
))
levelManager
.
player
.
alpha
+=
new
Vector3
(
0
,
0
,
tmp
);
{
}
var
tmp
=
accelslider
.
GetLogScaleValue
()
*
(
float
)
Constants
.
c
;
else
if
(
Input
.
GetKeyDown
(
"a"
))
levelManager
.
player
.
alpha
+=
new
Vector3
(-
tmp
,
0
,
0
);
{
}
var
tmp
=
accelslider
.
GetLogScaleValue
()
*
(
float
)
Constants
.
c
;
else
if
(
Input
.
GetKeyDown
(
"s"
))
levelManager
.
player
.
alpha
+=
new
Vector3
(-
tmp
,
0
,
0
);
{
}
var
tmp
=
accelslider
.
GetLogScaleValue
()
*
(
float
)
Constants
.
c
;
else
if
(
Input
.
GetKeyDown
(
"s"
))
levelManager
.
player
.
alpha
+=
new
Vector3
(
0
,
0
,
-
tmp
);
{
}
var
tmp
=
accelslider
.
GetLogScaleValue
()
*
(
float
)
Constants
.
c
;
else
if
(
Input
.
GetKeyDown
(
"d"
))
levelManager
.
player
.
alpha
+=
new
Vector3
(
0
,
0
,
-
tmp
);
{
}
var
tmp
=
accelslider
.
GetLogScaleValue
()
*
(
float
)
Constants
.
c
;
else
if
(
Input
.
GetKeyDown
(
"d"
))
levelManager
.
player
.
alpha
+=
new
Vector3
(
tmp
,
0
,
0
);
{
}
var
tmp
=
accelslider
.
GetLogScaleValue
()
*
(
float
)
Constants
.
c
;
levelManager
.
player
.
alpha
+=
new
Vector3
(
tmp
,
0
,
0
);
}
if
(
Input
.
GetKeyUp
(
"w"
))
if
(
Input
.
GetKeyUp
(
"w"
))
{
{
levelManager
.
player
.
alpha
-=
new
Vector3
(
0
,
0
,
levelManager
.
player
.
alpha
.
z
);
levelManager
.
player
.
alpha
-=
new
Vector3
(
0
,
0
,
levelManager
.
player
.
alpha
.
z
);
}
}
else
if
(
Input
.
GetKeyUp
(
"a"
))
else
if
(
Input
.
GetKeyUp
(
"a"
))
{
{
levelManager
.
player
.
alpha
-=
new
Vector3
(
levelManager
.
player
.
alpha
.
x
,
0
,
0
);
levelManager
.
player
.
alpha
-=
new
Vector3
(
levelManager
.
player
.
alpha
.
x
,
0
,
0
);
}
}
else
if
(
Input
.
GetKeyUp
(
"s"
))
else
if
(
Input
.
GetKeyUp
(
"s"
))
{
{
levelManager
.
player
.
alpha
-=
new
Vector3
(
0
,
0
,
levelManager
.
player
.
alpha
.
z
);
levelManager
.
player
.
alpha
-=
new
Vector3
(
0
,
0
,
levelManager
.
player
.
alpha
.
z
);
}
}
else
if
(
Input
.
GetKeyUp
(
"d"
))
else
if
(
Input
.
GetKeyUp
(
"d"
))
{
{
levelManager
.
player
.
alpha
-=
new
Vector3
(
levelManager
.
player
.
alpha
.
x
,
0
,
0
);
levelManager
.
player
.
alpha
-=
new
Vector3
(
levelManager
.
player
.
alpha
.
x
,
0
,
0
);
}
}
}
}
}
...
@@ -232,6 +235,7 @@ public class UIManager : MonoBehaviour
...
@@ -232,6 +235,7 @@ public class UIManager : MonoBehaviour
{
{
_pathUI
.
SetActive
(
false
);
_pathUI
.
SetActive
(
false
);
pathRenderer
.
Background
.
Toggle
=
false
;
pathRenderer
.
Background
.
Toggle
=
false
;
pathRenderer
.
pathcreatable
=
false
;
StartCoroutine
(
pathRenderer
.
_StartMovingPath
(
prevSelectPathNum
));
StartCoroutine
(
pathRenderer
.
_StartMovingPath
(
prevSelectPathNum
));
prevSelectPathNum
=
-
1
;
prevSelectPathNum
=
-
1
;
}
}
...
@@ -248,7 +252,7 @@ public class UIManager : MonoBehaviour
...
@@ -248,7 +252,7 @@ public class UIManager : MonoBehaviour
{
{
try
try
{
{
if
(
levelManager
.
player
.
isInertial
())
if
(
levelManager
.
player
.
isInertial
()
&&
pathRenderer
.
pathcreatable
)
{
{
RaycastHit
hit
;
RaycastHit
hit
;
var
ray
=
Camera
.
main
.
ScreenPointToRay
(
Input
.
mousePosition
);
var
ray
=
Camera
.
main
.
ScreenPointToRay
(
Input
.
mousePosition
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment