/// <summary> /// Abstract layer for the a gaze /// </summary> /// <param name="type">Type of gaze</param> public void startGaze(gazeType type) { this.type = type; startGaze(); }
/// <summary> /// Figure out the direction according to change /// </summary> /// <param name="type">Type of Gaze</param> /// <returns>Direction and Distance of the movement</returns> protected List<float> DirectionChance(gazeType type) { Random rnd = new Random(); int random1 = rnd.Next(0, 10); //Min is 0, Max is 9; int random2 = rnd.Next(1, 3); // just 1 or 2. //50-50 List<float> returnList = new List<float>(); if (Enum.Equals(type,gazeType.intimacy)) //Intimicy { if (random1 < 7) // 0-6 70% { //Go to the side. returnList.Add((END_HEAD_SIDE * INTIMACY_MULTIPLIYER)); returnList.Add(0F); } else if (random1 < 8) //8 10% { //Gaze up if (random2 == 1) { //Up and side returnList.Add(END_HEAD_SIDE * INTIMACY_MULTIPLIYER); returnList.Add(END_HEAD_UP * INTIMACY_MULTIPLIYER); } else { //just up returnList.Add(0F); returnList.Add(END_HEAD_UP * INTIMACY_MULTIPLIYER); } } else { //Gaze down if (random2 == 1) //20% { //down and side returnList.Add(END_HEAD_SIDE * INTIMACY_MULTIPLIYER); returnList.Add(END_HEAD_DOWN * INTIMACY_MULTIPLIYER); } else { //down only returnList.Add(0F); returnList.Add(END_HEAD_DOWN * INTIMACY_MULTIPLIYER); } } } else { if (random1 < 1) //10% { //just to the side returnList.Add(END_HEAD_SIDE); returnList.Add(0F); } else if (random1 < 8) // 70% { if (random2 == 1) { //up and side returnList.Add(END_HEAD_SIDE * SIDE_MULTIPLIER); returnList.Add(END_HEAD_UP); } else { //just up returnList.Add(0F); returnList.Add(END_HEAD_UP); } } else { if (random2 == 1) { //down and side returnList.Add(END_HEAD_SIDE * SIDE_MULTIPLIER); returnList.Add(END_HEAD_DOWN); } else { //just down; returnList.Add(0F); returnList.Add(END_HEAD_DOWN); } } } return returnList; }
/// <summary> /// Helper function to go to listening mood /// </summary> public void listeningMood() { this.type = gazeType.intimacy; this.mode = gazeMood.listening; speakingIntimacy = false; //Manual restart facetracking this.gazemotion.resumeFaceTracking(); }