Exemplo n.º 1
0
 void GetGlobalTreeInfoForGather()
 {
     if (null != LSubTerrainMgr.Instance)
     {
         mGlobalTreeInfos = LSubTerrainMgr.Picking(position, transform.forward, false, m_Data.GatherRadius, 360f);
     }
     else if (null != RSubTerrainMgr.Instance)
     {
         mGlobalTreeInfos = RSubTerrainMgr.Picking(position, transform.forward, false, m_Data.GatherRadius, 360f);
     }
 }
Exemplo n.º 2
0
        bool CanCather(float radius = 2.0f, float angle = 360.0f)
        {
            List <GlobalTreeInfo> grassInfoList = new List <GlobalTreeInfo>();

            if (null != LSubTerrainMgr.Instance)
            {
                grassInfoList = LSubTerrainMgr.Picking(position, transform.forward, false, radius, angle);
            }
            else if (null != RSubTerrainMgr.Instance)
            {
                grassInfoList = RSubTerrainMgr.Picking(position, transform.forward, false, radius, angle);
            }

            return(grassInfoList.Count > 0);
        }
Exemplo n.º 3
0
        public bool UpdateOPTreeInfo()
        {
            mFindTreeInfo = null;
            if (null == trans)
            {
                return(false);
            }
            if (Vector3.Distance(trans.position, trans.position) > GatherMaxDis)
            {
                return(false);
            }
            List <GlobalTreeInfo> grassInfoList;

            if (null != LSubTerrainMgr.Instance)
            {
                grassInfoList = LSubTerrainMgr.Picking(trans.position, Vector3.forward, false, GatherMaxDis, 360f);
            }
            else if (null != RSubTerrainMgr.Instance)
            {
                grassInfoList = RSubTerrainMgr.Picking(trans.position, Vector3.forward, false, GatherMaxDis, 360f);
            }
            else
            {
                return(false);
            }

            for (int i = 0; i < grassInfoList.Count; i++)
            {
                NaturalRes resFind = NaturalResAsset.NaturalRes.GetTerrainResData(grassInfoList[i]._treeInfo.m_protoTypeIdx + 1000);
                if (null != resFind)
                {
                    if (resFind.m_type == 10)
                    {
                        if (!PeCamera.cursorLocked)
                        {
                            if (null != LSubTerrainMgr.Instance)
                            {
                                Vector3 pos = grassInfoList[i].WorldPos;

                                Bounds bound = new Bounds();
                                bound.SetMinMax(pos + grassInfoList[i]._treeInfo.m_heightScale * LSubTerrainMgr.Instance.GlobalPrototypeBounds[grassInfoList[i]._treeInfo.m_protoTypeIdx].min,
                                                pos + grassInfoList[i]._treeInfo.m_heightScale * LSubTerrainMgr.Instance.GlobalPrototypeBounds[grassInfoList[i]._treeInfo.m_protoTypeIdx].max);
                                if (!bound.IntersectRay(PeCamera.mouseRay))
                                {
                                    continue;
                                }
                            }
                            else if (null != RSubTerrainMgr.Instance)
                            {
                                Vector3 pos   = grassInfoList[i]._treeInfo.m_pos;
                                Bounds  bound = new Bounds();
                                bound.SetMinMax(pos + grassInfoList[i]._treeInfo.m_heightScale * RSubTerrainMgr.Instance.GlobalPrototypeBounds[grassInfoList[i]._treeInfo.m_protoTypeIdx].min,
                                                pos + grassInfoList[i]._treeInfo.m_heightScale * RSubTerrainMgr.Instance.GlobalPrototypeBounds[grassInfoList[i]._treeInfo.m_protoTypeIdx].max);
                                if (!bound.IntersectRay(PeCamera.mouseRay))
                                {
                                    continue;
                                }
                            }
                        }

                        mFindTreeInfo = grassInfoList[i];
                        break;
                    }
                }
            }

            return(null != mFindTreeInfo);
        }