Commit 46db69f0 authored by 16이진형's avatar 16이진형

카메라 줌인아웃에 따른 플레이어 크기변화

parent 6424eb56
...@@ -660,6 +660,7 @@ MonoBehaviour: ...@@ -660,6 +660,7 @@ MonoBehaviour:
levelManager: {fileID: 279236944} levelManager: {fileID: 279236944}
player: {fileID: 739347346} player: {fileID: 739347346}
pathRenderer: {fileID: 948598108} pathRenderer: {fileID: 948598108}
playerSquare: {fileID: 934514725}
cameraMovement: {fileID: 1661408491} cameraMovement: {fileID: 1661408491}
scrollSpeed: 5 scrollSpeed: 5
--- !u!4 &394305456 --- !u!4 &394305456
...@@ -1698,7 +1699,7 @@ GameObject: ...@@ -1698,7 +1699,7 @@ GameObject:
- component: {fileID: 934514726} - component: {fileID: 934514726}
- component: {fileID: 934514725} - component: {fileID: 934514725}
m_Layer: 2 m_Layer: 2
m_Name: Square m_Name: PlayerSquare
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
......
...@@ -75,4 +75,15 @@ public class CameraMovement : MonoBehaviour ...@@ -75,4 +75,15 @@ public class CameraMovement : MonoBehaviour
} }
} }
} }
/// <summary>
/// size/defaultSize
/// </summary>
public float SizeScale
{
get
{
return (float)size / (float)defaultSize;
}
}
} }
\ No newline at end of file
...@@ -11,6 +11,14 @@ public class Square : FlatLandObject ...@@ -11,6 +11,14 @@ public class Square : FlatLandObject
private float _zPosition => transform.position.z; private float _zPosition => transform.position.z;
private float PlayerVelocity; private float PlayerVelocity;
private Vector3 defaultScale;
private void Start()
{
defaultScale = GetComponent<Transform>().localScale;
}
public Vector3 GetNthPath(int n) // Get a path from (n)th destination to (n+1)th destination. public Vector3 GetNthPath(int n) // Get a path from (n)th destination to (n+1)th destination.
{ {
return pathList[n + 1] - pathList[n]; return pathList[n + 1] - pathList[n];
...@@ -30,4 +38,12 @@ public class Square : FlatLandObject ...@@ -30,4 +38,12 @@ public class Square : FlatLandObject
{ {
return pathVelocity[n + 1]; return pathVelocity[n + 1];
} }
public float Scale
{
set
{
GetComponent<Transform>().localScale = defaultScale * value;
}
}
} }
...@@ -31,6 +31,7 @@ public class UIManager : MonoBehaviour ...@@ -31,6 +31,7 @@ public class UIManager : MonoBehaviour
public PlayerMovement player; public PlayerMovement player;
public PathRenderer pathRenderer; public PathRenderer pathRenderer;
public Square playerSquare;
public CameraMovement cameraMovement; public CameraMovement cameraMovement;
public float scrollSpeed = 1.0f; public float scrollSpeed = 1.0f;
...@@ -122,7 +123,7 @@ public class UIManager : MonoBehaviour ...@@ -122,7 +123,7 @@ public class UIManager : MonoBehaviour
float scroll = Input.GetAxis("Mouse ScrollWheel") * scrollSpeed; float scroll = Input.GetAxis("Mouse ScrollWheel") * scrollSpeed;
cameraMovement.Size += scroll; cameraMovement.Size += scroll;
playerSquare.Scale = 1/cameraMovement.SizeScale;
//player movement //player movement
if (pathRenderer.pathcreatable) if (pathRenderer.pathcreatable)
......
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