mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-06-26 19:34:47 +00:00
28 lines
702 B
C#
28 lines
702 B
C#
|
using UnityEngine;
|
||
|
|
||
|
namespace HPJ.Examples
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// An example script that rotates a object over time
|
||
|
/// </summary>
|
||
|
public class Rotate : MonoBehaviour
|
||
|
{
|
||
|
public float RotationSpeed = 5;
|
||
|
public Space RotationSpace = Space.World;
|
||
|
|
||
|
public Vector3 Rotation = new Vector3();
|
||
|
private Vector3 RotationVector = new Vector3();
|
||
|
|
||
|
private void Awake()
|
||
|
{
|
||
|
Rotation = Rotation.normalized;
|
||
|
RotationVector = Rotation * RotationSpeed;
|
||
|
}
|
||
|
|
||
|
// Update is called once per frame
|
||
|
void Update()
|
||
|
{
|
||
|
transform.Rotate(RotationVector * Time.deltaTime, RotationSpace);
|
||
|
}
|
||
|
}
|
||
|
}
|