Ejemplo n.º 1
0
    public float ModifyElectricityOutput(int tick, float Current, GameObject SourceInstance)
    {
        int InstanceID = SourceInstance.GetInstanceID();

        float ActualCurrent = RelatedDevice.CurrentInWire;

        float Resistance = ElectricityFunctions.WorkOutResistance(RelatedDevice.ResistanceComingFrom[InstanceID]);
        float Voltage    = (Current * Resistance);
        Tuple <float, float> Currentandoffcut = ElectricityFunctions.TransformerCalculations(this, Voltage: Voltage, ResistanceModified: Resistance, ActualCurrent: ActualCurrent);

        if (Currentandoffcut.Item2 > 0)
        {
            if (!(RelatedDevice.CurrentGoingTo.ContainsKey(InstanceID)))
            {
                RelatedDevice.CurrentGoingTo [InstanceID] = new Dictionary <IElectricityIO, float> ();
            }
            RelatedDevice.CurrentGoingTo[InstanceID] [RelatedDevice.GameObject().GetComponent <IElectricityIO>()] = Currentandoffcut.Item2;
        }
        return(Currentandoffcut.Item1);
    }
    public float ModifyResistancyOutput(int tick, float Resistance, GameObject SourceInstance)
    {
        Tuple <float, float> ResistanceM = ElectricityFunctions.TransformerCalculations(this, ResistanceToModify: Resistance);

        return(ResistanceM.Item1);
    }