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
c68027c9
Commit
c68027c9
authored
Aug 17, 2019
by
17김현학
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fix (Issue
#34
,
#39
)
parent
94d4bb6a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
11 deletions
+21
-11
Test.unity
Assets/Scenes/Test.unity
+1
-0
UIManager.cs
Assets/Scripts/UIManager.cs
+20
-11
No files found.
Assets/Scenes/Test.unity
View file @
c68027c9
...
...
@@ -658,6 +658,7 @@ MonoBehaviour:
wintext: {fileID: 512200287}
_pathUI: {fileID: 1496132462}
levelManager: {fileID: 279236944}
player: {fileID: 739347346}
pathRenderer: {fileID: 948598108}
--- !u!4 &394305456
Transform:
...
...
Assets/Scripts/UIManager.cs
View file @
c68027c9
...
...
@@ -16,7 +16,6 @@ public class UIManager : MonoBehaviour
LogScaleSlider
velocityslider
;
[
SerializeField
]
LogScaleSlider
accelslider
;
[
SerializeField
]
private
Text
interactText
;
...
...
@@ -29,7 +28,7 @@ public class UIManager : MonoBehaviour
public
Text
wintext
;
public
GameObject
_pathUI
;
public
LevelManager
levelManager
;
public
PlayerMovement
player
;
public
PathRenderer
pathRenderer
;
private
int
prevSelectPathNum
=
-
1
;
...
...
@@ -157,19 +156,30 @@ public class UIManager : MonoBehaviour
private
Vector3
getMouseClickPosition
(
RaycastHit
hit
)
{
var
tmp
=
Camera
.
main
.
WorldToScreenPoint
(
hit
.
point
);
return
tmp
-
canvasSize
*
0.5f
+
middlePoint
;
var
point
=
Camera
.
main
.
WorldToScreenPoint
(
hit
.
point
);
return
point
-
canvasSize
*
0.5f
+
middlePoint
;
}
private
Vector3
getDestVector
(
Vector3
hitVector1
,
Vector3
hitVector2
,
int
pathNum
)
private
Vector3
getDestVector
(
Vector3
ScreenVector
,
Vector3
RealVector
)
{
hitVector1
.
z
=
0
;
var
v
=
square
.
GetDestPoint
(
p
athNum
)
-
hitVector2
;
var
k
=
hitVector1
.
magnitude
/
hitVector2
.
magnitude
;
RealVector
=
getXYVectorfromXZVector
(
RealVector
)
;
var
v
=
square
.
GetDestPoint
(
p
revSelectPathNum
)
-
RealVector
;
var
k
=
ScreenVector
.
magnitude
/
RealVector
.
magnitude
;
return
k
*
v
;
}
private
Vector3
getVectorFromAtoB
(
Vector3
a
,
Vector3
b
)
{
var
ret
=
b
-
a
;
return
ret
;
}
private
Vector3
getXYVectorfromXZVector
(
Vector3
v
)
{
return
new
Vector3
(
v
.
x
,
v
.
z
,
0.0f
);
}
private
void
updatePathInfo
(
GameObject
obj
,
int
pathNum
)
{
pathName
.
text
=
obj
.
name
;
...
...
@@ -196,15 +206,14 @@ public class UIManager : MonoBehaviour
if
(
pathNum
!=
prevSelectPathNum
)
{
prevSelectPathNum
=
pathNum
;
updatePathInfo
(
obj
,
pathNum
);
var
mouseClickPosition
=
getMouseClickPosition
(
hit1
);
var
v
=
getDestVector
(
mouseClickPosition
-
middlePoint
,
new
Vector3
(
hit2
.
point
.
x
,
hit2
.
point
.
z
,
0.0f
),
pathNum
);
var
v
=
getDestVector
(
getVectorFromAtoB
(
middlePoint
,
mouseClickPosition
),
getVectorFromAtoB
(
player
.
transform
.
position
,
hit2
.
point
)
);
_pathUI
.
transform
.
position
=
mouseClickPosition
+
v
;
_pathUI
.
SetActive
(
true
);
prevSelectPathNum
=
pathNum
;
}
}
else
...
...
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