private void Initialize() { SpellIndicators = GetComponentsInChildren <SpellIndicator>(); StatusIndicators = GetComponentsInChildren <StatusIndicator>(); RangeIndicators = GetComponentsInChildren <RangeIndicator>(); SpellIndicators.ToList().ForEach(x => InitializeSplat(x)); StatusIndicators.ToList().ForEach(x => InitializeSplat(x)); RangeIndicators.ToList().ForEach(x => InitializeSplat(x)); }
void OnEnable() { // Create a list of all the splats available to the manager SpellIndicators = GetComponentsInChildren <SpellIndicator>(); RangeIndicators = GetComponentsInChildren <RangeIndicator>(); // Make sure each Splat has a reference to its Manager SpellIndicators.ToList().ForEach(x => x.Manager = this); RangeIndicators.ToList().ForEach(x => x.Manager = this); // Initialize the Splats SpellIndicators.ToList().ForEach(x => x.Initialize()); RangeIndicators.ToList().ForEach(x => x.Initialize()); // Make all Splats invisible to start with SpellIndicators.ToList().ForEach(x => x.gameObject.SetActive(false)); RangeIndicators.ToList().ForEach(x => x.gameObject.SetActive(false)); }
/// <summary> /// Return the Range Indicator given by name. /// </summary> public RangeIndicator GetRangeIndicator(string splatName) { return(RangeIndicators.Where(x => x.name == splatName).FirstOrDefault()); }