Advertisement
Guest User

Untitled

a guest
Nov 20th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.99 KB | None | 0 0
  1. using AntonioHR.Amusi;
  2. using UnityEngine;
  3.  
  4. public class CustomMonoDancer : MonoDancer
  5. {
  6.     public Vector3 axis = Vector3.up;
  7.     public float angle = 360;
  8.     private Quaternion startRotation;
  9.  
  10.     //Use this instead of the MonoBehaviour Start Function
  11.     protected override void Init()
  12.     {
  13.     }
  14.  
  15.     //This is called whenever a note starts playing
  16.     protected override void OnNoteStart()
  17.     {
  18.         startRotation = transform.rotation;
  19.     }
  20.  
  21.     //This is called every frame while a note plays.
  22.     //Progress goes from 0 to 1 as the note progresses
  23.     protected override void OnNoteUpdate(float progress)
  24.     {
  25.         var extraRotation = Quaternion.AngleAxis(angle * progress, axis);
  26.         transform.rotation = startRotation * extraRotation;
  27.     }
  28.     //This is called whenever a note ends
  29.     protected override void OnNoteEnd()
  30.     {
  31.         var extraRotation = Quaternion.AngleAxis(angle, axis);
  32.         transform.rotation = startRotation * extraRotation;
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement