public void setTargetLight(GameObject lightSource)
    {
        //Debug.Log("called set light");
        if (lightSource.CompareTag("LampLight"))
        {
            count = count + 1;
            SetCountText();

            lampLight = lightSource.gameObject.GetComponentInChildren <Light>();
            // Material bulb = lightSource.GetComponentInChildren<Renderer>().material;

            // if (bulb == null)
            //    Debug.Log("HHH");
            if (lampLight.intensity > 0)
            {
                lampLight.intensity = 0;

                audioSource.clip = offSoundEffect;
                audioSource.Play();

                if (equippedLight == 1 || equippedLight == 2)
                {
                    tMovement.findLatest(lightSource);
                }

                //bulb.DisableKeyword("_EMISSION");

                lightSourceController lController = lightSource.GetComponentInParent <lightSourceController>();
                if (lController != null)
                {
                    lController.setCurrentLightType(0);
                }
            }
            else
            {
                setChildLight(lightSource.GetComponentsInChildren <Light>());
                lampLight.intensity = lightValueOn;

                audioSource.clip = onSoundEffect;
                audioSource.Play();
                if (equippedLight == 1 || equippedLight == 2)
                {
                    tMovement.findLatest(lightSource);
                }

                subtractResource();
                lightSourceController lController = lightSource.GetComponentInParent <lightSourceController>();
                if (lController != null)
                {
                    lController.setCurrentLightType(equippedLight);
                }

                if (equippedLight == 1 || equippedLight == 3)
                {
                    GameObject[] monsters = GameObject.FindGameObjectsWithTag("Monster");
                    foreach (GameObject g in monsters)
                    {
                        EnemyMovement eScript = g.GetComponent <EnemyMovement>();
                        if (eScript == null)
                        {
                            Debug.Log("Could not find script for monster");
                        }
                        else
                        {
                            eScript.monsterLampLit(lightSource);
                        }
                    }
                }
            }
        }
    }
    /*
     * 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;
            }
        }
    }