void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag("Switch") && lightReady)
        {
            count = count + 1;
            SetCountText();
            cCollider = other.GetComponentInParent <CapsuleCollider>();
            lampLight = other.gameObject.GetComponentInChildren <Light>();
            Material bulb = other.GetComponentInChildren <Renderer>().material;
            //Behaviour halo =(Behaviour)other.GetComponent ("Halo");

            Debug.Log(bulb.name);
            if (bulb == null)
            {
                Debug.Log("HHH");
            }
            if (lampLight.intensity > 0)
            {
                lampLight.intensity = 0;
                cCollider.enabled   = false;
                audioSource.clip    = offSoundEffect;
                audioSource.Play();
                tScript.setTarget(other.transform.parent.transform, lampLight.intensity);

                bulb.DisableKeyword("_EMISSION");

                addResource(20);

                //halo.enabled = false;
            }
            else
            {
                //setLightColor(lampLight, equippedLight);
                if (lightResource >= 20)
                {
                    setChildLight(other.GetComponentsInChildren <Light>());

                    lampLight.intensity = 3;
                    cCollider.enabled   = true;
                    audioSource.clip    = onSoundEffect;
                    audioSource.Play();
                    tScript.setTarget(other.transform.parent.transform, lampLight.intensity);
                    bulb.EnableKeyword("_EMISSION");
                    setMaterialColor(bulb, equippedLight);

                    // halo.enabled = true;

                    addResource(-20);
                }
                //halo.enabled = true;
            }
        }
    }
    /*
     * void OnTriggerEnter(Collider other)
     * {
     *  if (other.gameObject.CompareTag("LampLight")  && lightReady)
     *  {
     *      count = count + 1;
     *      SetCountText();
     *      cCollider = other.GetComponentInParent<CapsuleCollider>();
     *      lampLight = other.gameObject.GetComponentInChildren<Light>();
     *      Material bulb = other.GetComponentInChildren<Renderer>().material;
     *      //Behaviour halo =(Behaviour)other.GetComponent ("Halo");
     *
     *      //.Log(bulb.name);
     *      if (bulb == null)
     *          Debug.Log("HHH");
     *      if (lampLight.intensity > 0)
     *      {
     *          lampLight.intensity = 0;
     *          cCollider.enabled = false;
     *          audioSource.clip = offSoundEffect;
     *          audioSource.Play();
     *          tScript.setTarget(other.transform.parent.transform, lampLight.intensity);
     *
     *          bulb.DisableKeyword("_EMISSION");
     *         // Debug.Log("adding back scost");
     *          //addResource(tempLightCost);
     *
     *          //halo.enabled = false;
     *
     *      }
     *      else{
     *          //setLightColor(lampLight, equippedLight);
     *          if (lightResource >=tempLightCost){
     *
     *          setChildLight(other.GetComponentsInChildren<Light>());
     *
     *          lampLight.intensity = 3;
     *          cCollider.enabled = true;
     *          audioSource.clip = onSoundEffect;
     *          audioSource.Play();
     *          tScript.setTarget(other.transform.parent.transform, lampLight.intensity);
     *          bulb.EnableKeyword("_EMISSION");
     *          setMaterialColor(bulb, equippedLight);
     *
     *          // halo.enabled = true;
     *
     *          //addResource(-tempLightCost);
     *          subtractResource();
     *          }
     *          //halo.enabled = true;
     *      }
     *  }
     *
     *
     * }
     *
     */

    public void setTargetLight(GameObject lightSource)
    {
        //Debug.Log("called set light");
        if (lightSource.CompareTag("LampLight"))
        {
            // Debug.Log(lightSource.transform.position);
            count = count + 1;
            SetCountText();
            // cCollider = lightSource.GetComponentInParent<CapsuleCollider>();
            lampLight = lightSource.gameObject.GetComponentInChildren <Light>();
            Material bulb = lightSource.GetComponentInChildren <Renderer>().material;
            //Behaviour halo =(Behaviour)other.GetComponent ("Halo");

            //.Log(bulb.name);
            if (bulb == null)
            {
                Debug.Log("HHH");
            }
            if (lampLight.intensity > 0)
            {
                lampLight.intensity = 0;
                //   cCollider.enabled = false;
                audioSource.clip = offSoundEffect;
                audioSource.Play();

                if (equippedLight == 1 || equippedLight == 2)
                {
                    tScript.setTarget(lightSource.transform, lampLight.intensity);
                }

                bulb.DisableKeyword("_EMISSION");
                //addResource(tempLightCost);

                //halo.enabled = false;
                lightSourceController lController = lightSource.GetComponentInParent <lightSourceController>();
                if (lController != null)
                {
                    lController.setCurrentLightType(0);
                }
            }
            else
            {
                //setLightColor(lampLight, equippedLight);
                if (lightResource >= tempLightCost)
                {
                    setChildLight(lightSource.GetComponentsInChildren <Light>());
                    lampLight.intensity = lightValueOn;
                    // cCollider.enabled = true;
                    audioSource.clip = onSoundEffect;
                    audioSource.Play();
                    if (equippedLight == 1 || equippedLight == 2)
                    {
                        tScript.setTarget(lightSource.transform, lampLight.intensity);
                    }
                    bulb.EnableKeyword("_EMISSION");
                    setMaterialColor(bulb, equippedLight);

                    // halo.enabled = true;

                    //addResource(-tempLightCost);
                    subtractResource();
                    lightSourceController lController = lightSource.GetComponentInParent <lightSourceController>();
                    if (lController != null)
                    {
                        lController.setCurrentLightType(equippedLight);
                    }
                }
                //halo.enabled = true;
            }
        }
    }