コード例 #1
0
    public void ResistancyOutput(int tick, GameObject SourceInstance)
    {
        int   SourceInstanceID = SourceInstance.GetInstanceID();
        float Resistance       = ElectricityFunctions.WorkOutResistance(Data.ResistanceComingFrom [SourceInstanceID]);

        InputOutputFunctions.ResistancyOutput(tick, Resistance, SourceInstance, this);
    }
コード例 #2
0
 public override void DirectionInput(GameObject SourceInstance, ElectricalOIinheritance ComingFrom, CableLine PassOn = null)
 {
     InputOutputFunctions.DirectionInput(SourceInstance, ComingFrom, this);
     if (PassOn == null)
     {
         if (RelatedLine != null)
         {
             //if (RelatedLine.TheEnd == this.GetComponent<ElectricalOIinheritance> ()) {
             //	//Logger.Log ("looc");
             //} else if (RelatedLine.TheStart == this.GetComponent<ElectricalOIinheritance> ()) {
             //	//Logger.Log ("cool");
             //} else {
             //	//Logger.Log ("hELP{!!!");
             //}
         }
         else
         {
             if (!(Data.connections.Count > 2))
             {
                 RelatedLine = new CableLine();
                 if (RelatedLine == null)
                 {
                     Logger.Log("DirectionInput: RelatedLine is null.", Category.Power);
                 }
                 RelatedLine.InitialGenerator = SourceInstance;
                 RelatedLine.TheStart         = this;
                 lineExplore(RelatedLine, SourceInstance);
                 if (RelatedLine.TheEnd == null)
                 {
                     RelatedLine = null;
                 }
             }
         }
     }
 }
コード例 #3
0
 /// <summary>
 ///The function for out putting current into other nodes (Basically doing ElectricityInput On another one)
 /// </summary>
 public virtual void ElectricityOutput(float Current, GameObject SourceInstance)
 {
     //SourceInstance.GetComponent<ElectricalOIinheritance>();
     //Logger.Log("oh man?");
     InputOutputFunctions.ElectricityOutput(Current, SourceInstance, this);
     ElectricityFunctions.WorkOutActualNumbers(this);
 }
コード例 #4
0
    public static void CircuitSearchLoop(ElectricalOIinheritance Thiswire)
    {
        //Logger.Log("CircuitSearchLoop Enter", Category.Electrical);
        GameObject GameObject = Thiswire.GameObject();

        if (GameObject == null)
        {
            return;
        }

        InputOutputFunctions.DirectionOutput(GameObject, Thiswire);
        bool Break = true;

        while (Break)
        {
            UesAlternativeDirectionWorkOnNextList = false;
            DOCircuitSearchLoop(GameObject, _DirectionWorkOnNextList, _DirectionWorkOnNextListWait);

            UesAlternativeDirectionWorkOnNextList = true;
            DOCircuitSearchLoop(GameObject, DirectionWorkOnNextList, DirectionWorkOnNextListWait);

            if (DirectionWorkOnNextList.Count <= 0 & DirectionWorkOnNextListWait.Count <= 0 &
                _DirectionWorkOnNextList.Count <= 0 & _DirectionWorkOnNextListWait.Count <= 0)
            {
                //Logger.Log ("CircuitSearchLoop stop!", Category.Electrical );
                Break = false;
            }
        }
    }
コード例 #5
0
    public static void CircuitSearchLoop(IElectricityIO Thiswire, IProvidePower ProvidingPower)
    {
        InputOutputFunctions.DirectionOutput(ElectricalSynchronisation.currentTick, Thiswire.GameObject(), Thiswire);
        bool Break = true;
        List <IElectricityIO> IterateDirectionWorkOnNextList = new List <IElectricityIO> ();

        while (Break)
        {
            IterateDirectionWorkOnNextList = new List <IElectricityIO> (ProvidingPower.DirectionWorkOnNextList);
            ProvidingPower.DirectionWorkOnNextList.Clear();
            for (int i = 0; i < IterateDirectionWorkOnNextList.Count; i++)
            {
                IterateDirectionWorkOnNextList [i].DirectionOutput(ElectricalSynchronisation.currentTick, Thiswire.GameObject());
            }
            if (ProvidingPower.DirectionWorkOnNextList.Count <= 0)
            {
                IterateDirectionWorkOnNextList = new List <IElectricityIO> (ProvidingPower.DirectionWorkOnNextListWait);
                ProvidingPower.DirectionWorkOnNextListWait.Clear();
                for (int i = 0; i < IterateDirectionWorkOnNextList.Count; i++)
                {
                    IterateDirectionWorkOnNextList [i].DirectionOutput(ElectricalSynchronisation.currentTick, Thiswire.GameObject());
                }
            }
            if (ProvidingPower.DirectionWorkOnNextList.Count <= 0 && ProvidingPower.DirectionWorkOnNextListWait.Count <= 0)
            {
                //Logger.Log ("stop!");
                Break = false;
            }
        }
    }
