private void OnHpModelValueChanged(HPModel oldValue, HPModel newValue)
 {
     if (hPView.BindingContext == null)
     {
         hPView.BindingContext = new HPViewModel();
     }
     hPView.BindingContext.Init(newValue);
 }
Esempio n. 2
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetButtonDown("Fire1"))
     {
         HPModel hPModel = characterStatusView.BindingContext.HPModel.Value as HPModel;
         characterStatusView.BindingContext.HPModel.Value = new HPModel {
             Hp = hPModel.Hp - 10, maxHp = hPModel.maxHp
         };
     }
 }
 public void Init(HPModel hPModel)
 {
     MaxHp.Value = hPModel.maxHp;
     HP.Value    = hPModel.Hp;
 }