// Update is called once per frame void Update () { switch( m_State ) { case RotateByAngular01State.UnActive : break ; case RotateByAngular01State.Initialization : x = 0 ; y = 0 ; m_State = RotateByAngular01State.X ; break ; case RotateByAngular01State.X : x += 0.1f ; this.transform.rotation = Quaternion.identity ; this.transform.Rotate( x , 0 , 0 , Space.Self ) ; if( x > 90 ) { m_PreviousRotation = this.transform.rotation ; m_State = RotateByAngular01State.Y ; } break ; case RotateByAngular01State.Y : y += 0.1f ; this.transform.rotation = m_PreviousRotation ; this.transform.Rotate( 0 , y , 0 , Space.Self ) ; if( y > 90 ) m_State = RotateByAngular01State.End ; break ; case RotateByAngular01State.End : break ; } }
public void ReStart() { m_State = RotateByAngular01State.Initialization ; }