public virtual void SetConnectionStatus(CircuitManager.ConnectionStatus connection_status)
    {
        switch (connection_status)
        {
        case CircuitManager.ConnectionStatus.NotConnected:
            IsPowered = false;
            break;

        case CircuitManager.ConnectionStatus.Unpowered:
            if (IsPowered && (Object)GetComponent <Battery>() == (Object)null)
            {
                IsPowered           = false;
                circuitOverloadTime = 6f;
                PlayCircuitSound("overdraw");
            }
            break;

        case CircuitManager.ConnectionStatus.Powered:
            if (!IsPowered && circuitOverloadTime <= 0f)
            {
                IsPowered = true;
                PlayCircuitSound("powered");
            }
            break;
        }
    }
    public override void SetConnectionStatus(CircuitManager.ConnectionStatus connection_status)
    {
        CircuitManager.ConnectionStatus connectionStatus = this.connectionStatus;
        switch (connection_status)
        {
        case CircuitManager.ConnectionStatus.NotConnected:
            this.connectionStatus = CircuitManager.ConnectionStatus.NotConnected;
            break;

        case CircuitManager.ConnectionStatus.Unpowered:
            if (this.connectionStatus == CircuitManager.ConnectionStatus.Powered && (UnityEngine.Object)GetComponent <Battery>() == (UnityEngine.Object)null)
            {
                this.connectionStatus = CircuitManager.ConnectionStatus.Unpowered;
            }
            break;

        case CircuitManager.ConnectionStatus.Powered:
            if (this.connectionStatus != CircuitManager.ConnectionStatus.Powered)
            {
                this.connectionStatus = CircuitManager.ConnectionStatus.Powered;
            }
            break;
        }
        UpdatePoweredStatus();
        if (connectionStatus != this.connectionStatus && this.OnConnectionChanged != null)
        {
            this.OnConnectionChanged();
        }
    }
Ejemplo n.º 3
0
        /// <summary>
        /// Sets the power status of all consumers on the given circuit.
        /// </summary>
        /// <param name="consumers">The consumers to notify.</param>
        /// <param name="status">The status to which to set all consumers.</param>
        private static void SetAllConsumerStatus(IList <IEnergyConsumer> consumers,
                                                 ConnectionStatus status)
        {
            int n = consumers.Count;

            for (int i = 0; i < n; i++)
            {
                consumers[i].SetConnectionStatus(status);
            }
        }
 public void SetConnectionStatus(CircuitManager.ConnectionStatus status)
 {
     connectionStatus = status;
     if (status == CircuitManager.ConnectionStatus.NotConnected)
     {
         operational.SetActive(false, false);
     }
     else
     {
         operational.SetActive(operational.IsOperational && JoulesAvailable > 0f, false);
     }
 }
Ejemplo n.º 5
0
 public override void SetConnectionStatus(CircuitManager.ConnectionStatus connectionStatus)
 {
     base.SetConnectionStatus(connectionStatus);
     Trigger((int)Hashes.OnConnectionStatusUpdated, new ConnectionStatusUpdated(IsPowered));
 }