【问题标题】:How to create a walk through guidence in unity? [closed]如何在统一中创建遍历指南? [关闭]
【发布时间】:2022-06-11 05:10:22
【问题描述】:

我正在统一创建一个新游戏。而且我喜欢为我的游戏创建演练指南,该指南将在第一次注册后显示,例如,单击此处获取硬币。收集硬币后应该显示,点击这里购买东西。这些是我想做的事情。我该怎么做呢

【问题讨论】:

    标签: unity3d walkthrough


    【解决方案1】:

    您必须为每个步骤制定计划。这是一个使用IEnumerator的非常准确和简单的方法。

    public void Start() => StartCoroutine(Guidence());
    

    示例指南:

    现在您必须根据连续条件调整指导正文,请记住,访问不同条件并不总是那么容易。但一般来说,代表必须在 WaitUntil 中返回一个布尔值。

    public IEnumerator Guidence() // E.g guidence
    {
        Debug.Log("Click on map button watch the map.");
        
        anim.SetTrigger("Flash_Help_1");
        
        mapButton.interactable = true;
        
        yield return new WaitUntil(() => mapButtonClicked);
        
        Debug.Log("Good Job!.");
        
        mapButton.interactable = false;
        
        anim.SetTrigger("Map_Open");
    
        yield return new WaitForSeconds(5f);
    
        anim.SetTrigger("Flash_Help_2");
    
        settingsButton.interactable = true;
        
        Debug.Log("Here is settings button. with setting button you can adjust game settings..");
    
        yield return new WaitUntil(() => settingButtonClicked);
        
        Debug.Log("Good job.");
        
        // do more...
    }
    

    额外的

    某些条件(例如按下某个输入键)仅适用于 () => Input.GetKeyDown。一些条件,比如达到某个点,也可以用Vector3.Distance < distance申请。但是点击UI按钮需要如下组合。

    public bool mapButtonClicked;
    public bool settingButtonClicked;
    
    public void Start()
    {
        mapButton.onClick.AddListener(() => mapButtonClicked = true);
        settingsButton.onClick.AddListener(() => settingButtonClicked = true);
        
        StartCoroutine(Guidence());
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-11-29
      • 1970-01-01
      • 2012-10-28
      • 1970-01-01
      • 2013-06-10
      • 2016-05-06
      • 1970-01-01
      • 2021-05-20
      相关资源
      最近更新 更多