This repository has been archived on 2025-04-11. You can view files and clone it, but cannot push or open issues or pull requests.
mochapine64backup/MoCha/Assets/Scripts/SpinningCube.cs

30 lines
568 B
C#
Raw Normal View History

2018-04-06 12:55:27 -05:00
using UnityEngine;
using System.Collections;
2018-04-10 12:44:50 -05:00
public class SpinningCube : MonoBehaviour {
2018-04-17 14:13:50 -05:00
public float m_Speed = 100f;
public float faster = 1f;
2018-04-06 12:55:27 -05:00
2018-04-17 14:13:50 -05:00
private Vector3 m_RotationDirection = Vector3.right;
2018-04-06 12:55:27 -05:00
public void ToggleRotationDirection()
{
Debug.Log ("Toggling rotation direction");
if (m_RotationDirection == Vector3.up)
{
m_RotationDirection = Vector3.down;
}
else
{
m_RotationDirection = Vector3.up;
}
}
void Update()
{
2018-04-17 14:13:50 -05:00
Time.timeScale = 5;
transform.Rotate(m_RotationDirection * (Mathf.Sin(Time.time) / 20f) * m_Speed);
2018-04-06 12:55:27 -05:00
}
}