Exemple #1
0
 void ChangeGestureHead(CharacterBrain.HeadGestures hg)
 {
     animator.SetInteger("head", (int)hg);
     currentHeadGesture = hg;
 }
Exemple #2
0
        public void ChangeTalkMode(string mode)
        {
            if (!staticCharacter && state == State.TalkDiagonal && !string.IsNullOrEmpty(mode))
            {
                string[] parts = mode.Split('/');

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

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

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

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

                    case "body":
                        try
                        {
                            CharacterBrain.BodyGestures gest = (CharacterBrain.BodyGestures)Enum.Parse(typeof(CharacterBrain.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;
                    }
                }
            }
        }