private void ConfigurePathHighlighterTo(GroupSequence group) { var agents = group.agents.Where(agent => agent != UIState.Agent.Get()).ToArray(); while (agents.Length > pathHighlighters.Count) { pathHighlighters.Add(new PathHighlighter()); } for (var i = 0; i < agents.Length; i++) { pathHighlighters[i].Initialize(agents[i], transform); } }
void Start() { UIState.Group.OnChange += newGroup => { ClearAllHighlighters(); if ((focusedGroup = newGroup) != null) { HighlighterObject.enabled = true; foreach (var agent in focusedGroup.agents) { memberHighlighters.Add( Instantiate(HighlighterObject.gameObject, agent.transform, false) ); } HighlighterObject.enabled = false; ConfigurePathHighlighterTo(focusedGroup); } }; }
private List <GroupSequence> LoadGroupSetsFromFile() { var yamlDefs = MiniYaml.Load(Game.ModData.DefaultFileSystem, new[] { "op2-groups.yaml" }, null); var groupSequences = new List <GroupSequence>(); foreach (var group in yamlDefs) { var fart = group.Value.Nodes.First(x => x.Key == "ActorType").Value; var groupNodes = group.Value.Nodes; var groupSequence = new GroupSequence { Name = group.Key, ActorType = (ActorType)Enum.Parse(typeof(ActorType), groupNodes.First(x => x.Key == "ActorType").Value.Value.ToString()), }; var createBaseActor = groupNodes.FirstOrDefault(x => x.Key == "CreateBaseActor")?.Value?.Value ?.ToString().ToLowerInvariant(); if (!string.IsNullOrWhiteSpace(createBaseActor)) { groupSequence.CreateBaseActor = createBaseActor == "true"; } var createExampleActor = groupNodes.FirstOrDefault(x => x.Key == "CreateExampleActor")?.Value?.Value ?.ToString().ToLowerInvariant(); if (!string.IsNullOrWhiteSpace(createExampleActor)) { groupSequence.CreateExampleActor = createExampleActor == "true"; } var withBlankIdle = groupNodes.FirstOrDefault(x => x.Key == "WithBlankIdle")?.Value?.Value ?.ToString().ToLowerInvariant(); if (!string.IsNullOrWhiteSpace(withBlankIdle)) { groupSequence.WithBlankIdle = withBlankIdle == "true"; } var setsNode = group.Value.Nodes.First(x => x.Key == "Sets").Value.Nodes; var sets = new List <GroupSequenceSet>(); foreach (var set in setsNode) { var setNodes = set.Value.Nodes; var groupSequenceSet = new GroupSequenceSet { Sequence = set.Value.Value, Start = int.Parse(setNodes.First(x => x.Key == "Start").Value.Value.ToString()), }; if (int.TryParse(setNodes.FirstOrDefault(x => x.Key == "Length")?.Value?.Value?.ToString(), out var length)) { groupSequenceSet.Length = length; } if (int.TryParse(setNodes.FirstOrDefault(x => x.Key == "OffsetX")?.Value?.Value?.ToString(), out var offsetX)) { groupSequenceSet.OffsetX = offsetX; } if (int.TryParse(setNodes.FirstOrDefault(x => x.Key == "OffsetY")?.Value?.Value?.ToString(), out var offsetY)) { groupSequenceSet.OffsetY = offsetY; } if (int.TryParse(setNodes.FirstOrDefault(x => x.Key == "OffsetZ")?.Value?.Value?.ToString(), out var offsetZ)) { groupSequenceSet.OffsetZ = offsetZ; } if (int.TryParse(setNodes.FirstOrDefault(x => x.Key == "StartOffset")?.Value?.Value?.ToString(), out var startOffset)) { groupSequenceSet.StartOffset = startOffset; } sets.Add(groupSequenceSet); } groupSequence.Sets = sets.ToArray(); groupSequences.Add(groupSequence); } return(groupSequences); }