Advertisement
Guest User

FungusBlockTrigger

a guest
Feb 24th, 2020
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.86 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using Fungus;
  5.  
  6. public class FungusBlockTrigger : MonoBehaviour
  7. {
  8.     [SerializeField] string blockToStart = "";
  9.     [SerializeField] Flowchart flowchart = null;
  10.  
  11.     public bool inConversation = false;
  12.  
  13.     // Start is called before the first frame update
  14.     void Start()
  15.     {
  16.        
  17.     }
  18.  
  19.     // Update is called once per frame
  20.     void Update()
  21.     {
  22.         inConversation = flowchart.HasExecutingBlocks();
  23.     }
  24.  
  25.     public void OnTriggerEnter2D(UnityEngine.Collider2D collided)
  26.     {
  27.         if (!inConversation && collided.gameObject.name == "Player" && blockToStart != "")
  28.         {
  29.             flowchart.ExecuteBlock(blockToStart);
  30.         }
  31.     }
  32.  
  33.     public void SetBlockToStart (string blockName)
  34.     {
  35.         blockToStart = blockName;
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement