gpt4 book ai didi

unity3d - 由于时间尺度 0,LeanTween 没有做任何事情。有什么解决办法?

转载 作者:行者123 更新时间:2023-12-04 14:35:33 24 4
gpt4 key购买 nike

这就是问题所在。我设置了一个记分牌,并制作它以便我的学生可以在记分牌上缓解一些图像(星星的数量)。

这是调用 void 的代码:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;


public class ScoreBoard : MonoBehaviour
{

public float timerassesshigh; //change for every level (for gold)
public float timerassesslow; //change for every level (for silver)
public timer timer;
private SceneFadeEffect sceneFade;
private Scene scene;
public int nextLevelRecord;
private int levelcurrentat;
public string NextLevel;
public AudioSource leveldonedun;
private GameObject musicg;
public AudioSource music;
public Animator leveldonefade;
public Image leveldonefadesprite;
public GameObject buttons;
public rankaudioandlog rankaudioandlog;

private void Awake()
{
}


// Start is called before the first frame update
void Start()
{
scene = SceneManager.GetActiveScene();
levelcurrentat = PlayerPrefs.GetInt("levelreached");
sceneFade = FindObjectOfType<SceneFadeEffect>();
timer = FindObjectOfType<timer>();
leveldonefade.enabled = false;
leveldonefadesprite.enabled = false;
buttons.SetActive(false);
}

public void leveldone()
{
buttons.SetActive(true);
leveldonefadesprite.enabled = true;
leveldonefade.Rebind();
leveldonedun.Play();
music.Stop();
if (timerassesshigh >= timer.time)
{
rankaudioandlog.gotgold();
}
}

这是包含精益的代码
public class rankaudioandlog : MonoBehaviour
{
public AudioSource bronze;
public AudioSource silver;
public AudioSource gold;
public GameObject goldobject;
public GameObject silverobject;
public GameObject bronzeobject;
public AudioSource leveldonecue;
private int levelnumberrank;
public string levelnumber;
public LeanTweenType InType;


private void Start()
{
levelnumberrank = PlayerPrefs.GetInt(("rankoflevel") + (levelnumber));
}

public void gotgold()
{
Debug.Log("You got gold!" + "on level" + levelnumber);
LeanTween.scale(bronzeobject, new Vector3(6.5f, 6.5f, 0f), 0.2f).setDelay(1.2f).setEase(InType);
bronze.PlayDelayed(2f);
LeanTween.scale(silverobject, new Vector3(6.5f, 6.5f, 0f), 0.2f).setDelay(2.2f).setEase(InType);
silver.PlayDelayed(3f);
LeanTween.scale(goldobject, new Vector3(6.5f, 6.5f, 0f), 0.2f).setDelay(3.2f).setEase(InType);
gold.PlayDelayed(4f);
cueendsong();
if (levelnumberrank == 3)
{
return;
}
else
{
Debug.Log("I logged gold");
PlayerPrefs.SetInt(("rankoflevel") + (levelnumber), 3);
}
}
}

现在,在另一个函数中,当关卡结束并调用计分板时,时间刻度变为 0。这就是为什么 Leantween 不起作用的原因。我需要一个解决方法。时间刻度必须保持为 0,并且瘦身应该开始

谢谢^^

最佳答案

好的,我想通了!

我只需要添加 .setIgnoreTimeScale(true);到补间。

很抱歉给您带来麻烦,希望我也帮助了某人 ^^。

关于unity3d - 由于时间尺度 0,LeanTween 没有做任何事情。有什么解决办法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60730454/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com