Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View zhixu's full-sized avatar
:octocat:
coding bleep bloop

Katherine Xu zhixu

:octocat:
coding bleep bloop
View GitHub Profile
public void startRandomMotion(string name ,int priority)
{
int max = modelSetting.getMotionNum( name );
int no = (int)(rand.NextDouble() * max ) ; // picking a random number from your motion group
startMotion( name, no, priority ) ;
}
"expressions":
[
{"name":"f01","file":"motions/expressions/f01.exp.json"},
{"name":"f02","file":"motions/expressions/f02.exp.json"},
{"name":"f03","file":"motions/expressions/f03.exp.json"},
{"name":"f04","file":"motions/expressions/f04.exp.json"}
],
"motions":
{
"idle":
public void setExpression(string name)
{
if( ! expressions.ContainsKey( name ) )return;
if( LAppDefine.DEBUG_LOG ) Debug.Log( "Setting expression : " + name ) ;
AMotion motion=expressions[ name ] ;
expressionManager.startMotion( motion , false ) ;
}
public void setRandomExpression()
{
public void startRandomMotion(string name ,int priority)
{
int max = modelSetting.getMotionNum( name );
int no = (int)(rand.NextDouble() * max ) ; // picking a random number from your motion group
startMotion( name, no, priority ) ;
}
public void startMotion(string name, int no,int priority)
{
string motionName = modelSetting.getMotionFile( name, no ) ;
public void motionCorrect()
{
points++; // adds one point to the score
percentage = points/total; // recalculates percentage with new score
// character becomes happy that you answered the question correctly
appModel.setExpression("happy");
// body movement changes depending on percentage
if (percentage >= 70) {
public bool tapEvent(float x,float y)
{
if(LAppDefine.DEBUG_LOG) Debug.Log("tapEvent view x:"+x+" y:"+y);
if(hitTest( "D_REF.HEAD",x, y ))
{
startMotion("nod", 0, LAppDefine.PRIORITY_NORMAL); // display motion
Camera.main.GetComponent<GUIAnswers>().eliminateAnswer (); // eliminate answer
}
public bool tapEvent(float x,float y)
{
if(LAppDefine.DEBUG_LOG) Debug.Log("tapEvent view x:"+x+" y:"+y);
if(hitTest( "D_REF.HEAD",x, y ))
{
startMotion("nod", 0, LAppDefine.PRIORITY_NORMAL); // display motion
Camera.main.GetComponent<GUIAnswers>().eliminateAnswer (); // eliminate answer
}
void getAudio(string src) {
string url = "http://api.voicerss.org/?";
string key = "your0api0key";
string hl = "ja-jp";
string r = "-3";
string c = "OGG";
string f = "48khz_16bit_stereo";
url = url + "key=" + key + "&src=" + src + "&hl=" + hl + "&r=" + r + "&c=" + c + "&f=" + f;