31 lines
616 B
C#
31 lines
616 B
C#
using System;
|
|
using UnityEngine;
|
|
|
|
public class RotateAroundTargetAnim : MonoBehaviour
|
|
{
|
|
public Transform target;
|
|
public float rotateSpeed = .1f;
|
|
|
|
private float triggerTimer;
|
|
public float FreeTime = 1;
|
|
|
|
private void FixedUpdate()
|
|
{
|
|
if (triggerTimer >= FreeTime)
|
|
{
|
|
this.transform.RotateAround(target.position, target.up, Time.fixedDeltaTime * rotateSpeed);
|
|
}
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (Input.anyKey)
|
|
{
|
|
triggerTimer = 0;
|
|
}
|
|
else
|
|
{
|
|
triggerTimer += Time.deltaTime;
|
|
}
|
|
}
|
|
} |