コード例 #1
0
 public void OnBlock45ColCreated(Block45ChunkGo b45Go)
 {
     if (OnColliderCreated != null)
     {
         OnColliderCreated(b45Go);
     }
 }
コード例 #2
0
    public void AttachChunkGo(Block45ChunkGo b45Go)
    {
        Block45ChunkGo oldGo = _goChunk;

        _goChunk = null;
        if (b45Go != null)
        {
            float fScale = (1 << _pos.w) * Block45Constants._scale;
            _goChunk      = b45Go;
            _goChunk.name = "b45Chnk_" + _pos.x + "_" + _pos.y + "_" + _pos.z + "_" + _pos.w;
            _goChunk.transform.localScale    = new Vector3(fScale, fScale, fScale);
            _goChunk.transform.localPosition = _pos.ToVector3();
            _goChunk._data = this;
            if (oldGo != null && oldGo._mc != null && oldGo._mc.sharedMesh != null)
            {
                _goChunk.OnSetCollider();
                //_goChunk._mc.sharedMesh = _goChunk._mf.sharedMesh;
            }
        }
        if (oldGo != null)
        {
            VFGoPool <Block45ChunkGo> .FreeGo(oldGo);

            oldGo = null;
        }
        if (_nData != null)
        {
            _nData.EndUpdateOctNode(this);
        }
    }
コード例 #3
0
 public void OnBlock45ColDestroy(Block45ChunkGo b45Go)
 {
     if (OnColliderDestroy != null)
     {
         OnColliderDestroy(b45Go);
     }
 }
コード例 #4
0
    public static Block45ChunkGo CreateChunkGo(IVxSurfExtractReq req, Transform parent = null)
    {
        if (req.FillMesh(null) == 0)
        {
            return(null);
        }

        Block45ChunkGo b45Go = VFGoPool <Block45ChunkGo> .GetGo();

        req.FillMesh(b45Go._mf.mesh);

        // set material
        SurfExtractReqB45 b45ret = req as SurfExtractReqB45;

        if (b45ret != null)
        {
            List <Material> tmpMatList = new List <Material>();
            for (int i = 0; i < b45ret.matCnt; i++)
            {
                tmpMatList.Add(_defMats[b45ret.materialMap[i]]);
            }
            b45Go._mr.sharedMaterials = tmpMatList.ToArray();
        }
        if (parent != null)
        {
            b45Go.transform.parent = parent;
        }
        b45Go.gameObject.SetActive(true);
        return(b45Go);
    }
コード例 #5
0
    public void ChunkProcPostGenMesh(IVxSurfExtractReq ireq)
    {
        SurfExtractReqB45 req   = ireq as SurfExtractReqB45;
        Block45ChunkGo    b45Go = Block45ChunkGo.CreateChunkGo(req);

        req._chunkData.AttachChunkGo(b45Go);
    }
コード例 #6
0
    //void OnMainPlayerComplete(Player player)
    //{
    //    //PlayerFactory.mMainPlayer.OnCaveEnterEvent += OnMainPlayerCaveEnter;
    //    //PlayerFactory.mMainPlayer.OnCaveExitEvent  += OnMainPlayerCaveExit;
    //}

    void OnBlock45BuildingColliderRebuild(Block45ChunkGo vfGo)
    {
        if (vfGo != null && vfGo._mc != null)
        {
            b45Bound.Add(vfGo._mc.bounds);
        }
    }
コード例 #7
0
    void ChunkProcPostGenMesh(IVxSurfExtractReq ireq)
    {
        if (this == null)
        {
            return;
        }
        SurfExtractReqB45 req   = ireq as SurfExtractReqB45;
        Block45ChunkGo    b45Go = Block45ChunkGo.CreateChunkGo(req, transform);

        req._chunkData.AttachChunkGo(b45Go);
    }
コード例 #8
0
 void OnBlock45ColliderBuild(Block45ChunkGo vfGo)
 {
     if (vfGo != null && vfGo._mc != null)
     {
         if (_b45Bound.size != Vector3.zero)
         {
             _b45Bound.Encapsulate(vfGo._mc.bounds);
         }
         else
         {
             _b45Bound = vfGo._mc.bounds;
         }
     }
 }
コード例 #9
0
 public void DestroyChunkGo()
 {
     if (null != (System.Object)_goChunk)            // In thread, Monobehaviour's compare can not be used
     {
         if (_nData == null)
         {
             VFGoPool <Block45ChunkGo> .FreeGo(_goChunk);                                            // for those cases not in thread
         }
         else
         {
             VFGoPool <Block45ChunkGo> .ReqFreeGo(_goChunk);                                         // for those cases in thread use lock
         }
         _goChunk = null;
     }
 }
コード例 #10
0
    public Block45OctNode PickNodeToSetCol()
    {
        if (!IsIdle)
        {
            return(null);
        }
        if (_lstBlock45Datas == null)
        {
            return(null);
        }

        int n = _lstBlock45Datas.Count;

        for (int i = 0; i < n; i++)
        {
            Block45ChunkGo chunkGo = _lstBlock45Datas[i].ChunkGo;
            if (null != (System.Object)chunkGo && null == (System.Object)chunkGo._mc.sharedMesh)
            {
                return(_lstBlock45Datas[i]);
            }
        }
        return(null);
    }
コード例 #11
0
    public bool IsAllOctNodeReady()
    {
        if (!IsIdle)
        {
            return(false);
        }
        if (_lstBlock45Datas == null)
        {
            return(true);
        }

        int n = _lstBlock45Datas.Count;

        for (int i = 0; i < n; i++)
        {
            Block45ChunkGo chunkGo = _lstBlock45Datas[i].ChunkGo;
            if (null != (System.Object)chunkGo && null == (System.Object)chunkGo._mc.sharedMesh)
            {
                return(false);
            }
        }
        return(true);
    }