public static void PopulateRoutes(EnemyCharacter enemy, MultipleRecords multipleRecords) { enemy.DefaultRoute = multipleRecords.GetStringValue(DefaultRoute); var routes = multipleRecords.GetMixedDataRecord(Routes); foreach (var route in routes) { var record = route as MultipleRecords; var enemyActions = new EnemyRoute(); enemyActions.RouteName = record.GetStringValue(RouteName); enemyActions.Speed = record.GetStringValue(StringConstants.Speed); enemyActions.ActionRepeatType = record.GetStringValue(StringConstants.EnemyActionType); EnemyActionHelper.AddEnemyActions(enemyActions, record.GetMixedDataRecord(ActionStep)); enemy.Routes.Add(enemyActions); } }
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()); }