示例#1
0
 private static void DeleteCurrentCutsceneObject()
 {
     SetAnimationSpeed(0f);
     GoToCutsceneTimestamp(0f);
     if (currentCutsceneObject != null)
     {
         CoAnimController animController = currentCutsceneObject.GetComponentInChildren <CoAnimController>();
         if (animController != null)
         {
             animController.CutSceneDone();
         }
         UnityEngine.Object.Destroy(currentCutsceneObject);
         currentCutsceneObject = null;
     }
     if (cutsceneAnimationContainer != null)
     {
         cutsceneAnimationContainer = null;
     }
 }
示例#2
0
    private static void CutsceneLoadDone(GameObject loadedCutsceneObject)
    {
        try{
            currentCutsceneObject = UnityEngine.Object.Instantiate <GameObject>(loadedCutsceneObject);
            if (currentCutsceneObject == null)
            {
                configHolder.LogMessage(LogType.Warning, "Instantiation of GameObject failed!");
                return;
            }
            currentCutsceneObject.name = loadedCutsceneObject.name;
            CoAnimController animationController = currentCutsceneObject.GetComponentInChildren <CoAnimController>();
            cutsceneAnimationContainer = (KAMonoBase)animationController;

            GoToCutsceneTimestamp(0f);

            if (configHolder.config == null || !configHolder.config.cutscenePlayerPlayByDefault)
            {
                SetAnimationSpeed(0f);
            }

            if (cutsceneAnimationContainer != null && cutsceneAnimationContainer.animation != null && frameSlider != null)
            {
                foreach (AnimationState animState in cutsceneAnimationContainer.animation)
                {
                    frameSlider.maxValue = animState.length;
                    break;
                }

                /*foreach(Animation anim in cutsceneAnimationContainer.transform.GetComponentsInChildren<Animation>()){
                 *      configHolder.LogInfo("animationContainer: " + anim.gameObject.name);
                 *      foreach(AnimationState animState in anim){
                 *              configHolder.LogInfo("\tanimationState: " + animState.name);
                 *              foreach(AnimationEvent animEvent in animState.clip.events){
                 *                      configHolder.LogInfo("\t\t" + AnimationEventToString(animEvent));
                 *              }
                 *      }
                 * }*/

                /*foreach(AQUAS_Camera cam in cutsceneAnimationContainer.transform.GetComponentsInChildren<AQUAS_Camera>()){
                 *      if(cam.gameObject.activeInHierarchy){
                 *              configHolder.LogInfo("active Camera: " + cam.name);
                 *      }else{
                 *              configHolder.LogInfo("inactive Camera: " + cam.name);
                 *      }
                 * }*/
            }

            if (animationController == null)
            {
                configHolder.LogMessage(LogType.Warning, "Could not find AnimationController in loaded cutscene, not sure why (that's bad)");
            }
            else
            {
                animationController._MessageObject = instance.gameObject;
                configHolder.LogMessage(LogType.Log, "Everything seems fine, cutscene should be loaded.");
                animationController.CutSceneStart();
            }
        }catch (Exception e) {
            configHolder.LogMessage(LogType.Error, "caught unexpected exception: " + e.ToString());
        }
    }