3

这就是问题所在。我设置了一个记分牌,并制作了它,以便我的精简版可以在记分牌上的一些图像(星数)中缓和。

这是调用 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。这就是为什么精简不工作的原因。我需要一个解决方法。时间刻度必须保持为 0,并且应该开始精益吐温

谢谢^^

4

1 回答 1

12

好的,我想通了!

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

很抱歉给您添麻烦了,希望我也能帮助到别人^^。

于 2020-03-17T21:32:51.273 回答