Example #1
0
    /// <summary>
    /// 获取状态条在世界坐标的位置
    /// </summary>
    /// <param name="uid"></param>
    /// <param name="strLocatorName"></param>
    /// <param name="offsetY"></param>
    /// <returns></returns>
    public Vector3 GetNodeWorldPos(long uid, string strLocatorName, float offsetY = 1)
    {
        Vector3 pos    = Vector3.zero;
        IEntity entity = GetEntity(uid);

        if (entity == null)
        {
            Engine.Utility.Log.Error("GetNodeWorldPos : entity is null");
            return(pos);
        }

        Engine.Node node = entity.GetNode();
        if (node == null)
        {
            //Engine.Utility.Log.Error("GetNodeWorldPos : entity node is null");
            return(pos);
        }

        Transform trans = node.GetTransForm();

        if (trans == null)
        {
            Engine.Utility.Log.Error("GetNodeWorldPos : entity transform is null");
            return(pos);
        }

        entity.GetLocatorPos(strLocatorName, Vector3.zero, Quaternion.identity, ref pos, true);

        pos.y += offsetY * trans.lossyScale.y;
        return(pos);
    }
Example #2
0
    /// <summary>
    /// 播放鱼竿动画
    /// </summary>
    /// <param name="uid"></param>
    /// <param name="aniName"></param>
    void PlayFishingRodAni(uint uid, string aniName)
    {
        Dictionary <uint, Engine.IRenderObj> playerFishingDic = DataManager.Manager <SuitDataManager>().PlayerFishingDic;

        Engine.IRenderObj yuganObj;
        if (playerFishingDic.TryGetValue(uid, out yuganObj))
        {
            Engine.Node node = yuganObj.GetNode();
            if (node == null)
            {
                return;
            }

            Transform transf = node.GetTransForm();
            if (transf == null)
            {
                return;
            }

            Animation[] anis = transf.gameObject.GetComponentsInChildren <Animation>();

            if (anis.Length > 0)
            {
                Animation animation = anis[0];
                animation.Play(aniName);
            }
        }
    }
Example #3
0
 public Transform GetTransForm()
 {
     Engine.Node node = GetNode();
     if (node == null)
     {
         return(null);
     }
     return(node.GetTransForm());
 }
Example #4
0
 private void UpdateEffectWidget()
 {
     if (null != m_effect)
     {
         Engine.Node node = m_effect.GetNode();
         if (node != null)
         {
             Transform trans = node.GetTransForm();
             if (trans != null)
             {
                 trans.parent = cachedTransform;
                 node.SetLocalPosition(Vector3.zero);
                 trans.localScale = Vector3.one;
                 trans.SetChildLayer(LayerMask.NameToLayer("UI"));
             }
         }
     }
 }
Example #5
0
    /// <summary>
    /// 关闭画鱼线
    /// </summary>
    /// <param name="uid"></param>
    void CloseFishingLine(uint uid)
    {
        Dictionary <uint, Engine.IRenderObj> playerFishingDic = DataManager.Manager <SuitDataManager>().PlayerFishingDic;

        Engine.IRenderObj yuganObj;
        if (playerFishingDic.TryGetValue(uid, out yuganObj))
        {
            Engine.Node node = yuganObj.GetNode();
            if (node != null)
            {
                Transform transf = node.GetTransForm();
                if (transf != null)
                {
                    LineRenderer[] lrs = transf.gameObject.GetComponentsInChildren <LineRenderer>();

                    if (lrs.Length > 0)
                    {
                        LineRenderer lr = lrs[0];
                        lr.enabled = false;
                    }
                }
            }
        }
    }
Example #6
0
    /// <summary>
    /// 画鱼线
    /// </summary>
    /// <param name="uid"></param>
    /// <returns></returns>
    IEnumerator DrawFishingLine(uint uid)
    {
        yield return(new WaitForSeconds(0.9f));

        Dictionary <uint, Engine.IRenderObj> playerFishingDic = DataManager.Manager <SuitDataManager>().PlayerFishingDic;

        Engine.IRenderObj yuganObj;
        if (playerFishingDic.TryGetValue(uid, out yuganObj))
        {
            Engine.Node node = yuganObj.GetNode();
            if (node != null)
            {
                Transform transf = node.GetTransForm();
                if (transf != null)
                {
                    LineRenderer[] lrs = transf.gameObject.GetComponentsInChildren <LineRenderer>();

                    if (lrs.Length > 0)
                    {
                        LineRenderer lr = lrs[0];
                        lr.enabled = true;

                        Vector3 startPos = lr.gameObject.transform.position;
                        Vector3 endPos   = new Vector3(startPos.x, startPos.y - 8, startPos.z);

                        lr.SetPosition(0, startPos);
                        lr.SetPosition(1, endPos);
                    }
                    else
                    {
                        Engine.Utility.Log.Error("没有鱼竿顶点 ,鱼线会出错!!! 找罗宇辉");
                    }
                }
            }
        }
    }