Пример #1
0
    IEnumerator ValueUpdater(float start, float finish, float time, UpdateValue valueUpdated)
    {
        /* starting at 0     */
        /* we increment this */
        /* toward 1          */
        float t = 0;

        while (t < 1)
        {
            /* Lerp goes from start value to     */
            /* the finish value using a range    */
            /* from 0 to 1                       */
            float v = Mathf.Lerp(start, finish, t);

            /* increment the t value from        */
            /* 0 to 1                            */
            t += Time.deltaTime / time;

            /* call the event assigned           */
            valueUpdated?.Invoke(v);

            /* wait till the end of the frame    */
            /* before starting the while loop    */
            /* again.                            */
            yield return(new WaitForEndOfFrame());
        }
    }
Пример #2
0
    private void Start()
    {
        _value = 0;
        //Load
        _bestValue = PlayerPrefs.GetInt("best", 0);

        UpdateValue?.Invoke(_value);
        UpdateBestValue?.Invoke("BEST: " + _bestValue);
    }
Пример #3
0
        private void trackBar1_ValueChanged(object sender, EventArgs e)
        {
            TrackBar slider_sender = (TrackBar)sender;
            int      Value         = slider_sender.Value;

            Setting       = Value;
            textBox1.Text = Value.ToString();
            UpdateValue.Invoke(Value);
        }
Пример #4
0
        private void buttondown_Click(object sender, EventArgs e)
        {
            int val = Convert.ToUInt16(textBox_current.Text);

            val -= 10;

            textBox_current.Text = val.ToString();

            UpdateValue?.Invoke(textBox_current.Text);
        }
Пример #5
0
 public void ResetValue()
 {
     if (_value > _bestValue)
     {
         _bestValue = _value;
         //save best
         UpdateBestValue?.Invoke("BEST: " + _bestValue);
         PlayerPrefs.SetInt("best", _bestValue);
     }
     _value = 0;
     UpdateValue?.Invoke(_value);
 }
Пример #6
0
        private void button2_Click(object sender, EventArgs e)
        {
            newvalue = textBox_current.Text;

            try
            {
                UpdateValue?.Invoke(textBox_current.Text);
            }
            catch (Exception ex)
            {
            }
        }
Пример #7
0
    public void OnAddValue(int count)
    {
        int add = count * _price;

        CreateText("+" + add, _positionScore, 45, _scoreAddColor);

        if (count >= 4)
        {
            if (Random.Range(0, 100) > 50)
            {
                CreateText(_complimentText[Random.Range(0, _complimentText.Length)], _positionCompliment, 25, _complimentColor);
            }
        }

        _value += add;
        UpdateValue?.Invoke(_value);
    }
Пример #8
0
 protected bool?OnRaiseUpdateValue()
 {
     return(UpdateValue?.Invoke(Values[SavedCurrentIndex], StaticDataKey));
 }
Пример #9
0
 private void ValueUpdate(int i)
 {
     updateVal?.Invoke(i);
 }