コード例 #6
0
    public override void DirectionOutput(GameObject SourceInstance)
    {
        int SourceInstanceID = SourceInstance.GetInstanceID();

        //Logger.Log (this.gameObject.GetInstanceID().ToString() + " <ID | Downstream = "+Data.Downstream[SourceInstanceID].Count.ToString() + " Upstream = " + Data.Upstream[SourceInstanceID].Count.ToString () + this.name + " <  name! ", Category.Electrical);
        if (RelatedLine == null)
        {
            InputOutputFunctions.DirectionOutput(SourceInstance, this);
        }
        else
        {
            IElectricityIO GoingTo;
            if (RelatedLine.TheEnd == this.GetComponent <IElectricityIO> ())
            {
                GoingTo = RelatedLine.TheStart;
            }
            else if (RelatedLine.TheStart == this.GetComponent <IElectricityIO> ())
            {
                GoingTo = RelatedLine.TheEnd;
            }
            else
            {
                GoingTo = null;
                return;
            }

            if (!(Data.Upstream.ContainsKey(SourceInstanceID)))
            {
                Data.Upstream[SourceInstanceID] = new HashSet <IElectricityIO>();
            }
            if (!(Data.Downstream.ContainsKey(SourceInstanceID)))
            {
                Data.Downstream[SourceInstanceID] = new HashSet <IElectricityIO>();
            }

            if (GoingTo != null)
            {
                //Logger.Log ("to" + GoingTo.GameObject ().name);///wow
            }


            foreach (IElectricityIO bob in Data.Upstream[SourceInstanceID])
            {
                //Logger.Log("Upstream" + bob.GameObject ().name );
            }
            if (!(Data.Downstream [SourceInstanceID].Contains(GoingTo) || Data.Upstream [SourceInstanceID].Contains(GoingTo)))
            {
                Data.Downstream [SourceInstanceID].Add(GoingTo);

                RelatedLine.DirectionInput(SourceInstance, this);
            }
            else
            {
                InputOutputFunctions.DirectionOutput(SourceInstance, this, RelatedLine);
            }
        }

        Data.DownstreamCount = Data.Downstream[SourceInstanceID].Count;
        Data.UpstreamCount   = Data.Upstream[SourceInstanceID].Count;
    }
コード例 #7
0
 /// <summary>
 ///  Sets the upstream
 /// </summary>
 public virtual void DirectionInput(GameObject SourceInstance, ElectricalOIinheritance ComingFrom, CableLine PassOn = null)
 {
     if (Logall)
     {
         Logger.Log("this > " + this + "DirectionInput SourceInstance > " + SourceInstance + " ComingFrom > " + ComingFrom + "  PassOn > " + PassOn, Category.Electrical);
     }
     InputOutputFunctions.DirectionInput(SourceInstance, ComingFrom, this);
 }
コード例 #8
0
    public override void ResistancyOutput(GameObject SourceInstance)
    {
        int   SourceInstanceID = SourceInstance.GetInstanceID();
        float Resistance       = ElectricityFunctions.WorkOutResistance(Data.ResistanceComingFrom[SourceInstanceID]);

        Resistance = RelatedDevice.ModifyResistancyOutput(Resistance, SourceInstance);
        InputOutputFunctions.ResistancyOutput(Resistance, SourceInstance, this);
    }
