public void shoot(GameObject targetGameObject)
 {
     target_ = targetGameObject;
     if (target_.GetComponent <mirrorTower>() != null)
     {
         CurrentState = teslaState.shootMirror;
     }
     else
     {
         CurrentState = teslaState.shoot;
     }
 }
    // Update is called once per frame
    void Update()
    {
        switch (CurrentState)
        {
        case teslaState.idle:
            break;

        case teslaState.finishShooting:
            lineRenderer.enabled = false;
            target_      = null;
            CurrentState = teslaState.idle;
            break;

        case teslaState.shoot:
            if (target_ == null)
            {
                CurrentState = teslaState.idle;
                return;
            }
            if (Time.time > nextTimeFire)
            {
                /*****************************************************/
                //need rethink
                if (shooting)
                {
                    tesla();
                }
                else
                {
                    lineRenderer.enabled = false;
                }
                nextTimeFire = Time.time + gameObject.GetComponent <towerInf>().fireRate;
                shooting     = !shooting;
            }
            break;

        case teslaState.shootMirror:
            if (target_ == null)
            {
                CurrentState = teslaState.idle;
                return;
            }
            if (Time.time > nextTimeFire)
            {
                /*****************************************************/
                //need rethink
                if (shooting)
                {
                    tesla();
                    GetComponent <target>().takeDamage(GetComponent <towerInf>().damage);
                }
                else
                {
                    lineRenderer.enabled = false;
                }
                nextTimeFire = Time.time + (1 / gameObject.GetComponent <towerInf>().fireRate);
                shooting     = !shooting;
            }
            break;
        }
    }
 public void StopShoot()
 {
     CurrentState = teslaState.finishShooting;
 }