Пример #1
0
 private void Magnify(Vector3 pos)
 {
     if (magnifyMode == MagnifyMode.OnClickSingle)
     {
         if (chargingState == ChargingState.Charged)
         {
             if (Input.GetMouseButtonDown(0))
             {
                 magnifyArea.transform.position = pos;
                 Collider[] hitColliders = Physics.OverlapBox(magnifyArea.transform.position, magnifyArea.transform.localScale / 2, Quaternion.identity, m_LayerMask);
                 foreach (var coll in hitColliders)
                 {
                     //Debug.Log("Hit : " + coll.name);
                     SubjectManager subject = coll.gameObject.GetComponent <SubjectManager>();
                     subject.RevealSubjectStatus();
                     subject.IsolateInfectedSubject();
                     break;
                 }
                 onMagnifyUsed.Invoke(pos);
                 currentCharge = 0.0f;
                 chargingState = ChargingState.Charging;
             }
         }
     }
     else if (magnifyMode == MagnifyMode.OnClickMultiple)
     {
         if (chargingState == ChargingState.Charged)
         {
             if (Input.GetMouseButtonDown(0))
             {
                 magnifyArea.transform.position = pos;
                 Collider[] hitColliders = Physics.OverlapBox(magnifyArea.transform.position, magnifyArea.transform.localScale / 2, Quaternion.identity, m_LayerMask);
                 foreach (var coll in hitColliders)
                 {
                     //Debug.Log("Hit : " + coll.name);
                     SubjectManager subject = coll.gameObject.GetComponent <SubjectManager>();
                     subject.RevealSubjectStatus();
                     subject.IsolateInfectedSubject();
                 }
                 onMagnifyUsed.Invoke(pos);
                 currentCharge = 0.0f;
                 chargingState = ChargingState.Charging;
             }
         }
     }
     else if (magnifyMode == MagnifyMode.OnHover || magnifyMode == MagnifyMode.OnHoverDemo)
     {
         bool isolateSubject = false;
         if (chargingState == ChargingState.Charged)
         {
             if (Input.GetMouseButtonDown(0) || magnifyMode == MagnifyMode.OnHoverDemo)
             {
                 isolateSubject = true;
                 onMagnifyUsed.Invoke(pos);
                 currentCharge = 0.0f;
                 chargingState = ChargingState.Charging;
             }
         }
         magnifyArea.transform.position = pos;
         Collider[] hitColliders = Physics.OverlapBox(magnifyArea.transform.position, magnifyArea.transform.localScale / 2, Quaternion.identity, m_LayerMask);
         foreach (var coll in hitColliders)
         {
             SubjectManager subject = coll.gameObject.GetComponent <SubjectManager>();
             subject.RevealSubjectStatus();
             if (isolateSubject && subject.GetSubjectStatus() == SubjectStatus.Infected)
             {
                 if (magnifyMode == MagnifyMode.OnHoverDemo)
                 {
                     clickFlash.ClickIt();
                     mouseclickFlash.ClickIt();
                 }
                 subject.IsolateInfectedSubject();
             }
         }
     }
 }