コード例 #9
0
 /// <summary>
 /// Inputs a current from a device, with the supply
 /// </summary>
 public virtual void ElectricityInput(float Current, GameObject SourceInstance, ElectricalOIinheritance ComingFrom)
 {
     if (Logall)
     {
         Logger.Log("this > " + this + "ElectricityInput, Current > " + Current + " SourceInstance  > " + SourceInstance + " ComingFrom > " + ComingFrom, Category.Electrical);
     }
     InputOutputFunctions.ElectricityInput(Current, SourceInstance, ComingFrom, this);
 }
コード例 #10
0
 /// <summary>
 /// Pass resistance with GameObject of the Machine it is heading toward
 /// </summary>
 public virtual void ResistanceInput(float Resistance, GameObject SourceInstance, ElectricalOIinheritance ComingFrom)
 {
     if (Logall)
     {
         Logger.Log("this > " + this + "ResistanceInput, Resistance > " + Resistance + " SourceInstance  > " + SourceInstance + " ComingFrom > " + ComingFrom, Category.Electrical);
     }
     InputOutputFunctions.ResistanceInput(Resistance, SourceInstance, ComingFrom, this);
 }
コード例 #11
0
 ///// <summary>
 /////  Sets the upstream
 ///// </summary>
 public virtual void DirectionInput(ElectricalOIinheritance SourceInstance, IntrinsicElectronicData ComingFrom, CableLine PassOn = null)
 {
     if (Logall)
     {
         Logger.Log("this > " + this + "DirectionInput SourceInstance > " + SourceInstance + " ComingFrom > " + ComingFrom + "  PassOn > " + PassOn, Category.Electrical);
     }
     InputOutputFunctions.DirectionInput(SourceInstance, ComingFrom, InData);
 }
コード例 #12
0
ファイル: InLineDevice.cs プロジェクト: ynot01/unitystation
    public override void ResistancyOutput(GameObject SourceInstance)
    {
        int   SourceInstanceID = SourceInstance.GetInstanceID();
        float Resistance       = ElectricityFunctions.WorkOutResistance(Data.SupplyDependent[SourceInstanceID].ResistanceComingFrom);

        Resistance = InData.ControllingDevice.ModifyResistancyOutput(Resistance, SourceInstance);
        InputOutputFunctions.ResistancyOutput(Resistance, SourceInstance, this);
    }
コード例 #13
0
 /// <summary>
 ///The function for out putting current into other nodes (Basically doing ElectricityInput On another one)
 /// </summary>
 public virtual void ElectricityOutput(float Current, GameObject SourceInstance)
 {
     if (Logall)
     {
         Logger.Log("this > " + this + "ElectricityOutput, Current > " + Current + " SourceInstance  > " + SourceInstance, Category.Electrical);
     }
     InputOutputFunctions.ElectricityOutput(Current, SourceInstance, this);
 }
コード例 #14
0
 public void ElectricityOutput(int tick, float Current, GameObject SourceInstance)
 {
     InputOutputFunctions.ElectricityOutput(tick, Current, SourceInstance, this);
     Data.ActualCurrentChargeInWire = ElectricityFunctions.WorkOutActualNumbers(this);
     Data.CurrentInWire             = Data.ActualCurrentChargeInWire.Current;
     Data.ActualVoltage             = Data.ActualCurrentChargeInWire.Voltage;
     Data.EstimatedResistance       = Data.ActualCurrentChargeInWire.EstimatedResistant;
 }
コード例 #15
0
 public override void ElectricityOutput(float Current, GameObject SourceInstance)
 {
     //Logger.Log (Current.ToString () + " How much current", Category.Electrical);
     InputOutputFunctions.ElectricityOutput(Current, SourceInstance, this);
     if (ControllingCable != null)
     {
         ElectricalSynchronisation.CableUpdates.Add(ControllingCable);
     }
 }
コード例 #16
0
 public override void ResistancyOutput(ResistanceWrap Resistance, ElectricalOIinheritance SourceInstance)
 {
     Resistance = InData.ControllingDevice.ModifyResistancyOutput(Resistance, SourceInstance);
     if (Logall)
     {
         Logger.Log("this > " + this + "ResistancyOutput, Resistance > " + Resistance + " SourceInstance  > " + SourceInstance, Category.Electrical);
     }
     InputOutputFunctions.ResistancyOutput(Resistance, SourceInstance, InData);
 }
