2023-03-28 13:16:30 -04:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
public class SpinVert : MonoBehaviour
|
|
|
|
{
|
2023-04-26 01:28:58 -04:00
|
|
|
[Header("Spin on axis")]
|
|
|
|
[SerializeField] public bool X = false;
|
|
|
|
[SerializeField] public bool Y = false;
|
|
|
|
[SerializeField] public bool Z = false;
|
|
|
|
|
|
|
|
[Header("Controller")]
|
|
|
|
[SerializeField] public bool Spin = false;
|
|
|
|
[SerializeField] private float Speed = 100f;
|
2023-03-28 13:16:30 -04:00
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
void Update()
|
|
|
|
{
|
2023-04-26 01:28:58 -04:00
|
|
|
if (Spin) {
|
|
|
|
if (X) {
|
|
|
|
transform.Rotate(Speed * Time.deltaTime, 0f, 0f, Space.Self);
|
|
|
|
}
|
|
|
|
if (Y) {
|
|
|
|
transform.Rotate(0f, Speed * Time.deltaTime, 0f, Space.Self);
|
|
|
|
}
|
|
|
|
if (Z) {
|
|
|
|
transform.Rotate(0f, 0f, Speed * Time.deltaTime, Space.Self);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void StartSpinning() {
|
|
|
|
Spin = true;
|
2023-03-28 13:16:30 -04:00
|
|
|
}
|
2023-04-26 01:28:58 -04:00
|
|
|
}
|