Esempio n. 1
0
    private void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.CompareTag("Conduit"))  // Look for a conduit tag
        {
            ConduitControl condControl = collision.gameObject.GetComponent <ConduitControl>();

            if (!condControl.Toggleable)
            {
                condControl.TurnOn();   // Turn on the conduit
            }
            else
            {
                if (condControl.ConduitEnabled)
                {
                    condControl.TurnOff();
                }
                else
                {
                    condControl.TurnOn();
                }
            }
        }
    }
Esempio n. 2
0
    ConduitControl control;     // Activates other objects when the circuit is complete

    void Awake()
    {
        conductingObj = null;
        control       = gameObject.GetComponent <ConduitControl>();
    }