Adventure Creator Wikia
mNo edit summary
Tags: Visual edit apiedit
(LipSyncData dataClip needed reference declared as null as field is never assigned. Updated to private LipSyncData dataClip = null;)
Tags: Visual edit apiedit
 
Line 12: Line 12:
 
 
 
 
#if UNITY_EDITOR
+
<nowiki>#</nowiki>if UNITY_EDITOR
 
using UnityEditor;
 
using UnityEditor;
#endif
+
<nowiki>#endif
 
 
 
namespace AC
 
namespace AC
 
{
 
{
[System.Serializable]
+
</nowiki> [System.Serializable]
public class RogoLipSync_Stop : Action
+
<nowiki> </nowiki> public class RogoLipSync_Stop : Action
{
+
<nowiki> {
public bool isPlayer;
+
</nowiki> public bool isPlayer;
public LipSync lipSyncTarget;
+
<nowiki> </nowiki> public LipSync lipSyncTarget;
private LipSyncData dataClip;
+
<nowiki> </nowiki> private LipSyncData dataClip = null;
+
<nowiki>
public RogoLipSync_Stop()
+
</nowiki> public RogoLipSync_Stop()
{
+
<nowiki> {
this.isDisplayed = true;
+
</nowiki> this.isDisplayed = true;
category = ActionCategory.Custom;
+
<nowiki> </nowiki> category = ActionCategory.Custom;
title = "Rogo LipSync - Stop";
+
<nowiki> </nowiki> title = "Rogo LipSync - Stop";
description = "Stops a LipSyncData clip on a LipSync component when a LipSync animation is already playing.";
+
<nowiki> </nowiki> description = "Stops a LipSyncData clip on a LipSync component when a LipSync animation is already playing.";
isPlayer = true;
+
<nowiki> </nowiki> isPlayer = true;
 
 
}
+
<nowiki> }
 
 
override public float Run()
+
</nowiki> override public float Run()
{
+
<nowiki> {
if (isPlayer)
+
</nowiki> if (isPlayer)
{
+
<nowiki> {
lipSyncTarget = KickStarter.player.GetComponent<LipSync>();
+
</nowiki> lipSyncTarget = KickStarter.player.GetComponent<LipSync>();
 
 
if (lipSyncTarget == null)
+
<nowiki> </nowiki> if (lipSyncTarget == null)
{
+
<nowiki> </nowiki> {
Debug.LogWarning("RogoLipSync_Play: No LipSync component found on Player.");
+
<nowiki> </nowiki> Debug.LogWarning("RogoLipSync_Play: No LipSync component found on Player.");
return 0f;
+
<nowiki> </nowiki> return 0f;
}
+
<nowiki> </nowiki> }
}
+
<nowiki> }
 
 
lipSyncTarget.Stop(dataClip);
+
</nowiki> lipSyncTarget.Stop(dataClip);
return 0f;
+
<nowiki> </nowiki> return 0f;
}
+
<nowiki> }
 
 
 
 
override public void Skip(){
+
</nowiki> override public void Skip(){
 
 
}
+
<nowiki> }
 
 
 
 
 
 
#if UNITY_EDITOR
+
#</nowiki>if UNITY_EDITOR
override public void ShowGUI()
+
<nowiki> </nowiki> override public void ShowGUI()
{
+
<nowiki> {
isPlayer = EditorGUILayout.Toggle("Is player?", isPlayer);
+
</nowiki> isPlayer = EditorGUILayout.Toggle("Is player?", isPlayer);
 
 
if (!isPlayer)
+
<nowiki> </nowiki> if (!isPlayer)
{
+
<nowiki> {
lipSyncTarget = (LipSync)EditorGUILayout.ObjectField("Character:", lipSyncTarget, typeof(LipSync), true);
+
</nowiki> lipSyncTarget = (LipSync)EditorGUILayout.ObjectField("Character:", lipSyncTarget, typeof(LipSync), true);
}
+
<nowiki> }
AfterRunningOption();
+
</nowiki> AfterRunningOption();
}
+
<nowiki> }
 
#endif
 
#endif
 
}
 
}
}</span>
+
}</nowiki></span>
 
<span style="font-size:14px;font-weight:normal;line-height:22px;">-Original code provided by user Larsos-</span>
 
<span style="font-size:14px;font-weight:normal;line-height:22px;">-Original code provided by user Larsos-</span>
 
[[Category:Integrations]]
 
[[Category:Integrations]]

Latest revision as of 19:28, 20 September 2016

Note: This is an alternative integration for Rogo LipSync and is intended to allow emotions and mouth movement to be played independently from any audio. The integration consists of three AC actions. These will be posted in separate articles to avoid clutter.

Author's quote:

Use this as a means to have emotions/mouth movement that plays with text (no audio) and limit the .asset files to just a handful - short speech, medium speech, long speech. I also use it for asset files that just sync gestures and emotions. 

To use it replace the text in a .cs file named RogoLipSync_Stop with this text, or create a new blank text file, then paste the text and rename the file RogoLipSync_Stop.cs. Then drop the file into the folder named actions inside the Adventure creator folder. Then, just use the action in an action list.

The code for the Stop action is as follows:

using UnityEngine;
using System.Collections;
using RogoDigital.Lipsync;


#if UNITY_EDITOR
using UnityEditor;
#endif
 
 namespace AC
 {
     [System.Serializable]
    public class RogoLipSync_Stop : Action
    {
         public bool isPlayer;
        public LipSync lipSyncTarget;
        private LipSyncData dataClip = null;
        
         public RogoLipSync_Stop()
        {
             this.isDisplayed = true;
            category = ActionCategory.Custom;
            title = "Rogo LipSync - Stop";
            description = "Stops a LipSyncData clip on a LipSync component when a LipSync animation is already playing.";
            isPlayer = true;

        }
 
         override public float Run()
        {
             if (isPlayer)
            {
                 lipSyncTarget = KickStarter.player.GetComponent<LipSync>();

                if (lipSyncTarget == null)
                {
                    Debug.LogWarning("RogoLipSync_Play: No LipSync component found on Player.");
                    return 0f;
                }
            }
 
             lipSyncTarget.Stop(dataClip);
            return 0f;
        }
 
 
         override public void Skip(){

        }
 
 
 
 #if UNITY_EDITOR
        override public void ShowGUI()
        {
             isPlayer = EditorGUILayout.Toggle("Is player?", isPlayer);

            if (!isPlayer)
            {
                 lipSyncTarget = (LipSync)EditorGUILayout.ObjectField("Character:", lipSyncTarget, typeof(LipSync), true);
            }
             AfterRunningOption();
        }
 #endif
     }
 }

-Original code provided by user Larsos-