You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.1 KiB
50 lines
1.1 KiB
4 years ago
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
using UnityEngine.UI;
|
||
|
|
||
|
public class NextController : MonoBehaviour
|
||
|
{
|
||
|
public UI_Control_ScrollFlow controller;
|
||
|
public bool Prev;
|
||
|
[Range(0, 0.5f)]
|
||
|
public float ClickCD;
|
||
|
private Button btn;
|
||
|
private float timmer;
|
||
|
private bool CanClick = true;
|
||
|
void Start()
|
||
|
{
|
||
|
timmer = ClickCD;
|
||
|
btn = GetComponent<Button>();
|
||
|
btn.onClick.AddListener(() =>
|
||
|
{
|
||
|
if (CanClick)
|
||
|
{
|
||
|
if (Prev)
|
||
|
{
|
||
|
controller.AnimToEnd(0.2f);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
controller.AnimToEnd(-0.2f);
|
||
|
}
|
||
|
CanClick = false;
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
// Update is called once per frame
|
||
|
void Update()
|
||
|
{
|
||
|
if (CanClick == false)
|
||
|
{
|
||
|
timmer -= Time.deltaTime;
|
||
|
if (timmer <= 0)
|
||
|
{
|
||
|
CanClick = true;
|
||
|
timmer = ClickCD;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|