Ejemplo n.º 1
0
        public AvatarAssetController(GameObject headGameObject, GameObject bodyGameObject)
        {
            if (bodyGameObject == null)
            {
                throw new ArgumentNullException("avatarGameObject");
            }
            mAvatarGameObject = bodyGameObject;

            mRigAnimationController = new RigAnimationController(mAvatarGameObject);

            // Add skinned mesh renderer component
            Renderer mBodyRenderer = mAvatarGameObject.GetComponent(typeof(SkinnedMeshRenderer)) as SkinnedMeshRenderer;

            if (mBodyRenderer == null)
            {
                mBodyRenderer = mAvatarGameObject.AddComponent(typeof(SkinnedMeshRenderer)) as SkinnedMeshRenderer;
            }
            mBodyRenderer.material = AvatarEntity.AvatarMaterial;

            // Create the Avatar's Body LayeredPalette
            mBodyTexture = new AvatarBodyTexture(mBodyRenderer);

            // Setup the Face UvShellAnimator
            mBodyMesh = new AvatarBodyMesh(mBodyTexture, bodyGameObject.transform, (SkinnedMeshRenderer)mBodyRenderer);

            if (headGameObject == null)
            {
                throw new ArgumentNullException("headGameObject");
            }

            //headGameObject.AddComponent(typeof(MeshFilter));
            mFaceRenderer         = headGameObject.GetComponent(typeof(MeshRenderer)) as Renderer;
            mFaceRenderer.enabled = false;

            // Create the Avatar's Face LayeredPalette
            mFaceTexture = new AvatarFaceTexture(mFaceRenderer);

            // FaceMesh will setup mesh and UvShells
            mAvatarFaceMesh = new AvatarFaceMesh(mFaceTexture, headGameObject.transform);
            mFaceAnimator   = new FaceAnimator(mAvatarFaceMesh);

            mUpdateTask = GameFacade.Instance.RetrieveMediator <SchedulerMediator>().Scheduler.StartCoroutine(Update());;
        }
Ejemplo n.º 2
0
        public BodyController(GameObject bodyGameObject)
        {
            if (bodyGameObject == null)
            {
                throw new ArgumentNullException("avatarGameObject");
            }
            mAvatarGameObject = bodyGameObject;

            // Add skinned mesh renderer component
            Renderer mBodyRenderer = mAvatarGameObject.GetComponent(typeof(SkinnedMeshRenderer)) as SkinnedMeshRenderer;

            if (mBodyRenderer == null)
            {
                mBodyRenderer = mAvatarGameObject.AddComponent(typeof(SkinnedMeshRenderer)) as SkinnedMeshRenderer;
            }
            mBodyRenderer.material = AvatarEntity.AvatarMaterial;

            // Create the Avatar's Body LayeredPalette
            mBodyTexture = new AvatarBodyTexture(mBodyRenderer);

            // Setup the Face UvShellAnimator
            mBodyMesh = new AvatarBodyMesh(mBodyTexture, bodyGameObject.transform, (SkinnedMeshRenderer)mBodyRenderer);
        }