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
cb8b1572
Commit
cb8b1572
authored
Aug 21, 2019
by
Chae Ho Shin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ui' into collision-model
parents
269b6d8a
7b8196ca
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
170 additions
and
22 deletions
+170
-22
Image.prefab
Assets/Prefabs/Image.prefab
+77
-0
Image.prefab.meta
Assets/Prefabs/Image.prefab.meta
+7
-0
Test.unity
Assets/Scenes/Test.unity
+15
-0
PathRenderer.cs
Assets/Scripts/PathRenderer.cs
+0
-3
UIManager.cs
Assets/Scripts/UIManager.cs
+21
-19
SelectArea.cs
Assets/SelectArea.cs
+39
-0
SelectArea.cs.meta
Assets/SelectArea.cs.meta
+11
-0
No files found.
Assets/Prefabs/Image.prefab
0 → 100644
View file @
cb8b1572
%YAML
1.1
%TAG
!u!
tag:unity3d.com,2011:
---
!u!1
&4717358246729322577
GameObject
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
serializedVersion
:
6
m_Component
:
-
component
:
{
fileID
:
481547545775494362
}
-
component
:
{
fileID
:
8216549582370772806
}
-
component
:
{
fileID
:
1198387274067299882
}
m_Layer
:
5
m_Name
:
Image
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
---
!u!224
&481547545775494362
RectTransform
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
4717358246729322577
}
m_LocalRotation
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
1
}
m_LocalPosition
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_Children
:
[]
m_Father
:
{
fileID
:
0
}
m_RootOrder
:
0
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_AnchorMin
:
{
x
:
0.5
,
y
:
0.5
}
m_AnchorMax
:
{
x
:
0.5
,
y
:
0.5
}
m_AnchoredPosition
:
{
x
:
-0.5
,
y
:
-0.5
}
m_SizeDelta
:
{
x
:
1
,
y
:
1
}
m_Pivot
:
{
x
:
0
,
y
:
0
}
---
!u!222
&8216549582370772806
CanvasRenderer
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
4717358246729322577
}
m_CullTransparentMesh
:
0
---
!u!114
&1198387274067299882
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
4717358246729322577
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
fe87c0e1cc204ed48ad3b37840f39efc
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
m_Material
:
{
fileID
:
0
}
m_Color
:
{
r
:
1
,
g
:
1
,
b
:
1
,
a
:
0.48235294
}
m_RaycastTarget
:
1
m_OnCullStateChanged
:
m_PersistentCalls
:
m_Calls
:
[]
m_TypeName
:
UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite
:
{
fileID
:
21300000
,
guid
:
0905f15ba4c169d478723617ce3c4ad1
,
type
:
3
}
m_Type
:
0
m_PreserveAspect
:
0
m_FillCenter
:
1
m_FillMethod
:
4
m_FillAmount
:
1
m_FillClockwise
:
1
m_FillOrigin
:
0
m_UseSpriteMesh
:
0
m_PixelsPerUnitMultiplier
:
1
Assets/Prefabs/Image.prefab.meta
0 → 100644
View file @
cb8b1572
fileFormatVersion: 2
guid: ea897371ce88d8541b961fedac9ceb8e
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Assets/Scenes/Test.unity
View file @
cb8b1572
...
...
@@ -629,6 +629,7 @@ GameObject:
m_Component
:
-
component
:
{
fileID
:
394305456
}
-
component
:
{
fileID
:
394305455
}
-
component
:
{
fileID
:
394305457
}
m_Layer
:
0
m_Name
:
UIManager
m_TagString
:
Untagged
...
...
@@ -674,6 +675,20 @@ Transform:
m_Father
:
{
fileID
:
0
}
m_RootOrder
:
10
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
---
!u!114
&394305457
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
394305454
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
4cac6e9f5a929c3459ede6049a34ff3b
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
sd
:
{
fileID
:
4717358246729322577
,
guid
:
ea897371ce88d8541b961fedac9ceb8e
,
type
:
3
}
canvas
:
{
fileID
:
1193230064
}
---
!u!1
&439858915
GameObject
:
m_ObjectHideFlags
:
0
...
...
Assets/Scripts/PathRenderer.cs
View file @
cb8b1572
...
...
@@ -211,7 +211,6 @@ public class PathRenderer : MonoBehaviour
//square.PathList에서 0에서 시작해 finalPathNum까지 이동
var
startPosition
=
levelManager
.
player
.
transform
.
position
;
Debug
.
Log
(
startPosition
+
"test"
);
while
(
i
<=
finalPathNum
)
{
...
...
@@ -277,7 +276,6 @@ public class PathRenderer : MonoBehaviour
i
++;
}
Debug
.
Log
(
levelManager
.
player
.
transform
.
position
+
"test"
);
shiftPath
(
i
,
levelManager
.
player
.
transform
.
position
-
startPosition
);
Background
.
Toggle
=
true
;
pathcreatable
=
true
;
...
...
@@ -310,7 +308,6 @@ public class PathRenderer : MonoBehaviour
square
.
pathVelocity
.
RemoveRange
(
1
,
times
);
deltaPosition
=
ui
.
getXYVectorfromXZVector
(
deltaPosition
);
Debug
.
Log
(
deltaPosition
+
"test"
);
int
i
;
for
(
i
=
0
;
i
<
times
;
i
++)
...
...
Assets/Scripts/UIManager.cs
View file @
cb8b1572
...
...
@@ -161,22 +161,6 @@ public class UIManager : MonoBehaviour
return
point
-
canvasSize
*
0.5f
+
middlePoint
;
}
private
Vector3
getDestVector
(
Vector3
ScreenVector
,
Vector3
RealVector
)
{
ScreenVector
.
z
=
0
;
RealVector
=
getXYVectorfromXZVector
(
RealVector
);
var
v
=
square
.
GetDestPoint
(
prevSelectPathNum
)
-
RealVector
;
var
k
=
ScreenVector
.
magnitude
/
RealVector
.
magnitude
;
return
k
*
v
;
}
private
Vector3
getVectorFromAtoB
(
Vector3
a
,
Vector3
b
)
{
var
ret
=
b
-
a
;
return
ret
;
}
public
Vector3
getXYVectorfromXZVector
(
Vector3
v
)
{
return
new
Vector3
(
v
.
x
,
v
.
z
,
0.0f
);
...
...
@@ -189,6 +173,16 @@ public class UIManager : MonoBehaviour
velocityslider
.
UpdateValuebyVelocity
(
square
.
GetPathVelocity
(
pathNum
));
}
private
Vector3
getInnerProduct
(
Vector3
a
,
Vector3
b
)
{
return
new
Vector3
(
a
.
x
*
b
.
x
,
a
.
y
*
b
.
y
,
a
.
z
*
b
.
z
);
}
private
Vector3
getRatio
(
Vector3
a
,
Vector3
b
)
{
return
new
Vector3
(
a
.
x
/
b
.
x
,
a
.
y
/
b
.
y
,
1.0f
);
}
private
void
TryFIndPath
()
{
RaycastHit
hit1
;
...
...
@@ -201,7 +195,6 @@ public class UIManager : MonoBehaviour
if
(
Physics
.
Raycast
(
ray
,
out
hit2
))
{
var
obj
=
hit2
.
collider
.
gameObject
;
Debug
.
Log
(
obj
.
tag
);
if
(
obj
.
tag
==
"path"
)
{
int
pathNum
=
int
.
Parse
(
obj
.
name
.
Substring
(
13
));
...
...
@@ -212,11 +205,20 @@ public class UIManager : MonoBehaviour
updatePathInfo
(
pathNum
);
var
mouseClickPosition
=
getMouseClickPosition
(
hit1
);
var
v
=
getDestVector
(
getVectorFromAtoB
(
middlePoint
,
mouseClickPosition
),
getVectorFromAtoB
(
player
.
transform
.
position
,
hit2
.
point
));
var
tmp
=
mouseClickPosition
-
middlePoint
;
var
tmp2
=
getXYVectorfromXZVector
(
hit2
.
point
);
var
v
=
square
.
pathList
[
pathNum
+
1
];
var
k
=
getRatio
(
tmp
,
tmp2
);
_pathUI
.
transform
.
position
=
mouseClickPosition
+
v
;
_pathUI
.
transform
.
position
=
getInnerProduct
(
v
,
k
)
+
middlePoint
;
_pathUI
.
SetActive
(
true
);
}
else
{
_pathUI
.
SetActive
(
false
);
prevSelectPathNum
=
-
1
;
sliderflag
=
0
;
}
}
else
{
...
...
Assets/SelectArea.cs
0 → 100644
View file @
cb8b1572
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine.UI
;
using
UnityEngine
;
public
class
SelectArea
:
MonoBehaviour
{
public
GameObject
sd
;
public
Canvas
canvas
;
Vector3
startPos
,
endPos
;
GameObject
tempDrag
;
void
Start
()
{
}
void
Update
()
{
if
(
Input
.
GetMouseButtonDown
(
0
))
{
startPos
=
new
Vector3
(
Input
.
mousePosition
.
x
,
Input
.
mousePosition
.
y
,
0
);
tempDrag
=
Instantiate
(
sd
,
startPos
,
Quaternion
.
identity
)
as
GameObject
;
tempDrag
.
transform
.
parent
=
canvas
.
transform
;
}
if
(
Input
.
GetMouseButton
(
0
))
{
endPos
=
new
Vector3
(
Input
.
mousePosition
.
x
,
Input
.
mousePosition
.
y
,
0
);
tempDrag
.
transform
.
localScale
=
new
Vector3
(
endPos
.
x
-
startPos
.
x
,
endPos
.
y
-
startPos
.
y
,
0
);
}
if
(
Input
.
GetMouseButtonUp
(
0
))
{
Destroy
(
tempDrag
);
}
}
}
Assets/SelectArea.cs.meta
0 → 100644
View file @
cb8b1572
fileFormatVersion: 2
guid: 4cac6e9f5a929c3459ede6049a34ff3b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
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