Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
man-in-the-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
4
Issues
4
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
MIM
man-in-the-mirror
Commits
70efe1e5
Commit
70efe1e5
authored
Aug 15, 2019
by
18신대성
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'camera' into polish
# Conflicts: # Assets/Resources/stages/stage6_5.json.meta
parents
af1ed246
7a376bb2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
3 deletions
+19
-3
CameraController.cs
Assets/Scripts/CameraController.cs
+15
-2
MapManager.cs
Assets/Scripts/Managers/MapManager.cs
+4
-1
No files found.
Assets/Scripts/CameraController.cs
View file @
70efe1e5
...
...
@@ -13,10 +13,11 @@ public class CameraController : MonoBehaviour
Vector3
previousPos
;
Vector3
previousAngle
;
float
shootingFov
=
60f
;
float
mapFov
=
20f
;
float
mapFov
=
0
;
float
rotationX
=
0
;
float
rotationY
=
0
;
float
sensitivity
=
1
;
float
sensitivity
=
5
;
public
float
minFOV
,
maxFOV
;
[
SerializeField
]
public
Vector3
centerPos
=
new
Vector3
(-
0.5f
,
0
,
-
0.5f
);
...
...
@@ -73,6 +74,16 @@ public class CameraController : MonoBehaviour
transform
.
eulerAngles
=
new
Vector3
(
30
,
transform
.
eulerAngles
.
y
,
transform
.
eulerAngles
.
z
);
}
/// <summary>
/// Zoom in / out camera with mouse scroll.
/// </summary>
void
CameraScroll
()
{
float
scroll
=
Input
.
GetAxis
(
"Mouse ScrollWheel"
)
*
sensitivity
;
if
(
Camera
.
main
.
fieldOfView
>=
maxFOV
&&
scroll
<
0
)
Camera
.
main
.
fieldOfView
=
maxFOV
;
else
if
(
Camera
.
main
.
fieldOfView
<=
minFOV
&&
scroll
>
0
)
Camera
.
main
.
fieldOfView
=
minFOV
;
else
Camera
.
main
.
fieldOfView
-=
scroll
;
}
/// <summary>
/// Zoom in at player.
/// </summary>
/// <param name="player">Player to be zoomed in.</param>
...
...
@@ -175,8 +186,10 @@ public class CameraController : MonoBehaviour
{
if
(!
GameManager
.
inst
.
isPlayerShooting
)
{
mapFov
=
Camera
.
main
.
fieldOfView
;
CameraMove
();
CameraDrag
();
CameraScroll
();
}
else
if
(!
GameManager
.
inst
.
isGameOver
)
{
...
...
Assets/Scripts/Managers/MapManager.cs
View file @
70efe1e5
...
...
@@ -93,7 +93,10 @@ public class MapManager : SingletonBehaviour<MapManager>
}
Camera
.
main
.
GetComponent
<
CameraController
>().
centerPos
=
new
Vector3
((
float
)(
currentMap
.
maxBorder
.
x
+
currentMap
.
minBorder
.
x
)
/
2
,
0
,
(
float
)(
currentMap
.
maxBorder
.
y
+
currentMap
.
minBorder
.
y
)
/
2
);
Debug
.
Log
(
new
Vector3
((
float
)(
currentMap
.
maxBorder
.
x
+
currentMap
.
minBorder
.
x
)
/
2
,
0
,
(
float
)(
currentMap
.
maxBorder
.
y
+
currentMap
.
minBorder
.
y
)
/
2
));
float
fov
=
(
Mathf
.
Max
(
currentMap
.
maxBorder
.
x
-
currentMap
.
minBorder
.
x
,
currentMap
.
maxBorder
.
y
-
currentMap
.
minBorder
.
y
)
+
1
)
+
10
;
Camera
.
main
.
fieldOfView
=
fov
;
Camera
.
main
.
GetComponent
<
CameraController
>().
minFOV
=
fov
*
0.7f
;
Camera
.
main
.
GetComponent
<
CameraController
>().
maxFOV
=
fov
*
1.5f
;
}
public
IEnumerator
Rebaker
()
...
...
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