Пример #1
0
 public void pulsateFrom(ActivatorObject iAO, bool iState)
 {
     foreach (Wire w in wires)
     {
         if (w.emitter == iAO)
         {
             if (iState == true)
             {
                 w.pulse(iState);
             }
             else if (w.is_infinite)
             {
                 w.pulse(iState);
             }
         }
     }//! pulsateFrom
 }
Пример #2
0
    public Wire(ActivatorObject iEmitter, SIGNAL_KEYS iSigType, ConnectorGraph iCG)
    {
        CG     = iCG;
        chunks = new List <WireChunk>(1);

        if (iEmitter == null)
        {
            Debug.LogError("Missing Emitter in Wire.");
            emitter = null;
        }
        emitter     = iEmitter;
        sig_key     = iEmitter.signalKey;
        pulse_speed = emitter.pulse_speed;
        root_chunk  = null;
        is_infinite = (pulse_speed <= 0) ? true : false;
        has_TL_obs  = false;
    }
Пример #3
0
    public void observeWire(ActivatorObject ao)
    {
        var WireValue = new TempWireValue();

        foreach (Wire w in wires)
        {
            if (w.emitter == ao)
            {
                // if already has observer, we return to avoid double update_pulses/tick
                // might change later ?
                if (w.has_TL_obs)
                {
                    return;
                }

                WireValue.Obj = w;
                w.has_TL_obs  = true;
                break;
            }
        }
        // register object to get called on tick
        // NOTE toffa : for now we will update the wire at the beginning of the tick
        GameObject.Find("GameLoop").GetComponent <WorldManager>().TL.AddObserver(WireValue);
    }
Пример #4
0
 public Wire(ActivatorObject iEmitter, ConnectorGraph iCG) : this(iEmitter, SIGNAL_KEYS.NONE, iCG)
 {
 }