2022-08-17 01:11:39 +02:00
|
|
|
using System.Collections;
|
|
|
|
using System;
|
|
|
|
using UnityEngine;
|
|
|
|
using UnityEngine.UI;
|
|
|
|
using TMPro;
|
|
|
|
|
|
|
|
public class ValueManager : MonoBehaviour
|
|
|
|
{
|
|
|
|
TMP_Text tmp;
|
2022-08-18 00:50:50 +02:00
|
|
|
public float Value;
|
2022-08-17 01:11:39 +02:00
|
|
|
float tempValue;
|
|
|
|
public bool isPointerDown = false;
|
|
|
|
void Start()
|
|
|
|
{
|
|
|
|
tmp = GetComponent<TMP_Text>();
|
|
|
|
}
|
|
|
|
void Update()
|
|
|
|
{
|
|
|
|
if (isPointerDown)
|
|
|
|
{
|
2022-08-18 00:50:50 +02:00
|
|
|
ChangeValueContinue(tempValue);
|
2022-08-17 01:11:39 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-18 00:50:50 +02:00
|
|
|
public void ChangeValueContinue(float value)
|
2022-08-17 01:11:39 +02:00
|
|
|
{
|
|
|
|
tempValue = value;
|
|
|
|
Value += value;
|
|
|
|
tmp.text = String.Format("{0:F2}", Value);
|
|
|
|
isPointerDown = true;
|
|
|
|
}
|
|
|
|
public void PointerState(bool state)
|
|
|
|
{
|
|
|
|
isPointerDown = state;
|
|
|
|
}
|
2022-08-18 00:50:50 +02:00
|
|
|
public void ChangeValue(float value)
|
|
|
|
{
|
|
|
|
Value += value;
|
|
|
|
tmp.text = String.Format("{0:F2}", Value);
|
|
|
|
}
|
2022-08-17 01:11:39 +02:00
|
|
|
}
|