Exemple #1
0
 /// <summary>
 /// Set up this switch to send its status to the gamelogic engine with the given ID.
 /// </summary>
 /// <param name="switchConfig">Config containing gamelogic engine's switch ID and pulse settings</param>
 public void AddSwitchId(SwitchConfig switchConfig)
 {
     if (_switchIds == null)
     {
         _switchIds = new List <SwitchConfig>();
     }
     _switchIds.Add(switchConfig);
 }
        /// <summary>
        /// Set up this switch to send its status to the gamelogic engine with the given ID.
        /// </summary>
        /// <param name="switchConfig">Config containing gamelogic engine's switch ID and pulse settings</param>
        /// <param name="switchStatus">Since multiple switch destinations can map to a switch, we might already have a status object.</param>
        internal IApiSwitchStatus AddSwitchDest(SwitchConfig switchConfig, IApiSwitchStatus switchStatus)
        {
            if (_switches == null)
            {
                _switches = new List <SwitchConfig>();
            }

            var swStatus = switchStatus ?? new ItemSwitchStatus(switchConfig.IsNormallyClosed)
            {
                IsSwitchEnabled = IsEnabled
            };

            _switches.Add(switchConfig);
            _switchStatuses[switchConfig.SwitchId] = swStatus;

            return(swStatus);
        }
 IApiSwitchStatus IApiSwitch.AddSwitchDest(SwitchConfig switchConfig, IApiSwitchStatus switchStatus) => AddSwitchDest(switchConfig.WithPulse(true), switchStatus);
Exemple #4
0
 protected void AddSwitchId(SwitchConfig switchConfig) => _switchHandler.AddSwitchId(switchConfig);
 IApiSwitchStatus IApiSwitch.AddSwitchDest(SwitchConfig switchConfig, IApiSwitchStatus switchStatus) => AddSwitchDest(switchConfig, switchStatus);
 void IApiSwitch.AddSwitchId(SwitchConfig switchConfig) => AddSwitchId(switchConfig.WithPulse(Item.IsPulseSwitch));
 private protected IApiSwitchStatus AddSwitchDest(SwitchConfig switchConfig, IApiSwitchStatus switchStatus) => SwitchHandler.AddSwitchDest(switchConfig, switchStatus);
 IApiSwitchStatus IApiSwitch.AddSwitchDest(SwitchConfig switchConfig, IApiSwitchStatus switchStatus) =>
 _switchHandler.AddSwitchDest(switchConfig.WithPulse(_isPulseSwitch).WithDefault(_switchDefault), switchStatus);