CameraMove.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraMove : MonoBehaviour
{
int Mode;
public GameObject camera;
public float angle = 10f;
private Vector3 targetPos;
public Transform target;
public float speed = 1.0f;
void Start()
{
Mode = 1;
}
// Update is called once per frame
void Update()
{
Mode = 1;
switch (Mode)
{
case 0:
camerayokoidou();
break;
case 1:
camerakaiten();
break;
}
}
void camerayokoidou()
{
camera.transform.position += new Vector3(5, 0, 0);
}
void camerakaiten()
{
transform.LookAt(target);
Vector3 axis = transform.TransformDirection(Vector3.up);
transform.RotateAround(target.position, axis, speed*0.01f);
}
}