Exemplo n.º 1
0
    public void SetMapping(ControllerMapping mapping)
    {
        if (this.initialized)
        {
            throw new InvalidOperationException("Cannot set mapping multiple times");
        }

        this.controllerView = this.GetComponent <ControllerViewItem>();
        Debug.Assert(this.controllerView != null);

        this.buttons      = mapping.Buttons.ToDictionary(b => b, b => this.controllerView.AddToggleInput(b.label));
        this.analogSticks = mapping.Sticks.ToDictionary(s => s, s => this.controllerView.AddAnalogKnob(s.label));

        this.initialized = true;
    }
    private void Initialize()
    {
        if (this.initialized)
        {
            return;
        }

        this.controllerView = this.GetComponent <ControllerViewItem>();
        Debug.Assert(this.controllerView != null);

        this.selectCell             = this.controllerView.AddToggleInput("S");
        this.graspedCell            = this.controllerView.AddToggleInput("G");
        this.menuCell               = this.controllerView.AddToggleInput("M");
        this.thumbstickKnob         = this.controllerView.AddAnalogKnob("TS");
        this.thumbstickKnob.Touched = true;
        this.touchpadKnob           = this.controllerView.AddAnalogKnob("TP");

        this.initialized = true;
    }