Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using AntonioHR.Amusi;
- using UnityEngine;
- public class CustomMonoDancer : MonoDancer
- {
- public Vector3 axis = Vector3.up;
- public float angle = 360;
- private Quaternion startRotation;
- //Use this instead of the MonoBehaviour Start Function
- protected override void Init()
- {
- }
- //This is called whenever a note starts playing
- protected override void OnNoteStart()
- {
- startRotation = transform.rotation;
- }
- //This is called every frame while a note plays.
- //Progress goes from 0 to 1 as the note progresses
- protected override void OnNoteUpdate(float progress)
- {
- var extraRotation = Quaternion.AngleAxis(angle * progress, axis);
- transform.rotation = startRotation * extraRotation;
- }
- //This is called whenever a note ends
- protected override void OnNoteEnd()
- {
- var extraRotation = Quaternion.AngleAxis(angle, axis);
- transform.rotation = startRotation * extraRotation;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement