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

public class lunbo : MonoBehaviour
{
    public float timer = 5.0f;
    public string[] textStrs = new[] { "如果怪物吃到电池将会加快移动速度","如果怪物吃到太空人体型将会变大" };
    private int textIndex=-1;
    public Text text;
    void Start()
    {
        InvokeRepeating(methodName: "ChangeText", time: 0, repeatRate: timer);

    }

    // Update is called once per frame
    void ChangeText()
    {
        text.text = textStrs[++textIndex % textStrs.Length];
    }
}


Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