1118OPSSNew/Assets/NewScripts/Camera Orbit/Example/CameraOrbitExample.cs

25 lines
522 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraOrbitExample : MonoBehaviour
{
public CameraOrbit cameraOrbit;
public Transform[] targets;
int idx=0;
void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
if (idx < targets.Length-1)
{
idx++;
}
else
{
idx = 0;
}
cameraOrbit.SetTarget(targets[idx]);
}
}
}