示例#1
0
 void ChangeGestureBody(BodyGestures bg)
 {
     animator.SetInteger("body_lean", (int)bg);
     currentBodyGesture = bg;
 }
示例#2
0
        public override void ChangeTalkMode(string mode)
        {
            if (true && !string.IsNullOrEmpty(mode))
            {
                string[] parts             = mode.Split('/');
                GestureConfigurations conf = GestureConfigurations.idle;
                if (parts.Length == 1)
                {
                    try
                    {
                        conf = (GestureConfigurations)Enum.Parse(typeof(GestureConfigurations), parts[0]);
                    }
                    catch (Exception e)
                    {
                        Debug.LogWarning("Couldn't parse gesture configuration " + mode + " " + e.Message);
                    }

                    ChangeGestureConfiguration(conf);
                }
                else if (parts.Length >= 2)
                {
                    switch (parts[0])
                    {
                    case "arms":
                        try
                        {
                            ArmGestures gest = (ArmGestures)Enum.Parse(typeof(ArmGestures), parts[1]);
                            ChangeGestureArms(gest);
                        }
                        catch
                        {
                            Debug.LogWarning("Couldn't parse gesture arms " + mode + " " + parts[1]);
                        }
                        break;

                    case "eyes":
                        try
                        {
                            EyeGestures gest = (EyeGestures)Enum.Parse(typeof(EyeGestures), parts[1]);
                            ChangeGestureEyes(gest);
                        }
                        catch
                        {
                            Debug.LogWarning("Couldn't parse gesture eyes " + mode + " " + parts[1]);
                        }
                        break;

                    case "head":
                        try
                        {
                            HeadGestures gest = (HeadGestures)Enum.Parse(typeof(HeadGestures), parts[1]);
                            ChangeGestureHead(gest);
                        }
                        catch
                        {
                            Debug.LogWarning("Couldn't parse gesture head " + mode + " " + parts[1]);
                        }
                        break;

                    case "neck":
                        try
                        {
                            NeckGestures gest = (NeckGestures)Enum.Parse(typeof(NeckGestures), parts[1]);
                            ChangeGestureNeck(gest);
                        }
                        catch
                        {
                            Debug.LogWarning("Couldn't parse gesture neck " + mode + " " + parts[1]);
                        }
                        break;

                    case "body":
                        try
                        {
                            BodyGestures gest = (BodyGestures)Enum.Parse(typeof(BodyGestures), parts[1]);
                            ChangeGestureBody(gest);
                        }
                        catch
                        {
                            Debug.LogWarning("Couldn't parse gesture body " + mode + " " + parts[1]);
                        }
                        break;

                    default:
                        Debug.LogWarning("Unknown gesture type, " + mode);
                        break;
                    }
                }
            }
        }