Как в скрипте сделать, чтобы после начала использования void StartSlow значение в fillAmount шло к 0, а после void StopSlow значение обратно шло к 1?
Вот сам скрипт
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class SlowDown : MonoBehaviour
{
public Image SlowValue;
//private float TValue1 = -0.01f;
//private float TValue2 = +0.01f;
private void Start()
{
SlowValue = GetComponent<Image>();
}
// Активация функции Void
private void Update()
{
if (Input.GetMouseButtonDown(1))
{
StartSlow();
}
else if (Input.GetMouseButtonUp(1))
{
StopSlow();
}
if (SlowValue.fillAmount == 0.01f)
StopSlow();
}
void StartSlow()
{
Time.timeScale = 0.4f;
Time.fixedDeltaTime = Time.timeScale * 0.02f;
}
void StopSlow()
{
Time.timeScale = 1f;
Time.fixedDeltaTime = Time.timeScale * 0.02f;
}
}