示例#1
0
 public void UF_OnAwake(AvatarController entity)
 {
     m_Avatar = entity;
     if (entity == null)
     {
         Debugger.UF_Error("AvatarRender need AvatarController Component Instance");
         return;
     }
     m_ListMats.Clear();
     Renderer[] renders = entity.GetComponentsInChildren <Renderer> ();
     foreach (Renderer render in renders)
     {
         ////忽略粒子效果
         //if (render is ParticleSystemRenderer)
         //    continue;
         if (render is SkinnedMeshRenderer)
         {
             if (m_BodySkinnedMesh == null)
             {
                 m_BodySkinnedMesh = render as SkinnedMeshRenderer;
             }
         }
         if (render is SkinnedMeshRenderer || render is MeshRenderer)
         {
             Material[] materials = render.materials;
             for (int k = 0; k < materials.Length; k++)
             {
                 if (materials[k] != null)
                 {
                     var rdata = new ReMaterialData();
                     rdata.reQueue  = materials[k].renderQueue;
                     rdata.reColor  = materials[k].color;
                     rdata.reShader = materials[k].shader;
                     m_ListMats.Add(materials[k], rdata);
                 }
             }
         }
     }
 }
示例#2
0
        //导航角色到
        public bool UF_NavigateAvatarTo(AvatarController avatar, SceneMap map, Vector3 tarPosition, float minDistance, DelegateVoid callback = null)
        {
            bool    ret      = false;
            Vector2 sorPoint = map.UF_GetGridPoint(avatar.position);
            Vector2 tarPoint = map.UF_GetGridPoint(tarPosition);

            float curdiatance = Vector3.Distance(avatar.position, tarPosition);

            if (curdiatance <= minDistance)
            {
                avatar.motion.UF_ClearPathPoint(true);
                return(ret);
            }

            var listGridPosition = ListCache <Vector3> .Acquire();

            UF_FindingPath(map, listGridPosition, (int)sorPoint.x, (int)sorPoint.y, (int)tarPoint.x, (int)tarPoint.y);
            if (listGridPosition.Count > 1)
            {
                //替换起始点为当前点
                listGridPosition[0] = avatar.position;
                //移除起始点
                //listGridPosition.RemoveAt(0);

                //替换尾部点为目标点
                listGridPosition[listGridPosition.Count - 1] = tarPosition;

                //驱动Avatar
                avatar.motion.UF_ClearPathPoint(true);
                avatar.motion.UF_AddPathPoints(listGridPosition, callback);
                ret = true;
            }
            ListCache <Vector3> .Release(listGridPosition);

            return(ret);
        }
示例#3
0
 /// <summary>
 /// Release this instance.
 /// set ref null
 /// </summary>
 public void Release()
 {
     m_Avatar       = null;
     m_FollowTarget = null;
 }
示例#4
0
 public void UF_OnAwake(AvatarController contoller)
 {
     isActive = true;
     m_Avatar = contoller;
     m_Avatar.transModel.eulerAngles = new Vector3(m_Avatar.transModel.eulerAngles.x, m_TurnAngle, m_Avatar.transModel.eulerAngles.z);
 }
示例#5
0
 public void UF_OnAwake(AvatarController avatar)
 {
     m_Avatar   = avatar;
     m_Animator = avatar.GetComponentInChildren <Animator> ();
     this.UF_MapAnimatorClip();
 }
示例#6
0
 public void UF_OnAwake(AvatarController avatar)
 {
     m_Avatar = avatar;
 }