private static FlowGraphExecutor GetOrCreateFlowGraphExecutor() { if (FlowRoot == null) { FlowRoot = new GameObject(FlowRootName); } GameObject flowGraphObject = new GameObject(FlowGraphName); UnityUtils.SetChild(FlowRoot, flowGraphObject); return(flowGraphObject.AddComponent <FlowGraphExecutor>()); }
private AudioSource CreateAudioSource(SoundType soundType) { if (_root == null) { _root = UnityUtils.AddChild(gameObject); _root.name = "AudioSources"; } AudioSource audioSource = _root.AddComponent <AudioSource>(); audioSource.loop = soundType == SoundType.BGM ? true : false; audioSource.playOnAwake = false; audioSource.volume = 1f; return(audioSource); }