/// <summary> /// Forces a facial expression on the girl. /// </summary> /// <param name="girl">The <see cref="Girl"/> instance on which to set the expression on.</param> /// <param name="expressionType">The type of expression to set.</param> /// <param name="changeEyes">When <c>true</c>, also set the girl's eyes to the one that belongs to the specified expression.</param> /// <param name="changeMouth">When <c>true</c>, also set the girl's mouth to the one that belongs to the specified expression.</param> /// <remarks> /// The girl's eyebrows and face/blush are always set. /// When the specified expression is not found, the girl's <see cref="GirlDefinition.defaultExpression"/> will be used. /// </remarks> public static void ForceExpression(this Girl girl, GirlExpressionType expressionType, bool changeEyes = true, bool changeMouth = true) { if (girl.definition == null) { throw new InvalidOperationException($"{nameof(girl)}.{nameof(girl.definition)} is null"); } int index = girl.definition.pieces.FindIndex(p => p.type == GirlPieceType.EXPRESSION && p.expressionType == expressionType); if (index == -1) { index = girl.definition.defaultExpression; } girl.ForceExpression(index, changeEyes, changeMouth); }