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 override void Initialize()
        {
            if (face != null && !face.Ready())
            {
                return;
            }
            if (skeleton != null && !skeleton.Ready())
            {
                return;
            }
            // TODO: asap needs some default joints...
            VJoint[] vJoints = new VJoint[0];
            if (skeleton != null)
            {
                vJoints = skeleton.GenerateVJoints();
            }

            IFaceTarget[] faceTargets = new IFaceTarget[0];
            if (face != null)
            {
                faceTargets = face.GetFaceTargets();
            }

            agentSpec = new AgentSpec(agentId, vJoints, faceTargets);
            ASAPToolkitManager atkm = FindObjectOfType <ASAPToolkitManager>();

            if (atkm != null)
            {
                atkm.OnAgentInitialized(this);
            }
            initialized = true;
        }
Example #3
0
        // Use this for initialization
        void Start()
        {
            if (randomNameSuffix)
            {
                transform.name = transform.name + "_" + System.Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 8);
            }
            vjoint = new VJoint(transform.name, transform.position, transform.rotation);
            ASAPToolkitManager manager = FindObjectOfType <ASAPToolkitManager>();

            if (manager != null)
            {
                manager.OnWorldObjectInitialized(vjoint);
            }
        }