public static string GetEnemyRoutesRecordString(EnemyCharacter enemy) { var stringBuilder = new StringBuilder(); stringBuilder.Append($"{Patrol} [ "); if (enemy.Routes.Count == 0) { stringBuilder.Append($".NO_EXISTE 1.0 ]"); } else { stringBuilder.Append($"{EnemyAction} [ {Routes} ( "); foreach (var route in enemy.Routes) { stringBuilder.Append($"[ {RouteName} {route.RouteName} " + $"{SerializerHelper.GetSpeedRecordString(route.Speed)} {SerializerHelper.GetActionTypeRecordString(route.ActionRepeatType)}" + $" {EnemyActionHelper.GetEnemyActionsRecordString(route.Actions)} ] "); } stringBuilder.Append($")"); stringBuilder.Append($" {DefaultRoute} {enemy.DefaultRoute} ] ]"); } return(stringBuilder.ToString()); }
private static string GetEnemyActionRecordString(EnemyAction action) { if (action is MoveAction moveAction) { return($"( {MoveAction} [ {SerializerHelper.GetMovementTypeRecordString(moveAction.MovementType)} {SerializerHelper.GetIPositionRecordString(moveAction)} ] ) "); } if (action is RotateAction rotateAction) { return($"( {RotateAction} [ {SerializerHelper.GetAngleRecordString(rotateAction.Angle)} ] ) "); } if (action is PauseAction pauseAction) { return($"( {PauseAction} [ {SerializerHelper.GetTimeRecordString(pauseAction.Time)} ] ) "); } if (action is EnterDoorAction doorAction) { return($"( {EnterDoorAction} [ {SerializerHelper.GetMovementTypeRecordString(doorAction.MovementType)} {DoorName} {doorAction.DoorName} ] ) "); } if (action is LieDownAction lieDownAction) { return($"( {LieDown} [ ] ) "); } if (action is GetUpAction getUpAction) { return($"( {GetUp} [ ] ) "); } if (action is KneelDownAction kneelDownAction) { return($"( {KneelDown} [ ] ) "); } if (action is DiveInAction diveInAction) { return($"( {DiveIn} [ ] ) "); } if (action is DiveOutAction diveOutAction) { return($"( {DiveOut} [ ] ) "); } return(string.Empty); }