Esempio n. 1
0
    //NOTE: Probably will be switched to raycasting later; this is just a quick test to get the algorithm down
    private void OnTriggerEnter(Collider other)
    {
        //Get the light of the object
        light = other.gameObject.GetComponent <AbsorbableLight>();

        //If there is indeed a light and the light prisoner doesn't have one, make it dim to indicate that the light prisoner can take it
        if (light != null && isPossessed == true)
        {
            isInLight = true;
        }
    }
Esempio n. 2
0
    //Disable the light when the prisoner walks out of it
    private void OnTriggerExit(Collider other)
    {
        //Get the light of the object
        light = other.gameObject.GetComponent <AbsorbableLight>();

        //If there is indeed a light and it is enabled, disable its flicker
        if (isInLight == true && light != null && isPossessed == true)
        {
            isInLight = false;
            if (lightStored.enabled == false)
            {
                light.stopTake(this);
            }
            else
            {
                light.stopPut(this);
            }
        }
    }
Esempio n. 3
0
    //Update is called once per frame
    protected override void Update()
    {
        base.Update();

        //Take the light from the light source and store it
        //If there is a light, and the Player pressed the L button, store the light if the light is enabled and put the light back if the light is disabled
        if (isInLight == true && light != null && isPossessed == true)
        {
            //If you put the light back and are still standing on it, check for indicating if it can be taken
            if (lightStored.enabled == false)
            {
                light.indicateTake(this);
            }
            //Check for indicating if you can put the light
            else
            {
                light.indicatePut(this);
            }

            //Check if the player presses L
            if (Input.GetKeyDown(KeyCode.F) == true)
            {
                //Take the light if it can be taken
                if (lightStored.enabled == false && light.canBeTaken() == true)
                {
                    //Get the light properties
                    AbsorbableLight lighttaken = light.takeLight(this);

                    lightStored.color = lighttaken.getLight.color;

                    addTempFade(false, lighttaken.getOrigIntensity);
                }
                //Put your light into a light source if you have light and the light source can receive the light
                else if (lightStored.enabled == true && lightStoredFade == null && light.canBePlaced() == true)
                {
                    light.placeLight(lightStored, this);

                    addTempFade(true, 0f);
                }
            }
        }
    }