Fungus插件_插件大师

Fungus插件_插件大师一个任务的fungus声明fungus设置一个开关,当触发碰撞器时,将开关打开,当在持续碰撞时如是碰到的是人物,并且按下空格且开关为开,就执行对话重载名字并且关闭开关//多个任务的时候就是加个else其他都一样usingSystem;usingSystem.Collections;usingSystem.Collections.Generic;usingFungus;usingUnityEngine;publicclassFungunNpcGrandFather:.

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全家桶1年46,售后保障稳定

一个任务的fungus
声明fungus  设置一个开关,当触发碰撞器时,将开关打开,当在持续碰撞时如是碰到的是人物,并且按下空格且开关为开,就执行对话重载名字并且关闭开关//多个任务的时候就是加个else 其他都一样

using System;
using System.Collections;
using System.Collections.Generic;
using Fungus;
using UnityEngine;

public class FungunNpcGrandFather : MonoBehaviour
{
    private AllTask _allTask;
    private Flowchart flowChart;
    private bool _canSay;

    private void Start()
    {
        _allTask = GameObject.Find("CanvasScene").transform.GetChild(0).GetChild(7).GetComponent<AllTask>();
        flowChart = GameObject.Find("Flowchart").GetComponent<Flowchart>();
    }

    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag("Player"))
        {
            _canSay = true;
        }
    }

    private void OnTriggerStay(Collider other)
    {
        if (other.gameObject.CompareTag("Player"))
        {
            if (Input.GetKeyDown(KeyCode.Space))
            {
                if (_allTask.enemyNum>=50&&_canSay)
                { 
                    //执行对话
                    flowChart.ExecuteBlock("Task4");
                    _canSay = false;
                }
                else if (_canSay)
                {
                    //执行对话
                    flowChart.ExecuteBlock("Task3");
                    _canSay = false;
                }
                
            }
        }
    }
}








using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices.ComTypes;
using Fungus;
using UnityEngine;
using UnityEngine.EventSystems;
using Collision = UnityEngine.Collision;

public class FungusNpc : MonoBehaviour
{
    public string chatName;
    private bool _canSay;
    private Flowchart _flowChart;
    

    private void Start()
    {
        _flowChart = GameObject.Find("Flowchart").GetComponent<Flowchart>();
    }


    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag("Player"))
        {
            _canSay = true;
        }
    }

    private void OnTriggerStay(Collider other)
    {
        if (other.gameObject.CompareTag("Player"))
        {
            if (Input.GetKeyDown(KeyCode.Space))
            {
                if (_canSay)
                {
                    //执行对话
                    _flowChart.ExecuteBlock(chatName);
                    _canSay = false;
                }
            }
        }
    }
}

Jetbrains全家桶1年46,售后保障稳定

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/210189.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号