コード例 #17
0
ファイル: InLineDevice.cs プロジェクト: Venseer/unitystation
    public void DirectionOutput(int tick, GameObject SourceInstance)
    {
        InputOutputFunctions.DirectionOutput(tick, SourceInstance, this);
        int SourceInstanceID = SourceInstance.GetInstanceID();

        Data.DownstreamCount = Data.Downstream[SourceInstanceID].Count;
        Data.UpstreamCount   = Data.Upstream[SourceInstanceID].Count;
        //Logger.Log (this.gameObject.GetInstanceID().ToString() + " <ID | Downstream = "+Downstream[SourceInstanceID].Count.ToString() + " Upstream = " + Upstream[SourceInstanceID].Count.ToString (), Category.Electrical);
    }
コード例 #18
0
 /// <summary>
 /// Passes it on to the next cable
 /// </summary>
 public virtual void ResistancyOutput(ResistanceWrap Resistance, ElectricalOIinheritance SourceInstance)
 {
     if (Logall)
     {
         Logger.Log("this > " + this
                    + "ResistancyOutput, Resistance > " + Resistance
                    + " SourceInstance  > " + SourceInstance, Category.Electrical);
     }
     InputOutputFunctions.ResistancyOutput(Resistance, SourceInstance, InData);
 }
コード例 #19
0
 public override void ResistancyOutput(GameObject SourceInstance)
 {
     //Logger.Log (SourceInstance.GetInstanceID().ToString() + " < Receive | is > " + this.gameObject.GetInstanceID().ToString() );
     if (!(SourceInstance == this.gameObject))
     {
         int   SourceInstanceID = SourceInstance.GetInstanceID();
         float Resistance       = ElectricityFunctions.WorkOutResistance(Data.ResistanceComingFrom[SourceInstanceID]);
         InputOutputFunctions.ResistancyOutput(Resistance, SourceInstance, this);
     }
 }
コード例 #20
0
    /// <summary>
    /// Sets the downstream and pokes the next one along
    /// </summary>
    public virtual void DirectionOutput(GameObject SourceInstance)
    {
        int SourceInstanceID = SourceInstance.GetInstanceID();

        InputOutputFunctions.DirectionOutput(SourceInstance, this);
        if (Logall)
        {
            Logger.Log("this > " + this + "DirectionOutput " + this.gameObject + " <ID | Downstream = " + Data.SupplyDependent[SourceInstanceID].Downstream.Count + " Upstream = " + Data.SupplyDependent[SourceInstanceID].Upstream.Count + "connections " + (string.Join(",", Data.connections)), Category.Electrical);
        }
    }
コード例 #21
0
 public override void ElectricityOutput(VIRCurrent Current,
                                        ElectricalOIinheritance SourceInstance)
 {
     Current = InData.ControllingDevice.ModifyElectricityOutput(Current, SourceInstance);
     if (Logall)
     {
         Logger.Log("this > " + this + "ElectricityOutput, Current > " + Current + " SourceInstance  > " + SourceInstance, Category.Electrical);
     }
     InputOutputFunctions.ElectricityOutput(Current, SourceInstance, InData);
 }
コード例 #22
0
    /// <summary>
    /// Passes it on to the next cable
    /// </summary>
    public virtual void ResistancyOutput(GameObject SourceInstance)
    {
        float Resistance = ElectricityFunctions.WorkOutResistance(Data.SupplyDependent[SourceInstance.GetInstanceID()].ResistanceComingFrom);

        if (Logall)
        {
            Logger.Log("this > " + this + "ResistancyOutput, Resistance > " + Resistance + " SourceInstance  > " + SourceInstance, Category.Electrical);
        }
        InputOutputFunctions.ResistancyOutput(Resistance, SourceInstance, this);
    }
コード例 #23
0
 /// <summary>
 ///The function for out putting current into other nodes (Basically doing ElectricityInput On another one)
 /// </summary>
 public virtual void ElectricityOutput(VIRCurrent Current,
                                       ElectricalOIinheritance SourceInstance)
 {
     if (Logall)
     {
         Logger.Log("this > " + this
                    + "ElectricityOutput, Current > " + Current
                    + " SourceInstance  > " + SourceInstance, Category.Electrical);
     }
     InputOutputFunctions.ElectricityOutput(Current, SourceInstance, InData);
 }
