Compare commits

...

4 Commits

7 changed files with 307 additions and 38 deletions

View File

@@ -0,0 +1,168 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &6980564769726958139
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5445689290567702089}
- component: {fileID: 1185116518380125445}
- component: {fileID: 4446188106673991604}
- component: {fileID: 823686888810001266}
- component: {fileID: 5048269179280902459}
- component: {fileID: 4259846497128417657}
m_Layer: 0
m_Name: EagleEyeButton
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &5445689290567702089
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6980564769726958139}
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_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: -225, y: 75}
m_SizeDelta: {x: 128, y: 128}
m_Pivot: {x: 1, y: 0}
--- !u!222 &1185116518380125445
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6980564769726958139}
m_CullTransparentMesh: 1
--- !u!114 &4446188106673991604
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6980564769726958139}
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.78039217}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: -3518187381767867529, guid: ee014bd71cac2bc4ab845f435726f383, 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
--- !u!114 &823686888810001266
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6980564769726958139}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 4446188106673991604}
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 4259846497128417657}
m_TargetAssemblyTypeName: EagleEyeBehaviour, AppleHillsScripts
m_MethodName: ActivateEagleEye
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
--- !u!114 &5048269179280902459
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6980564769726958139}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 494d0aedce9744308499355006071138, type: 3}
m_Name:
m_EditorClassIdentifier: AppleHillsScripts::UI.DummyInput
--- !u!114 &4259846497128417657
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6980564769726958139}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f5a0fae2a16515d46aca1e6cc631cee0, type: 3}
m_Name:
m_EditorClassIdentifier: AppleHillsScripts::EagleEyeBehaviour
virtualCamera: {fileID: 0}
confiner2D: {fileID: 0}
zoomOutOrthoSize: 30
normalOrthoSize: 15
transitionDuration: 0.5
eagleEyeDuration: 3
disablePlayerInputDuringEagleEye: 0
eagleEyeButton: {fileID: 823686888810001266}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 428a0feafda9d6d4e87ecf43ad41dc20
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -35,8 +35,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 266.5, y: -75}
m_SizeDelta: {x: 150, y: 150}
m_AnchoredPosition: {x: 291.5, y: -100}
m_SizeDelta: {x: 200, y: 200}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &2968163887214456956
CanvasRenderer:
@@ -66,7 +66,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: -5941552768301239376, guid: 300528d856c15824989bade57a7e04e4, type: 3}
m_Sprite: {fileID: 607773040016097035, guid: ee014bd71cac2bc4ab845f435726f383, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
@@ -175,7 +175,7 @@ MonoBehaviour:
m_Right: 0
m_Top: 0
m_Bottom: 0
m_ChildAlignment: 0
m_ChildAlignment: 3
m_Spacing: 100
m_ChildForceExpandWidth: 1
m_ChildForceExpandHeight: 1
@@ -263,7 +263,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: Do you wish to restart the level?
m_text: VIL DU STARTE BANEN FORFRA?
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 4aca0db6ec111b5418bdc747168f9474, type: 2}
m_sharedMaterial: {fileID: -1441574381962284772, guid: 4aca0db6ec111b5418bdc747168f9474, type: 2}
@@ -290,12 +290,12 @@ MonoBehaviour:
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 151.4
m_fontSize: 147.25
m_fontSizeBase: 151.4
m_fontWeight: 400
m_enableAutoSizing: 0
m_enableAutoSizing: 1
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontSizeMax: 200
m_fontStyle: 1
m_HorizontalAlignment: 2
m_VerticalAlignment: 512
@@ -462,7 +462,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 1075, y: 1222}
m_SizeDelta: {x: 1075, y: 1150}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &3268733036370885957
GameObject:
@@ -500,8 +500,8 @@ RectTransform:
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, y: 0}
m_SizeDelta: {x: 2300, y: 1224}
m_AnchoredPosition: {x: 632.3271, y: 0}
m_SizeDelta: {x: 0, y: 1150}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &3094705072272246714
MonoBehaviour:
@@ -541,8 +541,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 86710e43de46f6f4bac7c8e50813a599, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.AspectRatioFitter
m_AspectMode: 0
m_AspectRatio: 1.879085
m_AspectMode: 2
m_AspectRatio: 2
--- !u!1 &3280119833872322813
GameObject:
m_ObjectHideFlags: 0
@@ -579,7 +579,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 1075, y: 1222}
m_SizeDelta: {x: 1075, y: 1150}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &3481791953115709135
GameObject:
@@ -647,7 +647,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 8885823950580872478, guid: 1be56db5ce99a814e91eb0a67206bd35, type: 3}
m_Sprite: {fileID: 2636902231072113825, guid: ee014bd71cac2bc4ab845f435726f383, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
@@ -998,7 +998,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 17}
m_SizeDelta: {x: 0, y: 610}
m_SizeDelta: {x: 0, y: 830}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5535960118963092322
CanvasRenderer:
@@ -1088,7 +1088,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 17}
m_SizeDelta: {x: 0, y: 610}
m_SizeDelta: {x: 0, y: 830}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &1753893934695849507
CanvasRenderer:
@@ -1198,7 +1198,7 @@ MonoBehaviour:
m_Right: 0
m_Top: 0
m_Bottom: 0
m_ChildAlignment: 0
m_ChildAlignment: 3
m_Spacing: 100
m_ChildForceExpandWidth: 1
m_ChildForceExpandHeight: 1
@@ -1256,7 +1256,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 75, y: -75}
m_AnchoredPosition: {x: 75, y: -100}
m_SizeDelta: {x: 150, y: 150}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &6779017702749071
@@ -1287,7 +1287,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 8885823950580872478, guid: 1be56db5ce99a814e91eb0a67206bd35, type: 3}
m_Sprite: {fileID: 2636902231072113825, guid: ee014bd71cac2bc4ab845f435726f383, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
@@ -1377,7 +1377,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 0, y: 0.5}
m_AnchoredPosition: {x: 220, y: 0}
m_SizeDelta: {x: 200, y: 170}
m_SizeDelta: {x: 170, y: 170}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &6749540931972845406
CanvasRenderer:
@@ -1400,14 +1400,14 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image
m_Material: {fileID: 0}
m_Color: {r: 0.50194824, g: 0.98490566, b: 0.4441367, a: 1}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: -4346244404228752641, guid: 7b5d036a9fa30484e911f4752e3a64c8, type: 3}
m_Sprite: {fileID: 4043309221732817638, guid: ee014bd71cac2bc4ab845f435726f383, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
@@ -1600,7 +1600,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 150, y: 150}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &269258005419161547
CanvasRenderer:
@@ -1623,14 +1623,14 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.9709896, g: 1, b: 0, a: 1}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: -1083306995931140661, guid: 9d084ac2438d6f9448c61a62639581ba, type: 3}
m_Sprite: {fileID: 5513972211207546632, guid: ee014bd71cac2bc4ab845f435726f383, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
@@ -1776,12 +1776,12 @@ MonoBehaviour:
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 100
m_fontSize: 104.8
m_fontSizeBase: 100
m_fontWeight: 400
m_enableAutoSizing: 0
m_enableAutoSizing: 1
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontSizeMax: 500
m_fontStyle: 1
m_HorizontalAlignment: 2
m_VerticalAlignment: 512
@@ -1912,12 +1912,12 @@ MonoBehaviour:
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 100
m_fontSize: 104.8
m_fontSizeBase: 100
m_fontWeight: 400
m_enableAutoSizing: 0
m_enableAutoSizing: 1
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontSizeMax: 500
m_fontStyle: 1
m_HorizontalAlignment: 2
m_VerticalAlignment: 512
@@ -1993,7 +1993,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0}
m_AnchorMax: {x: 0.5, y: 0}
m_AnchoredPosition: {x: 0, y: 347.74}
m_SizeDelta: {x: 341.5, y: 150}
m_SizeDelta: {x: 391.5, y: 200}
m_Pivot: {x: 0.5, y: 0}
--- !u!114 &4213333726324520130
MonoBehaviour:
@@ -2071,7 +2071,7 @@ RectTransform:
m_AnchorMin: {x: 1, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5}
m_AnchoredPosition: {x: -125, y: 0}
m_SizeDelta: {x: 200, y: 170}
m_SizeDelta: {x: 170, y: 170}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &2151603547065558192
CanvasRenderer:
@@ -2094,14 +2094,14 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image
m_Material: {fileID: 0}
m_Color: {r: 0.50194824, g: 0.98490566, b: 0.4441367, a: 1}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: -4346244404228752641, guid: 7b5d036a9fa30484e911f4752e3a64c8, type: 3}
m_Sprite: {fileID: 4043309221732817638, guid: ee014bd71cac2bc4ab845f435726f383, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
@@ -2296,7 +2296,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 8885823950580872478, guid: 1be56db5ce99a814e91eb0a67206bd35, type: 3}
m_Sprite: {fileID: 2636902231072113825, guid: ee014bd71cac2bc4ab845f435726f383, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
@@ -2416,7 +2416,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: -5941552768301239376, guid: 300528d856c15824989bade57a7e04e4, type: 3}
m_Sprite: {fileID: 607773040016097035, guid: ee014bd71cac2bc4ab845f435726f383, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1

View File

@@ -0,0 +1,84 @@
using Unity.Cinemachine;
using UnityEngine;
using System.Collections;
public class EagleEyeBehaviour : MonoBehaviour
{
[SerializeField] private CinemachineCamera virtualCamera;
[SerializeField] private CinemachineConfiner2D confiner2D;
[SerializeField] private float zoomOutOrthoSize = 30f;
[SerializeField] private float normalOrthoSize = 15f;
private float currentOrthoSize;
[SerializeField] private float transitionDuration = 0.5f; // Duration of the transition
[SerializeField] private float eagleEyeDuration = 3f; // Duration to stay zoomed out
[SerializeField] private bool disablePlayerInputDuringEagleEye = true; // Gate input disable
[SerializeField] private UnityEngine.UI.Button eagleEyeButton; // Reference to the UI button
private Coroutine zoomCoroutine;
public void ActivateEagleEye()
{
//Assigns the Virtual Camera and Confiner if not already assigned
if (virtualCamera == null)
{
virtualCamera = FindAnyObjectByType<CinemachineCamera>();
}
if (confiner2D == null)
{
confiner2D = virtualCamera.GetComponent<CinemachineConfiner2D>();
}
// Implementation for activating eagle eye behaviour
if (disablePlayerInputDuringEagleEye)
{
currentOrthoSize = virtualCamera.Lens.OrthographicSize;
}
if (eagleEyeButton != null)
{
eagleEyeButton.interactable = false;
}
if (zoomCoroutine != null) StopCoroutine(zoomCoroutine);
zoomCoroutine = StartCoroutine(EagleEyeSequence());
}
private IEnumerator EagleEyeSequence()
{
if (disablePlayerInputDuringEagleEye)
{
Core.GameManager.Instance.RequestPause(this); // Disable player input
}
yield return StartCoroutine(SmoothOrthoSize(virtualCamera, zoomOutOrthoSize, transitionDuration));
yield return new WaitForSeconds(eagleEyeDuration);
float zoomInTarget = disablePlayerInputDuringEagleEye ? currentOrthoSize : normalOrthoSize;
yield return StartCoroutine(SmoothOrthoSize(virtualCamera, zoomInTarget, transitionDuration));
if (disablePlayerInputDuringEagleEye)
{
Core.GameManager.Instance.ReleasePause(this); // Re-enable player input
}
if (eagleEyeButton != null)
{
eagleEyeButton.interactable = true;
}
}
private IEnumerator SmoothOrthoSize(CinemachineCamera cam, float targetSize, float duration)
{
float startSize = cam.Lens.OrthographicSize;
float elapsed = 0f;
while (elapsed < duration)
{
elapsed += Time.deltaTime;
cam.Lens.OrthographicSize = Mathf.Lerp(startSize, targetSize, elapsed / duration);
if (confiner2D != null)
{
confiner2D.InvalidateBoundingShapeCache();
}
yield return null;
}
cam.Lens.OrthographicSize = targetSize;
if (confiner2D != null)
{
confiner2D.InvalidateBoundingShapeCache();
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: f5a0fae2a16515d46aca1e6cc631cee0

View File

@@ -62,6 +62,10 @@ public class cameraSwitcher : MonoBehaviour
{
elapsed += Time.deltaTime;
cam.Lens.OrthographicSize = Mathf.Lerp(startSize, targetSize, elapsed / duration);
if (confiner2D != null)
{
confiner2D.InvalidateBoundingShapeCache();
}
yield return null;
}
cam.Lens.OrthographicSize = targetSize;

View File

@@ -49,6 +49,10 @@ public class cameraSwitcherNailBird : MonoBehaviour
{
elapsed += Time.deltaTime;
cam.Lens.OrthographicSize = Mathf.Lerp(startSize, targetSize, elapsed / duration);
if (confiner2D != null)
{
confiner2D.InvalidateBoundingShapeCache();
}
yield return null;
}
cam.Lens.OrthographicSize = targetSize;