Ejemplo n.º 1
0
 /// <summary>
 /// Loads the Loop Animations Preset that is set to load at runtime and performs the inital setup of the loop animations.
 /// </summary>
 /// <param name="forced"></param>
 void InitLoopAnimations(bool forced = false)
 {
     if (loopAnimationsArePlaying)
     {
         return;
     }
     if (loadLoopAnimationsPresetAtRuntime)
     {
         Loop presetLoop = UIAnimatorUtil.GetLoop(loopAnimationsPresetCategoryName, loopAnimationsPresetName);
         if (presetLoop != null)
         {
             loopAnimations = presetLoop.Copy();
         }
     }
     if (loopAnimations == null || !loopAnimations.Enabled)
     {
         return;
     }
     ResetRectTransform();
     UIAnimator.SetupLoops(RectTransform, startPosition, startRotation, startScale, startAlpha, loopAnimations,
                           null, null,
                           null, null,
                           null, null,
                           null, null,
                           LOOP_ANIMATIONS_ID, true, forced);
     if (loopAnimations.autoStart)
     {
         loopAnimationsArePlaying = true;
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Loads the Loop Animations Preset that is set to load at runtime and performs the inital setup of the loop animations.
 /// </summary>
 /// <param name="forced"></param>
 void InitLoopAnimations(bool forced = false)
 {
     if (loopAnimationsArePlaying)
     {
         return;
     }
     if (loadLoopAnimationsPresetAtRuntime)
     {
         Loop presetLoop = UIAnimatorUtil.GetLoop(loopAnimationsPresetCategoryName, loopAnimationsPresetName);
         if (presetLoop != null)
         {
             bool autoStart = loopAnimations.autoStart;    //save the autoStart setting from the inspector (the value set by the developer)
             loopAnimations           = presetLoop.Copy(); //load the preset settings
             loopAnimations.autoStart = autoStart;         //override the autoStart setting (that the preset came with) so that autoStart is set to the value the developer set it to
         }
     }
     if (loopAnimations == null || !loopAnimations.Enabled)
     {
         return;
     }
     ResetRectTransform();
     UIAnimator.SetupLoops(RectTransform, startPosition, startRotation, startScale, startAlpha, loopAnimations,
                           null, null,
                           null, null,
                           null, null,
                           null, null,
                           LOOP_ANIMATIONS_ID, true, forced);
     if (loopAnimations.autoStart)
     {
         PlayLoopAnimations();
     }
 }