using UnityEngine;
using System.Collections;

public class MouseRts : MonoBehaviour {
	

	
	public float MaxZ=20000;
	public float MinZ=-20000;
	public float MaxX=20000;
	public float MinX=-20000;
	

	
	private float Up;
	private float Down;
	private float Right;
	private float Left;
	
	public Vector2 gt;
	
	void Start() {
		Up = Screen.height - Wand;
		Down = Wand;
		Right = Screen.width - Wand;
		Left = Wand;
	}
	
	void Update() {
		gt = Input.mousePosition;
		if(gt.y > Up && transform.position.z < MaxZ) {
			transform.position += transform.up + transform.position.y;
		}
		if(gt.y < Down && transform.position.z > MinZ) {
			transform.position -= transform.up*transform.position.y;
		}
		if(gt.x > Right && transform.position.x < MaxX) {
			transform.position += transform.right*transform.position.y;
		}
		if(gt.x < Left && transform.position.x > MinX) {
			transform.position -= transform.right*transform.position.y;
		}
	}
}
