private static MixedDataRecord ParseMixedRecords(string[] tokens, int startIndex, int endIndex) { var record = new MixedDataRecord(); for (var i = startIndex + 1; i < endIndex; i++) { int end; if (tokens[i] == "(") { end = IndexHelper.GetEndIndex(tokens, i, BracketType.RoundBracket); record.Records.Add(ParseMixedRecords(tokens, i, end)); } else if (tokens[i] == "[") { end = IndexHelper.GetEndIndex(tokens, i, BracketType.SquareBracket); record.Records.Add(ParseMultipleRecords(tokens, i, end)); } else { record.Records.Add(ParseSingleDataRecord(tokens, i)); end = i; } i = end; } return(record); }
private static void AddEnemyAction(EnemyRoute enemyRoute, MixedDataRecord mixedDataRecord) { var actionName = mixedDataRecord.GetStringValue(0); var multipleRecords = mixedDataRecord.GetMultipleRecords(1); EnemyAction action; if (actionName == MoveAction) { action = GetMoveAction(multipleRecords); } else if (actionName == RotateAction) { action = GetRotateAction(multipleRecords); } else if (actionName == PauseAction) { action = GetPauseAction(multipleRecords); } else if (actionName == EnterDoorAction) { action = GetEnterDoorAction(multipleRecords); } else if (actionName == LieDown) { action = new LieDownAction(); } else if (actionName == GetUp) { action = new GetUpAction(); } else if (actionName == KneelDown) { action = new KneelDownAction(); } else if (actionName == DiveIn) { action = new DiveInAction(); } else if (actionName == DiveOut) { action = new DiveOutAction(); } else { return; } enemyRoute.Actions.Add(action); }