示例#1
0
 public void ClearHintEntityByObj(SceneItemEntity entity)
 {
     if (this.m_hintSceneItemEntity != null && this.m_hintSceneItemEntity.EntityObject != null && this.m_hintSceneItemEntity == entity)
     {
         this.m_hintSceneItemEntity.EntityObject.RecoverEntityMat();
     }
 }
示例#2
0
        /// <summary>
        /// 识别到物体
        /// </summary>
        /// <param name="gameObject"></param>
        private void OnPickedSceneObject(GameObject gameObject)
        {
            string          entityId        = gameObject.transform.root.name;
            SceneItemEntity sceneItemEntity = EntityManager.Instance.GetEntityByEntityId <SceneItemEntity>(entityId);

            OnPickedSceneItemEntity(sceneItemEntity, false);
        }
示例#3
0
        private void OnStreamerHint(bool isHint, long exhibitID)
        {
            SceneItemEntity entity = GameEvents.MainGameEvents.GetSceneItemEntityByID(exhibitID);

            if (entity == null || entity.EntityObject == null)
            {
                return;
            }
            if (isHint)
            {
                if (m_cacheEntityShader.ContainsKey(exhibitID))
                {
                    return;
                }
                Shader entityShader = entity.EntityObject.EntityMat.shader;
                m_cacheEntityShader.Add(exhibitID, entityShader);
                Shader hintShader = ShaderModule.Instance.GetShader(GameConst.STREAMER_SHADER);
                entity.EntityObject.EntityMat.shader = hintShader;
                int m_shaderCircleID = Shader.PropertyToID("_StreamerTex");
                entity.EntityObject.EntityMat.SetTexture(m_shaderCircleID, m_HintTexture);
            }
            else
            {
                if (m_cacheEntityShader.ContainsKey(exhibitID))
                {
                    entity.EntityObject.EntityMat.shader = m_cacheEntityShader[exhibitID];
                    m_cacheEntityShader.Remove(exhibitID);
                }
            }
        }
示例#4
0
 public void SetHintSceneEntity(SceneItemEntity hintEntity, bool needHint)
 {
     this.m_needHint            = needHint;
     this.m_hintSceneItemEntity = hintEntity;
     EntityOnCanvasPosition     = CameraUtility.WorldPointInCanvasRectTransform(hintEntity.CenterPosition, LogicHandler.Canvas.gameObject);
     this.m_hintEffect.Position = EntityOnCanvasPosition;
     if (needHint)
     {
         this.m_hintSceneItemEntity.EntityObject.ChangeEntityMatToHint();
     }
 }
        public SceneItemEntityObject(SceneItemEntity owner, GameObject entityGameObject) :
            base(owner, entityGameObject)
        {
            GameObjectUtil.SetLayer(entityGameObject, LayerDefine.SceneTargetObjectLayer, true);
            Renderer sceneItemRenderer = entityGameObject.GetComponentInChildren <Renderer>(true);


            if (sceneItemRenderer != null)
            {
                m_entityCollider = sceneItemRenderer.gameObject.AddComponent <BoxCollider>();
                IsEnable         = false;
            }
        }
示例#6
0
        /// <summary>
        /// 推送下一个寻找的物件
        /// </summary>
        private void PushNextEntityItem()
        {
            if (this.m_waitingEntityQueue.Count > 0)
            {
                SceneItemEntity findingItemEntity = this.m_waitingEntityQueue.Dequeue();
                this.m_currentFindingEntityList.Add(findingItemEntity);

                GameEvents.MainGameEvents.PushFindingTaskEntities.SafeInvoke(new List <SceneItemEntity>()
                {
                    findingItemEntity
                });
            }
        }
