using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 中心点を軸にオブジェクトを公転回転させる
/// </summary>
public class RevolutionLight : MonoBehaviour
{
[Header("中心点のゲームオブジェクトの位置")]
public Transform centerTran;
[Header("回転速度")]
public float rotateSpeed;
void Update()
{
if (centerTran == null) {
// 中心点の指定なし = ワールド座標の原点(0, 0, 0)を中心点として公転回転
transform.RotateAround(Vector3.zero, Vector3.one, rotateSpeed * Time.deltaTime);
} else {
// 中心点の指定あり = ワールド座標の指定された位置を中心点として公転回転
transform.RotateAround(centerTran.position, Vector3.one, rotateSpeed * Time.deltaTime);
}
}
}