Skip to content

Commit bb6f38f

Browse files
committed
refactor(Camera): Improve a bit
1 parent c0e92fe commit bb6f38f

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

Assets/JCSUnity/Scripts/GameObject/2D/2DCamera/JCS_2DCamera.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@ public class JCS_2DCamera : JCS_Camera
3232

3333
[Separator("Runtime Variables (JCS_2DCamera)")]
3434

35-
//-- Target information
36-
[Tooltip("Target transform information.")]
37-
[SerializeField]
38-
private Transform mTargetTransform = null;
39-
4035
[Tooltip("Set velocity to zero while the follow not active.")]
4136
[SerializeField]
4237
private bool mResetVelocityToZeroWhileNotActive = false;

Assets/JCSUnity/Scripts/GameObject/3D/JCS_3DCamera.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@ public class JCS_3DCamera : JCS_Camera
4141

4242
[Separator("Runtime Variables (JCS_3DCamera)")]
4343

44-
[Tooltip("Target we want to look at.")]
45-
[SerializeField]
46-
private Transform mTargetTransform = null;
47-
4844
[Tooltip("Targeting revolution.")]
4945
[SerializeField]
5046
private float mTargetRevolution = 0.0f;

Assets/JCSUnity/Scripts/JCS_Camera.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ public abstract class JCS_Camera : MonoBehaviour
4949

5050
[Separator("Runtime Variables (JCS_Camera)")]
5151

52+
[Tooltip("Target transform information.")]
53+
[SerializeField]
54+
protected Transform mTargetTransform = null;
55+
5256
[Tooltip("Flag to check if currently the camera following the target object.")]
5357
[SerializeField]
5458
protected bool mFollowing = true;
@@ -95,8 +99,8 @@ public abstract class JCS_Camera : MonoBehaviour
9599
public bool Following { get { return this.mFollowing; } set { this.mFollowing = value; } }
96100
public bool SmoothTrack { get { return this.mSmoothTrack; } set { this.mSmoothTrack = value; } }
97101

98-
public abstract void SetFollowTarget(Transform trans);
99-
public abstract Transform GetFollowTarget();
102+
public virtual void SetFollowTarget(Transform trans) { this.mTargetTransform = trans; }
103+
public virtual Transform GetFollowTarget() { return mTargetTransform; }
100104

101105
public float ScreenAspect { get { return (float)mCamera.pixelWidth / (float)mCamera.pixelHeight; } }
102106

0 commit comments

Comments
 (0)