public void Setup(string source, bool onlyActiveAgentClips, string clipId, AudioClip clip, int nParts) { this.source = source; this.clipId = clipId; this.audioSource = gameObject.AddComponent <AudioSource>(); this.audioSource.minDistance = 0.25f; this.audioSource.maxDistance = 10f; this.audioSource.rolloffMode = AudioRolloffMode.Logarithmic; this.audioSource.clip = clip; this.partsReceived = new bool[nParts]; if (source.Length > 0) { ASAPToolkitManager atm = FindObjectOfType <ASAPToolkitManager>(); ASAPAgent agent = atm.GetAgent(source); if (agent != null) { ICharacterSkeleton icskel = agent.GetComponent <ICharacterSkeleton>(); if (icskel != null) { transform.position = icskel.GetHeadTransform().position; } } else if (onlyActiveAgentClips) { this.audioSource.mute = true; } } }
void Start() { if (skeleton == null) { skeleton = GetComponent <ICharacterSkeleton>(); } if (face == null) { face = GetComponent <ICharacterFace>(); } }