Example #1
0
        private void Awake()
        {
            dist = new() {
                Lerp = (float x, float y) => Mathf.Lerp(x, y, Common.Damping()),
            };
            dist.Init(defaultDist);

            center = new() {
                Lerp    = (Vector3 x, Vector3 y) => Vector3.Lerp(x, y, Common.Damping()),
                GetDest = () => {
                    if (manager.player == null)
                    {
                        return(center.current);
                    }
                    return(manager.player.transform.position);
                },
            };

            rotation = new() {
                Lerp       = (Quaternion x, Quaternion y) => Quaternion.Slerp(x, y, Common.Damping()),
                GetCurrent = () => transform.rotation,
                SetCurrent = (Quaternion x) => transform.rotation = x,
            };

            persp = new() {
                Lerp    = (float x, float y) => Mathf.Lerp(x, y, Common.Damping()),
                GetDest = () => {
                    if (manager.map is null)
                    {
                        return(persp.current);
                    }
                    return(manager.map.view is Views.Orthogonal ? 0f : 1f);
                },
            };
        }
Example #2
0
 public void Init()
 {
     center.Init();
     rotation.Init();
     persp.Init();
 }