Camera Resolution + End Point indication

This commit is contained in:
Syntriax 2022-02-27 10:41:23 +03:00
parent 8ae9410126
commit 3496f6042a
3 changed files with 68 additions and 11 deletions

View File

@ -14,6 +14,7 @@ GameObject:
- component: {fileID: 6241563109229534231} - component: {fileID: 6241563109229534231}
- component: {fileID: 6151226926209823380} - component: {fileID: 6151226926209823380}
- component: {fileID: 4209054098996045085} - component: {fileID: 4209054098996045085}
- component: {fileID: 2908524670421552996}
m_Layer: 8 m_Layer: 8
m_Name: End Point m_Name: End Point
m_TagString: Untagged m_TagString: Untagged
@ -127,13 +128,65 @@ BoxCollider2D:
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
m_SpriteTilingProperty: m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0} border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0, y: 0} pivot: {x: 0.5, y: 0.5}
oldSize: {x: 0, y: 0} oldSize: {x: 1, y: 1}
newSize: {x: 0, y: 0} newSize: {x: 1, y: 1}
adaptiveTilingThreshold: 0 adaptiveTilingThreshold: 0.5
drawMode: 0 drawMode: 0
adaptiveTiling: 0 adaptiveTiling: 0
m_AutoTiling: 0 m_AutoTiling: 0
serializedVersion: 2 serializedVersion: 2
m_Size: {x: 1, y: 1} m_Size: {x: 1, y: 1}
m_EdgeRadius: 0 m_EdgeRadius: 0
--- !u!212 &2908524670421552996
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1721370151973774447}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 7482667652216324306, guid: 311925a002f4447b3a28927169b83ea6, type: 3}
m_Color: {r: 0, g: 0.47058824, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1, y: 1}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0

View File

@ -37284,7 +37284,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 1510587947020119214, guid: e701662714d893b4283e4c7e15f945f2, type: 3} - target: {fileID: 1510587947020119214, guid: e701662714d893b4283e4c7e15f945f2, type: 3}
propertyPath: m_LocalPosition.y propertyPath: m_LocalPosition.y
value: -1.5 value: -1.25
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 1670627767197824294, guid: e701662714d893b4283e4c7e15f945f2, type: 3} - target: {fileID: 1670627767197824294, guid: e701662714d893b4283e4c7e15f945f2, type: 3}
propertyPath: m_LocalScale.x propertyPath: m_LocalScale.x

View File

@ -7,11 +7,15 @@ namespace Camera
{ {
public class CameraPlayerFinder : MonoBehaviour public class CameraPlayerFinder : MonoBehaviour
{ {
private const float FollowOrthoSize = 7.5f; [SerializeField] private int FixedResolutionX = 426;
private const float FixedOrthoSize = 15f; [SerializeField] private int FixedResolutionY = 240;
[SerializeField] private int FollowResolutionX = 278;
[SerializeField] private int FollowResolutionY = 162;
private CinemachineVirtualCamera _cinemachineVirtualCamera; private CinemachineVirtualCamera _cinemachineVirtualCamera;
private PixelPerfectCamera pixelPerfectCamera = null; private PixelPerfectCamera pixelPerfectCamera = null;
private void Awake() private void Awake()
{ {
_cinemachineVirtualCamera = GetComponent<CinemachineVirtualCamera>(); _cinemachineVirtualCamera = GetComponent<CinemachineVirtualCamera>();
@ -25,15 +29,15 @@ namespace Camera
if (_cinemachineVirtualCamera.Follow == null) if (_cinemachineVirtualCamera.Follow == null)
{ {
_cinemachineVirtualCamera.Follow = LevelManager.Instance.Player.transform; _cinemachineVirtualCamera.Follow = LevelManager.Instance.Player.transform;
_cinemachineVirtualCamera.m_Lens.OrthographicSize = FollowOrthoSize; pixelPerfectCamera.refResolutionX = FollowResolutionX;
pixelPerfectCamera.enabled = false; pixelPerfectCamera.refResolutionY = FollowResolutionY;
} }
} }
else if (_cinemachineVirtualCamera.Follow != LevelManager.Instance.CurrentLevel.FixedCameraPoint) else if (_cinemachineVirtualCamera.Follow != LevelManager.Instance.CurrentLevel.FixedCameraPoint)
{ {
_cinemachineVirtualCamera.Follow = LevelManager.Instance.CurrentLevel.FixedCameraPoint; _cinemachineVirtualCamera.Follow = LevelManager.Instance.CurrentLevel.FixedCameraPoint;
// _cinemachineVirtualCamera.m_Lens.OrthographicSize = FixedOrthoSize; pixelPerfectCamera.refResolutionX = FixedResolutionX;
pixelPerfectCamera.enabled = true; pixelPerfectCamera.refResolutionY = FixedResolutionY;
} }
} }
} }