How can I change it to work for mobile devices?
using UnityEngine;
public class CameraController : MonoBehaviour {
public float panSpeed = 30f;
public float panBorderThickness = 10f;
public float scrollSpeed = 5f;
public float minY = 10f;
public float maxY = 80f;
// Update is called once per frame
void Update () {
if (GameManager.GameIsOver)
{
this.enabled = false;
return;
}
if (Input.GetKey("w") || Input.mousePosition.y >= Screen.height - panBorderThickness)
{
transform.Translate(Vector3.forward * panSpeed * Time.deltaTime, Space.World);
}
if (Input.GetKey("s") || Input.mousePosition.y <= panBorderThickness)
{
transform.Translate(Vector3.back * panSpeed * Time.deltaTime, Space.World);
}
if (Input.GetKey("d") || Input.mousePosition.x >= Screen.width - panBorderThickness)
{
transform.Translate(Vector3.right * panSpeed * Time.deltaTime, Space.World);
}
if (Input.GetKey("a") || Input.mousePosition.x <= panBorderThickness)
{
transform.Translate(Vector3.left * panSpeed * Time.deltaTime, Space.World);
}
}
}