示例#7
0
        /// <summary>
        /// 获取未找到的物体
        /// </summary>
        /// <returns></returns>
        private List <SceneItemEntity> GetNotFoundSceneItemEntities()
        {
            List <EntityBase> sceneAllTaskItemEntities = GameEvents.MainGameEvents.GetSceneTaskItemEntityList.SafeInvoke();

            List <SceneItemEntity> notFoundSceneItemList = new List <SceneItemEntity>();

            for (int i = 0; i < sceneAllTaskItemEntities.Count; ++i)
            {
                SceneItemEntity taskSceneItem = sceneAllTaskItemEntities[i] as SceneItemEntity;
                if (!this.m_foundItemEntityList.Contains(taskSceneItem))
                {
                    notFoundSceneItemList.Add(taskSceneItem);
                }
            }

            return(notFoundSceneItemList);
        }
示例#8
0
        private List <SceneItemEntity> PushSceneItemList(int num)
        {
            int findingItemNum = Mathf.Min(num, this.m_waitingEntityQueue.Count);
            List <SceneItemEntity> entityList = new List <SceneItemEntity>();

            while (findingItemNum > 0)
            {
                SceneItemEntity findingItemEntity = this.m_waitingEntityQueue.Dequeue();
                this.m_currentFindingEntityList.Add(findingItemEntity);
                entityList.Add(findingItemEntity);
                findingItemEntity.EntityObject.IsEnable = true;

                findingItemNum--;
            }

            return(entityList);
        }
示例#9
0
 /// <summary>
 /// 请求提示物件
 /// </summary>
 /// <param name="hintNum"></param>
 private void OnRequestHintSceneItemEntityList(int hintNum)
 {
     if (GuidNewNodeManager.Instance.GetNodeStatus(GuidNewNodeManager.FindItemByID) == NodeStatus.None)
     {
         //新手引导特殊处理
         string          findID = GuidNewNodeManager.Instance.GetCommonParams(GuidNewNodeManager.NeedFindID);
         SceneItemEntity entity = GetSceneItemEntityByID(long.Parse(findID));
         GameEvents.MainGameEvents.NotifyHintSceneItemEntityList.SafeInvoke(new List <SceneItemEntity>()
         {
             entity
         });
     }
     else
     {
         List <SceneItemEntity> hintEntityList = HintSceneItemEntities(hintNum);
         GameEvents.MainGameEvents.NotifyHintSceneItemEntityList.SafeInvoke(hintEntityList);
     }
 }
示例#10
0
        /// <summary>
        /// 找到物体
        /// </summary>
        /// <param name="pickedSceneItemEntity"></param>
        private void OnPickedSceneItemEntity(SceneItemEntity pickedSceneItemEntity, bool isMissile)
        {
            if (!this.m_currentFindingEntityList.Contains(pickedSceneItemEntity))
            {
                return;
            }

            if (!string.IsNullOrEmpty(pickedSceneItemEntity.CameraName))
            {
                if (!GameEvents.SceneEvents.EntityInCurrentCamera(pickedSceneItemEntity.CameraName) && !isMissile)
                {
                    return;
                }
            }


            this.m_foundItemEntityList.Add(pickedSceneItemEntity);
            this.m_currentFindingEntityList.Remove(pickedSceneItemEntity);

            //todo:设置物体被找到的效果
            //pickedSceneItemEntity.EntityObject.Visible = false;

            GameEvents.MainGameEvents.OnPickedSceneObject.SafeInvoke(pickedSceneItemEntity);
            GameEvents.MainGameEvents.OnResetFingerTips.SafeInvoke();

            //全部找到几秒后退出
            //if (CheckAllEntityFound())
            //{
            //    this.m_gameStatus = GameStatus.GAMEOVER;
            //    GameEvents.MainGameEvents.OnGameStatusChange.SafeInvoke(GameStatus.GAMEOVER);

            //    //TimeModule.Instance.SetTimeout(() =>
            //    //{
            //    GameEvents.MainGameEvents.OnGameOver.SafeInvoke(GameResult.ALL_ITEM_FOUND);
            //    //}, 3f);
            //}
        }