コード例 #1
0
    public void OnFingerSet(Lean.Touch.LeanFinger finger)
    {
        if (useInput == false)
        {
            return;
        }

        if (playerInput == null)
        {
            return;
        }

        if (inGameCamera == null)
        {
            inGameCamera = GameManager.Instance.cameraManager.GetCamera();
        }

        Vector3 playerPos = playerInput.transform.position;
        Vector3 fingerPos = finger.GetWorldPosition(Vector3.Distance(playerPos, inGameCamera.transform.position), inGameCamera);

        Vector3 dir = (fingerPos - playerPos);

        playerInput.AddDirection(dir);

        if (OnFingerSetAction != null)
        {
            OnFingerSetAction.Invoke();
        }
    }