diff --git a/Assets/Prefabs/Microgame_Earth/EarthMicrogame.prefab b/Assets/Prefabs/Microgame_Earth/EarthMicrogame.prefab index 1170c35..2867564 100644 --- a/Assets/Prefabs/Microgame_Earth/EarthMicrogame.prefab +++ b/Assets/Prefabs/Microgame_Earth/EarthMicrogame.prefab @@ -318,6 +318,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 63616322c82d5e64e8e7199d51c6a2ef, type: 3} m_Name: m_EditorClassIdentifier: + min: {x: -8.5, y: -4.5} + max: {x: 8.5, y: 4.5} --- !u!114 &446180029092811511 MonoBehaviour: m_ObjectHideFlags: 0 @@ -330,7 +332,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 3942a3e38c32eed40bff470e6bbddf42, type: 3} m_Name: m_EditorClassIdentifier: - activationDelay: 0.7 + activationDelay: 0.4 --- !u!114 &446180029092811510 MonoBehaviour: m_ObjectHideFlags: 0 @@ -344,4 +346,4 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: color: {r: 1, g: 0, b: 0, a: 1} - activationDelay: 0.7 + activationDelay: 0.4 diff --git a/Assets/Scripts/Microgame_Earth/FollowMouse.cs b/Assets/Scripts/Microgame_Earth/FollowMouse.cs index 92212ba..22b9ba0 100644 --- a/Assets/Scripts/Microgame_Earth/FollowMouse.cs +++ b/Assets/Scripts/Microgame_Earth/FollowMouse.cs @@ -5,6 +5,9 @@ using UnityEngine; [RequireComponent(typeof(Rigidbody2D))] public class FollowMouse : MonoBehaviour { + public Vector2 min; + public Vector2 max; + private new Rigidbody2D rigidbody2D; void Awake() { @@ -13,12 +16,12 @@ public class FollowMouse : MonoBehaviour void Start() { Vector3 screenPoint = Camera.main.ScreenToWorldPoint(Input.mousePosition); - transform.position = new Vector3(screenPoint.x, screenPoint.y, transform.position.z); + transform.position = new Vector3(Mathf.Clamp(screenPoint.x, min.x, max.x), Mathf.Clamp(screenPoint.y, min.y, max.y), transform.position.z); } void FixedUpdate() { Vector3 screenPoint = Camera.main.ScreenToWorldPoint(Input.mousePosition); - rigidbody2D.MovePosition(new Vector3(screenPoint.x, screenPoint.y, transform.position.z)); + rigidbody2D.MovePosition(new Vector3(Mathf.Clamp(screenPoint.x, min.x, max.x), Mathf.Clamp(screenPoint.y, min.y, max.y), transform.position.z)); } }