Skip to content

Switch Manager: Add support for additional sources #211

@freezy

Description

@freezy

We'll have game mechanics like troughs that have multiple switches (and coils). I think the best way to support them without making everything incredibly complicated is to interpret them as "source".

I would imagine having an interface like that:

public interface ISwitchDevice
{
    string Name { get; }
    IEnumerable<GamelogicEngineSwitch> Switches;
}

Our trough component would then implement this interface, and it thus appear in the switch manager as additional source:

switch-manager2

Data-wise, we have two possibilities:

  1. Change Source from int to string, and introduce "special" values for input system, playfield, constant (maybe prefix with double underscore?)
  2. Add an other DeviceSource field that is a string, and add another Source value (e.g. -1 = use DeviceSource)

I would prefer 2. since it's more proper. We also need to store the actual value in a new field, let's say DeviceItem.

So for the trough example above, we would have the following data:

  • Id = "15"
  • Description = "Trough I"
  • Source = SwitchSource.Device
  • DeviceSource = "Trough"
  • DeviceItem = "Switch I"
  • Type = SwitchType.OnOff

Metadata

Metadata

Assignees

No one assigned

    Labels

    editorEditor-related changes for UnityenhancementNew feature or requestplayerRelated to the playerunityConcerns the Unity project

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions