using UnityEngine; using System.Collections; public class CameraRect : MonoBehaviour { private InputController inputController; private RectTransform rectTrans; public void init(InputController inputController) { this.inputController = inputController; rectTrans = this.GetComponent(); } // Update is called once per frame void FixedUpdate () { Vector3 position = inputController.cameraPosition; int col = (int)NumberUtil.forceBetween(position.x/Map.TILE_WIDTH, 0, 128f); int row = (int)NumberUtil.forceBetween((position.z)/Map.TILE_LENGTH, 0, 128f); Vector3 pos = rectTrans.localPosition; pos.x = MiniMap.offsetX+col; pos.y = MiniMap.offsetY+row; rectTrans.localPosition = pos; } }