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; } } }
public void AddDefaultTargets(UMAData umaData) { ASAPAgent agent = GetComponent <ASAPAgent>(); if (agent == null) { return; } Transform head = umaData.GetBoneGameObject("Head").transform; Transform headcenter = head.Find("head_" + agent.agentId); if (headcenter == null) { headcenter = new GameObject("head_" + agent.agentId).transform; headcenter.parent = head; headcenter.localPosition = new Vector3(-0.115f, 0.0f, 0.0f); headcenter.localRotation = Quaternion.identity; headcenter.gameObject.AddComponent <Environment.WorldObject>(); } }