Cute_demon_attacks/meng_yao/Assets/script/A_Fight/StopBtn.cs
2024-12-09 11:56:41 +08:00

46 lines
937 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class StopBtn : MonoBehaviour
{
public Image startImage;
public Image stopImage;
public Button stopBtn;
int number;
// Start is called before the first frame update
void Start()
{
stopBtn = GetComponent<Button>();
stopBtn.onClick.AddListener(StopClick);
}
void StopClick()
{
number++;
if (number %2 != 0)
{
startImage.gameObject.SetActive(false);
stopImage.gameObject.SetActive(true);
UIContorl.instance.StopTimer();
}
else
{
startImage.gameObject.SetActive(true);
stopImage.gameObject.SetActive(false);
UIContorl.instance.StartTimer();
}
}
// Update is called once per frame
void Update()
{
}
}