Пример #1
0
        void Update()
        {
            if (ISDetecting)
            {
                Vector3 rayOrigin = fpsCam.ViewportToWorldPoint(new Vector3(0.5f, 0.5f, 0.0f));

                // 声明射线
                RaycastHit hit;



                // 检查是否碰到任何物体
                if (Physics.Raycast(rayOrigin, fpsCam.transform.forward, out hit, weaponRange))
                {
                    // Get a reference to a health script attached to the collider we hit
                    Trigger_basic item = hit.collider.GetComponent <Trigger_basic>();

                    if (isDebug)
                    {
                        Debug.DrawLine(rayOrigin, hit.point, Color.green);
                    }

                    if (item != null)
                    {
                        if (item.isShow && item.gameType == GameType.FPS)
                        {
                            //item.GetComponent<Outline>().ShowOutLine();
                            ui.ShowMessage(item._Name, item._Message, item.messagePos.transform);
                            if (item.outlineOBJ != null)
                            {
                                item.outlineOBJ.ShowOutLine();
                            }
                        }


                        CLearPrev();
                        prevTrigger = item;
                        if (item.gameType == GameType.FPS)
                        {
                            item.MakeUseful();
                        }
                    }
                    else
                    {
                        ui.HideMessage();

                        CLearPrev();
                    }
                }
                else
                {
                    ui.HideMessage();
                }
            }
            // 在屏幕中间创建一个Vecter3
        }
Пример #2
0
 public void CLearPrev()
 {
     if (prevTrigger != null)
     {
         if (prevTrigger.outlineOBJ != null)
         {
             prevTrigger.outlineOBJ.HideOutLine();
         }
         prevTrigger.MakeUseless();
         //prevTrigger.GetComponent<Outline>().HideOutLine();
         prevTrigger = null;
     }
 }