// REMOVES a light from the list of lights, which are entering the object
    public virtual void RemoveInputLight(LightBeam light)
    {
        var node = inputList.First;

        while (node != null)
        {
            var nextNode = node.Next;
            if (node.Value.GetID() == light.GetID())
            {
                inputList.Remove(node);
                Debug.Log("Removed " + light.GetID() + " from " + this);
            }
            node = nextNode;
        }
    }
Example #2
0
    // ADDS a light to the list of lights, which are entering the object
    public virtual void AddInputLight(LightBeam light)
    {
        // check wheather light already exists in the list
        var  node     = inputList.First;
        bool newInput = true;

        while (node != null)
        {
            var nextNode = node.Next;
            if (node.Value.GetID() == light.GetID())
            {
                newInput = false;
            }
            node = nextNode;
        }

        // if light isn't already in the list, add it and call CheckInput()
        if (newInput)
        {
            inputList.AddLast(light);
            Debug.Log("Added " + light.GetID() + " to " + this);
            CheckInput();
        }
    }