NOTE/SaveSource19 [Source Save] MobileSensorManager.cs using System.Collections.Generic;using UnityEngine; public enum Horizontal { Horizon, Right, Left };public enum Vertical { Stand, Front, Back }; class MobileSensorManager : SingleTon{ private float _lat; private float _lon; private float _sensorX; // 좌우 기울기 private float _sensorZ; // 앞뒤 기울기 public Horizontal horizon; public Vertical vertical; private MobileSensorManager() { } public void SensorD.. 2016. 11. 1. [Source Save] TouchCameraMove.cs using System;using System.Collections.Generic;using UnityEngine; class TouchCameraMove : SingleTon{ public GameObject Target; public float dragX; public const int dir = -1; public float speed = 1f; // 속도 public float distance = 2f; // 거리 public float height = 3f; // 높이 public float dampTrace = 20f; // 감도 public float maxZoom = 100f; public float minZoom = 30f; public bool setZoom; private TouchC.. 2016. 10. 31. [Source Save] InputTouchManager.cs using UnityEngine;using System.Collections.Generic; /* RotateTap, Double Tap, Press, Drag*/ class InputTouchManager : SingleTon{ #region One finger Value private Touch _initTouch = new Touch(); private Vector2 _dragXY = Vector2.zero; // X,Y 축으로 드래그한 정도 private float _pressTime; // Press 판정을 위한 시간 private bool _isDrag; private bool _isPress; private bool _isDoubleTap; private GameObject _rayObjec.. 2016. 10. 27. [SaveSource] Drag Script public class TouchManager : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler { public void OnBeginDrag(PointerEventData _eventData) { transform.position = _eventData.position; } public void OnDrag(PointerEventData _eventData) { transform.position = _eventData.position; } public void OnEndDrag(PointerEventData _eventData) { transform.position = _eventData.position; } } - 이벤트 핸들러를 붙.. 2016. 10. 14. [SaveSource] Touch Pinch Zoom /* touch pinch zoom */ if (Input.touchCount == 2) { touchZero = Input.GetTouch(0); touchOne = Input.GetTouch(1); touchZeroPrevPos = touchZero.position - touchZero.deltaPosition; touchOnePrevPos = touchOne.position - touchOne.deltaPosition; prevTouchDeltaMag = (touchZeroPrevPos - touchOnePrevPos).magnitude; touchDeltaMag = (touchZero.position - touchOne.position).magnitude; deltaMagnitudeDiff = p.. 2016. 10. 14. [SaveSource] Player Cam & Input.Axis [PlayerCtrl.cs] - 캐릭터에 부착 public class PlayerCtrl : MonoBehaviour { public float moveSpeed = 10; void Update () { float h = Input.GetAxis("Horizontal"); float v = Input.GetAxis("Vertical"); transform.Translate(new Vector3(h, 0, v) * moveSpeed * Time.deltaTime); transform.Rotate(new Vector3(0, Input.GetAxis("Mouse X"), 0)); } } [FollowCam.cs] - 카메라에 부착, Target에 캐릭터 부착 public class FollowCam : Mon.. 2016. 10. 7. 이전 1 2 3 4 다음