diff options
author | chai <chaifix@163.com> | 2021-09-17 20:09:19 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-09-17 20:09:19 +0800 |
commit | 234c25bc8761a4d41bc5b4aa362449cf3e806e13 (patch) | |
tree | 69cc0b7002ac8018af1806de366526dfc089d49e /Assets/Scripts/Scene/MainCamera.cs | |
parent | ea4624fbef6e9d8f58da12be363807eb19a37b53 (diff) |
*unit image effect
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 |