// script 1
using UnityEngine;
using [Link];
using [Link];
public class SpeedScript : MonoBehaviour
{
public InputActionProperty buttonPressed;
public float speed;
private Coroutine speedCoroutine;
private void OnEnable()
{
[Link]();
[Link] += OnButtonPressed;
}
private void OnDisable()
{
[Link]();
[Link] -= OnButtonPressed;
}
private void OnButtonPressed([Link] context)
{
if ([Link])
{
if (speedCoroutine != null)
{
StopCoroutine(speedCoroutine);
}
speedCoroutine = StartCoroutine(IncreaseSpeedGradually());
}
}
private IEnumerator IncreaseSpeedGradually()
{
while (speed < 7f)
{
speed += [Link];
yield return null;
}
}
}
-----------------------------------------------------------------------------------
// script 2
using [Link];
using [Link];
using UnityEngine;
public class Rotate : MonoBehaviour
{
public SpeedScript speedScript;
void Update()
{
[Link]([Link],0,0);
}
}