diff options
Diffstat (limited to 'Assets/Scripts/Scene/MainCamera.cs')
-rw-r--r-- | Assets/Scripts/Scene/MainCamera.cs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Assets/Scripts/Scene/MainCamera.cs b/Assets/Scripts/Scene/MainCamera.cs new file mode 100644 index 00000000..45399ceb --- /dev/null +++ b/Assets/Scripts/Scene/MainCamera.cs @@ -0,0 +1,29 @@ +using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class MainCamera : SingletonMB<MainCamera>
+{
+ public new Camera camera { get; private set; }
+
+ public Vector3 offset = Vector3.zero;
+
+ protected override void Awake()
+ {
+ base.Awake();
+ camera = gameObject.GetComponent<Camera>();
+ }
+
+ void Update()
+ {
+ if (TestErika.Instance.erika.unitController == null)
+ {
+ return;
+ }
+ Vector3 pos = transform.position;
+ pos.x = TestErika.Instance.erika.unitController.transform.position.x;
+ pos.y = TestErika.Instance.erika.unitController.transform.position.y;
+ transform.position = pos + offset;
+ }
+
+}
\ No newline at end of file |