コード例 #1
0
 private void Update()
 {
     if (Debugging)
     {
         if (Visuals)
         {
             if (!Spoted())
             {
                 lineOfSightVisual.DrawFieldOfView();
                 CurrFov   = Fov;
                 CurrRange = range;
             }
             else if (Spoted())
             {
                 lineOfSightVisual.viewMesh.Clear();
                 CurrRange = 10;
                 CurrFov   = 110;
             }
         }
         else
         {
             if (!Spoted())
             {
                 CurrFov   = Fov;
                 CurrRange = range;
             }
             else if (Spoted())
             {
                 CurrRange = 10;
                 CurrFov   = 110;
             }
         }
     }
 }
コード例 #2
0
 // Update is called once per frame
 void LateUpdate()
 {
     if (!lineofsight.Spoted())
     {
         lineOfSightVisual.DrawFieldOfView();
         lineofsight.CurrFov   = lineofsight.Fov;
         lineofsight.CurrRange = lineofsight.range;
         LookPatrol();
         shooting1.endShooting();
     }
     else if (lineofsight.Spoted())
     {
         lineOfSightVisual.viewMesh.Clear();
         lineofsight.CurrRange = AlertedViewRange;
         lineofsight.CurrFov   = 110;
         shooting1.startShooting();
         shooting1.Point();
     }
 }
コード例 #3
0
    void Update()
    {
        if (!lineofsight.Spoted() && !onAlert)
        {
            lineOfSightVisual.DrawFieldOfView();
            lineofsight.CurrFov   = lineofsight.Fov;
            lineofsight.CurrRange = lineofsight.range;
            shooting1.endShooting();
            Patrol();
        }
        else if (lineofsight.Spoted() || onAlert)
        {
            MovRight = playerTrans.position.x > transform.position.x;
            lineOfSightVisual.viewMesh.Clear();
            lineOfSightVisual.viewMesh.Clear();
            lineofsight.CurrRange = AlertViewRange;
            lineofsight.CurrFov   = 110;
            shooting1.startShooting();
            shooting1.Point();
            chaseAI.Follow();
        }

        DetectWall();
    }