Example #1
0
 //出現在任何一台攝影影機的瞬間,包含編輯畫面
 void OnBecameVisible()
 {
     if (!OnCamera.InCamera(LookCamera, gameObject, VisionDistance))
     {
         return;
     }
     this.LookState = LookStateEnum.StartLook;
     OnChangeToStartLook();
 }
Example #2
0
    void CheckOnLook()
    {
        Renderer renderer = gameObject.GetComponent <Renderer>();

        if (renderer == null)
        {
            return;
        }

        if (!renderer.isVisible)//出現在任何一台攝影影機中,包含編輯畫面有出現也會判定為true
        {
            return;
        }

        //DebugSystem.AddLog(DebugSystem.DebugInfo.GetNewDebugInfo(
        //DebugSystem.DebugInfo.DebugLogTypeEnum.Info,
        //SystemName,
        //this.gameObject.name + "被觀看"));


        if (OnCamera.InCamera(LookCamera, gameObject, VisionDistance))
        {
            if (this.LookState == LookStateEnum.Invisible)
            {
                this.LookState = LookStateEnum.StartLook;
                OnChangeToStartLook();
            }
        }
        else
        {
            if (this.LookState == LookStateEnum.OnLook)
            {
                this.LookState = LookStateEnum.ExitLook;
                OnChangeToExitLook();
            }
        }
    }