コード例 #1
0
    public bool CanMoveByInk(ref RaycastHit rayHitInfo)
    {
        if (rayHitInfo.transform == null)
        {
            return(false);
        }
        if (rayHitInfo.transform.gameObject.layer != _layerNum)
        {
            return(false);
        }
        //if (CurGroundObj == null || CurGroundObj.name != rayHitInfo.transform.name)
        //{
        //    CurGroundObj = rayHitInfo.transform;
        SplatManager renderObj = rayHitInfo.transform.GetComponent <SplatManager>();

        if (renderObj == null)
        {
            Debug.Log("SplatManager_name_name_name:::" + rayHitInfo.transform.name);
            return(false);
        }

        if (PixelManager.GetInstance() == null)
        {
            Debug.Log("renderObj.ObjectId_PixelManager.GetInstance() is null!!!:::" + renderObj.ObjectId);
            return(false);
        }

        //先判断是否已经有玩家对象和渲染对象了,根据情况添加玩家对象和渲染对象
        if (!PixelManager.GetInstance().ObjectIDToTexture2D.ContainsKey(renderObj.ObjectId))
        {
            Texture2D obj = RenderTexturePool.GetInstance().InstanceTexture2D();
            renderObj.SetRenderTexture2D(ref obj);
            PixelManager.GetInstance().SetObjectIDToTexture2D(renderObj.ObjectId, obj);
            renderObj.RenderTextureToStaticData();
            Debug.Log("PlayerIDToObjectID.GetInstance():::" + PixelManager.GetInstance().PlayerIDToObjectID.Count + " ," + PixelManager.GetInstance().PlayerIDToObjectID.Keys);
        }
        return(PixelManager.GetInstance().IsInOneSelfInk(AvatarEntityId, renderObj.ObjectId, rayHitInfo.textureCoord));
        //  bool data = PixelManager.GetInstance().GetPixelsInfo(PlayerId, _groundHit.textureCoord);
        //   }
    }
コード例 #2
0
    public bool OnGrouldRayInfoAndRender(out RaycastHit _groundHit)
    {
        if (!RayGroundInfo(out _groundHit))
        {
            return(false);
        }

        if (_groundHit.transform.gameObject.layer != _layerNum)
        {
            return(false);
        }
        if (CurGroundObj == null || CurGroundObj.name != _groundHit.transform.name)
        {
            CurGroundObj = _groundHit.transform;
            SplatManager renderObj = _groundHit.transform.GetComponent <SplatManager>();
            if (renderObj == null)
            {
                Debug.Log("SplatManager_name_name_name:::" + _groundHit.transform.name);
                return(false);
            }

            if (PixelManager.GetInstance() == null)
            {
                Debug.Log("renderObj.ObjectId_PixelManager.GetInstance() is null!!!:::" + renderObj.ObjectId);
                return(false);
            }

            //先判断是否已经有玩家对象和渲染对象了,根据情况添加玩家对象和渲染对象
            if (!PixelManager.GetInstance().SetPlayerIdToObjectID(AvatarEntityId, renderObj.ObjectId))
            {
                Texture2D obj = RenderTexturePool.GetInstance().InstanceTexture2D();
                renderObj.SetRenderTexture2D(ref obj);
                PixelManager.GetInstance().SetObjectIDToTexture2D(renderObj.ObjectId, obj);
                Debug.Log("PlayerIDToObjectID.GetInstance():::" + PixelManager.GetInstance().PlayerIDToObjectID.Count + " ," + PixelManager.GetInstance().PlayerIDToObjectID.Keys);
            }
            //  bool data = PixelManager.GetInstance().GetPixelsInfo(PlayerId, _groundHit.textureCoord);
        }
        return(true);
    }