public void Scan() //first time scan and refresh from drone
 {
     if (!isScanned)
     {
         isScanned = true;
         MaskScan.SetActive(true);
         if (ScanAble)
         {
             if (IsHereEnemy())
             {
                 MaskScan.GetComponent <MeshRenderer>().material = ScanEnemy;
             }
             else
             {
                 MaskScan.GetComponent <MeshRenderer>().material = ScanSafe;
             }
         }
         else
         {
             MaskScan.GetComponent <MeshRenderer>().material = ScanUknown;
         }
         timeToRefresh = 1;
     }
     timeToDataLost = 2;
 }
    private void HandleScan()                 //stable scan
    {
        if (isScanned)                        //if there is scan in progress
        {
            timeToDataLost -= Time.deltaTime; //check IF scan IS in progress
            if (timeToDataLost < 0)           //hide scan mask when done
            {
                MaskScan.SetActive(false);
                isScanned = false;
            }

            //handle refresh IF needed
            if (ScanAble) //is scan able -> result other than yellow
            {
                if (timeToRefresh < 0)
                {
                    timeToRefresh -= Time.deltaTime;
                    timeToRefresh  = 1;
                    if (IsHereEnemy())
                    {
                        MaskScan.GetComponent <MeshRenderer>().material = ScanEnemy;
                    }
                    else
                    {
                        MaskScan.GetComponent <MeshRenderer>().material = ScanSafe;
                    }
                }
            }
        }
    }