You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
984 B

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraManager : MonoBehaviour
{
public static CameraManager Instance = null;
public Camera MainCamera;
public float MainCameraSpeed = 20;
private float MainCameraMaxUp=255;
private float MainCameraMaxDown=-325;
private float MainCameraMaxLeft = -186;
private float MainCameraMaxRight = 186;
public void Init()
{
Instance = this;
}
public void MoveMainCamera(Vector3 dir)
{
Vector3 moveMent = MainCamera.transform.position + dir * MainCameraSpeed * Time.deltaTime;
if (moveMent.z >= MainCameraMaxUp|| moveMent.z <= MainCameraMaxDown )
{
return;
}else if(moveMent.x >= MainCameraMaxRight|| moveMent.x <=MainCameraMaxLeft)
{
return;
}
MainCamera.transform.position = moveMent;
}
public void MoveCamera(Vector3 dir,float speed)
{
}
}