EnemyTargeting.Salve C# (CSharp) Method

Salve() public method

public Salve ( ) : void
return void
    void Salve()
    {
        if(lastTimeSalve > Time.realtimeSinceStartup - 5.0f)
        {
            //Ajouter Ce sort n'est pas encore disponible
            SfText =  Instantiate(Resources.Load("Prefab/SfUse"),new Vector3(0.4f,0.20f,0f), Quaternion.identity) as GameObject;
            SfText.guiText.color = Color.red;
            SfText.guiText.text = "Ce sort n'est pas encore disponible";
            return;
        }

        if(!barreAction.useVap(2))
            return;

        lastTimeSalve=Time.realtimeSinceStartup;

        Debug.Log("Attack Salve de couteaux"); // Il faut une classe Enemi avec la vitalité pour faire ça durant 6 secondes

        Plane playerPlane = new Plane(Vector3.up, transform.position);
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        float hitdist = 0.0f;
        Vector3 destinationPosition;

        if (playerPlane.Raycast(ray, out hitdist)) {
            Vector3 targetPoint = ray.GetPoint(hitdist);
            destinationPosition = ray.GetPoint(hitdist);
            Quaternion targetRotation = Quaternion.LookRotation(targetPoint - transform.position);
            transform.rotation = targetRotation;
        }

        Instantiate(Resources.Load<GameObject>("Prefab/Salve"), transform.position, transform.rotation);
        audio.PlayOneShot(SalveSound);

        ennemysSalve.Clear();

        foreach (GameObject enemy in GameObject.FindGameObjectsWithTag("Enemy")){

            if(Vector3.Distance(transform.position, enemy.transform.position) < 8.0f){
                if(Vector3.Angle(transform.position, enemy.transform.position) < 60 ){ // Si dans un cone 120 °
                        Debug.Log("Ok");
                        if(enemy.GetComponent<EnnemyAI>()){
                            enemy.GetComponent<EnnemyAI>().UpdateVitality(-(int)((120 * PlayerCaract.GetForce())/100));
                            ennemysSalve.Add(enemy.GetComponent<EnnemyAI>());
                        }
                    }
            }
        }

        Invoke("SalveHit", 1);
        Invoke("SalveHit", 2);
        Invoke("SalveHit", 3);
        Invoke("SalveHit", 4);
        Invoke("SalveHit", 5);
    }