Esempio n. 1
0
    // Use this for initialization
    void Start()
    {
        GUID = Guid.NewGuid();

        Slider1.onValueChanged.AddListener((f) => { NotifyPropertyChange(nameof(Slider1Value)); });
        Slider2.onValueChanged.AddListener((f) => { NotifyPropertyChange(nameof(Slider2Value)); });

        bindBroker = new BindBroker();
        bindBroker.RegisterData(this);

        bindBroker.Bind(() => PlayerHealth, () => HealthBarFillAmount, BindingType.OneWay);
        bindBroker.Bind(() => PlayerHealth, () => HealthBarTextText, BindingType.OneWay);

        bindBroker.Bind(() => Slider1Value, () => Slider2Value, BindingType.TwoWay);
        bindBroker.Bind(() => Slider2Value, () => Slider2TextText, BindingType.OneWay);
    }
Esempio n. 2
0
        // Use this for initialization
        void Start()
        {
            // create and register the BindBroker
            _broker = new BindBroker();
            _broker.RegisterData(GameSettings.CurrentSettings);
            GUID = Guid.NewGuid();

            // set the FOV to the current value from game settings
            FOV = GameSettings.CurrentSettings.FOV;

            // bind the settings FOV value to the Camera FOV, so we get updates
            _broker.Bind(() => GameSettings.CurrentSettings.FOV, () => FOV, BindingType.OneWay);
        }