Exemplo n.º 1
0
    public override void Activate()
    {
        Active    = true;
        sr.sprite = ActiveSprite;
        Light.Activate();

        foreach (LightSwitchScript ls in others)
        {
            if (!ls.Triggered)
            {
                ls.Deactivate();
            }
        }
    }
Exemplo n.º 2
0
    void SpawnLights()
    {
        timeSinceLastSpawn = 0.0f;                     // float is used for precision
        timeToSpawn        = Random.Range(0.0f, 1.5f); // random time generated to spawn light

        foreach (Transform b in lights)
        {
            LightScript ls = b.GetComponent <LightScript>();            // getComponent is to retrieve the script for lights
            if (ls && !ls.isActive)
            {
                // if ls is true and is not active, we will activate the light object
                ls.Activate();
                break;
            }
        }
    }