コード例 #24
0
 /// <summary>
 /// Sets the downstream and pokes the next one along
 /// </summary>
 public virtual void DirectionOutput(ElectricalOIinheritance SourceInstance)
 {
     if (Present != null)
     {
         Present.DirectionOutput(SourceInstance);
     }
     else
     {
         InputOutputFunctions.DirectionOutput(SourceInstance, this);
     }
 }
コード例 #25
0
 /// <summary>
 ///  Sets the upstream
 /// </summary>
 public virtual void DirectionInput(ElectricalOIinheritance SourceInstance, IntrinsicElectronicData ComingFrom, CableLine PassOn = null)
 {
     if (Present != null)
     {
         Present.DirectionInput(SourceInstance, ComingFrom);
     }
     else
     {
         InputOutputFunctions.DirectionInput(SourceInstance, ComingFrom, this);
     }
 }
コード例 #26
0
 /// <summary>
 /// Passes it on to the next cable
 /// </summary>
 public virtual void ResistancyOutput(ResistanceWrap Resistance, ElectricalOIinheritance SourceInstance)
 {
     if (Present != null)
     {
         Present.ResistancyOutput(Resistance, SourceInstance);
     }
     else
     {
         InputOutputFunctions.ResistancyOutput(Resistance, SourceInstance, this);
     }
 }
コード例 #27
0
 /// <summary>
 ///The function for out putting current into other nodes (Basically doing ElectricityInput On another one)
 /// </summary>
 public virtual void ElectricityOutput(VIRCurrent Current,
                                       ElectricalOIinheritance SourceInstance)
 {
     if (Present != null)
     {
         Present.ElectricityOutput(Current, SourceInstance);
     }
     else
     {
         InputOutputFunctions.ElectricityOutput(Current, SourceInstance, this);
     }
 }
コード例 #28
0
 public override void ElectricityOutput(float Current, GameObject SourceInstance)
 {
     if (!(SourceInstance == this.gameObject))
     {
         ElectricalSynchronisation.NUCurrentChange.Add(InData.ControllingUpdate);
     }
     InputOutputFunctions.ElectricityOutput(Current, SourceInstance, this);
     Data.ActualCurrentChargeInWire = ElectricityFunctions.WorkOutActualNumbers(this);
     Data.CurrentInWire             = Data.ActualCurrentChargeInWire.Current;
     Data.ActualVoltage             = Data.ActualCurrentChargeInWire.Voltage;
     Data.EstimatedResistance       = Data.ActualCurrentChargeInWire.EstimatedResistant;
 }
コード例 #29
0
ファイル: InLineDevice.cs プロジェクト: Venseer/unitystation
 public void ElectricityOutput(int tick, float Current, GameObject SourceInstance)
 {
     Current = RelatedDevice.ModifyElectricityOutput(tick, Current, SourceInstance);
     //Logger.Log (CurrentInWire.ToString () + " How much current", Category.Electrical);
     if (Current != 0)
     {
         InputOutputFunctions.ElectricityOutput(tick, Current, SourceInstance, this);
     }
     Data.ActualCurrentChargeInWire = ElectricityFunctions.WorkOutActualNumbers(this);
     Data.CurrentInWire             = Data.ActualCurrentChargeInWire.Current;
     Data.ActualVoltage             = Data.ActualCurrentChargeInWire.Voltage;
     Data.EstimatedResistance       = Data.ActualCurrentChargeInWire.EstimatedResistant;
 }
コード例 #30
0
 /// <summary>
 /// Inputs a current from a device, with the supply
 /// </summary>
 public virtual void ElectricityInput(VIRCurrent Current,
                                      ElectricalOIinheritance SourceInstance,
                                      IntrinsicElectronicData ComingFrom)
 {
     if (Logall)
     {
         Logger.Log("this > " + this
                    + "ElectricityInput, Current > " + Current
                    + " SourceInstance  > " + SourceInstance
                    + " ComingFrom > " + ComingFrom, Category.Electrical);
     }
     InputOutputFunctions.ElectricityInput(Current, SourceInstance, ComingFrom, InData);
 }