12345678910111213141516171819202122232425262728293031 |
- using System;
- using UnityEngine;
- public class AutoRotate : MonoBehaviour
- {
- private void Update()
- {
- Vector3 a = Vector3.one * this.Speed;
- if (!this.RotateOnX)
- {
- a.x = 0f;
- }
- if (!this.RotateOnY)
- {
- a.y = 0f;
- }
- if (!this.RotateOnZ)
- {
- a.z = 0f;
- }
- base.transform.Rotate(a * Time.deltaTime);
- }
- public float Speed = 5f;
- public bool RotateOnX = true;
- public bool RotateOnY = true;
- public bool RotateOnZ = true;
- }
|