1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- using DG.Tweening;
- using UnityEngine;
- namespace ET.Client
- {
- [FriendOfAttribute(typeof(ET.Client.GlobalViewComponent))]
- public static class CameraMgr
- {
-
- public static void FollowMe(Vector3 pos)
- {
-
- }
- private static bool bShaking = false;
- public static void ShakeMe(float shakeTime, Vector3 shakeStength)
- {
- if (bShaking) return;
- bShaking = true;
- Transform trans = GlobalViewComponent.Instance.BattleCamera.transform;
- Tweener tweener = trans.DOShakePosition(shakeTime, shakeStength);
- tweener.OnComplete<Tweener>(() =>
- {
- trans.localPosition = Vector3.zero;
- bShaking = false;
- });
- }
- public static Vector3 CarmeraPos()
- {
- return Camera.main.transform.position;
- }
- public static void DragCamera(Vector3 start, Vector3 end, float duration, System.Action endcb)
- {
- Transform trans = GlobalViewComponent.Instance.BattleCamera.transform;
- trans.position = start;
- var tweener = trans.DOMove(end, duration);
- tweener.OnComplete<Tweener>(() =>
- {
- endcb ?.Invoke();
- });
- }
- }
- }
|