Cute_demon_attacks/meng_yao/Assets/script/JumpScene/GameSceneBtn.cs

60 lines
1.2 KiB
C#
Raw Normal View History

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using DG.Tweening;
2024-11-19 16:48:27 +08:00
public class GameSceneBtn : MonoBehaviour
{
public static Action OnSceneMouseBTN;
2024-11-19 16:48:27 +08:00
private SceneSpriteAniationPro aniationPro;
float time;
2024-11-24 23:18:10 +08:00
public GameObject gotoscene;
public GameObject nowScene;
// Start is called before the first frame update
void Start()
{
OnSceneMouseBTN += JUmpScem;
2024-11-19 16:48:27 +08:00
aniationPro = GetComponent<SceneSpriteAniationPro>();
}
private void OnMouseDown()
{
transform.DOScale(new Vector3(0.5f, 0.5f, 0.5f), 0.3f).SetEase(Ease.OutBack);
StartCoroutine("Magnify");
}
IEnumerator Magnify()
{
transform.DOScale(Vector3.one, 0.5f).SetEase(Ease.OutBack);
OnSceneMouseBTN();
return null;
}
void JUmpScem()
{
2024-11-24 23:18:10 +08:00
gotoscene.SetActive(true);
nowScene.SetActive(false);
}
2024-11-19 16:48:27 +08:00
private void Update()
{
time += Time.deltaTime;
2024-11-25 14:35:52 +08:00
if (time > 5)
2024-11-19 16:48:27 +08:00
{
2024-11-25 14:35:52 +08:00
aniationPro.SetAni(0);
aniationPro.changeAni(false);
}
2024-11-25 15:53:48 +08:00
if (time > 7)
2024-11-25 14:35:52 +08:00
{
time = 0;
aniationPro.changeAni(true);
2024-11-19 16:48:27 +08:00
}
}
}