最强钓手动画修改
This commit is contained in:
parent
e3317f6570
commit
9cfb7254f6
File diff suppressed because it is too large
Load Diff
@ -10,6 +10,8 @@ using UnityEngine.UI;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using DG.Tweening;
|
||||
|
||||
|
||||
public class WebJoinroom : MonoBehaviour
|
||||
{
|
||||
private ClientWebSocket _webSocket;
|
||||
@ -33,8 +35,11 @@ public class WebJoinroom : MonoBehaviour
|
||||
public GameObject shuaigan;
|
||||
public GameObject shougou;
|
||||
public Animator animator;
|
||||
public GameObject yupanel;
|
||||
public Image zhanshiyu;
|
||||
private async void Start()
|
||||
{
|
||||
yupanel.SetActive(false);
|
||||
TimeText.gameObject.transform.parent.gameObject.SetActive(false);
|
||||
Debug.Log(PlayerPrefs.GetString("UserToken"));
|
||||
AuthorizationValue = PlayerPrefs.GetString("UserToken");
|
||||
@ -243,9 +248,9 @@ public class WebJoinroom : MonoBehaviour
|
||||
// 更新 Aintime,每次递归时都重新计算
|
||||
var spriteAniation = shougou.GetComponent<SpriteAniation>();
|
||||
spriteAniation.Aintime = randomDelay * 1000 / spriteAniation.sprites.Count;
|
||||
remainingTime = randomDelay;
|
||||
//remainingTime = randomDelay;
|
||||
// 延迟随机时间
|
||||
await Task.Delay(TimeSpan.FromSeconds(randomDelay)/2);
|
||||
await Task.Delay(800);
|
||||
|
||||
// 延迟结束后发送消息
|
||||
await SendJsonMessage("{ \"code\": \"FISHING\", \"content\": \"{\\\"action\\\":\\\"FISHING\\\"}\" }");
|
||||
@ -359,13 +364,15 @@ public class WebJoinroom : MonoBehaviour
|
||||
|
||||
|
||||
}
|
||||
public void fishmove(int id)
|
||||
public async void fishmove(int id)
|
||||
{
|
||||
|
||||
|
||||
float liftHeight = 300f; // 吊起的高度
|
||||
float liftDuration = 2f; // 吊起动画的持续时间
|
||||
float shakeStrength = 1f; // 摇动的强度
|
||||
float shakeDuration = 0.3f; // 摇动持续时间
|
||||
|
||||
|
||||
GameObject ob = Instantiate(yu[id]);
|
||||
ob.transform.SetParent(transform, false);
|
||||
ob.transform.localPosition = new Vector3(-45, 200, 0);
|
||||
@ -378,7 +385,17 @@ public class WebJoinroom : MonoBehaviour
|
||||
transform.DOShakePosition(shakeDuration, shakeStrength, 10, 90, false, true)
|
||||
.OnKill(() => Debug.Log("鱼被吊起的动画完成!"));
|
||||
});
|
||||
Destroy(ob,1.5f);
|
||||
Destroy(ob, 1f);
|
||||
await Task.Delay(300);
|
||||
yupanel.SetActive(true);
|
||||
zhanshiyu.sprite = yu[id].GetComponent<Image>().sprite;
|
||||
yupanel.transform.DOScale(1.3f, 1f) // 使用缓动函数让鱼上升更加自然
|
||||
.OnComplete(() =>
|
||||
{
|
||||
yupanel.SetActive(false);
|
||||
yupanel.transform.DOScale(1f, 1f);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user