You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
879 B
58 lines
879 B
10 years ago
|
#if UNITY_EDITOR
|
||
|
using UnityEditor;
|
||
|
#endif
|
||
|
using UnityEngine;
|
||
10 years ago
|
using System;
|
||
10 years ago
|
using System.Collections;
|
||
10 years ago
|
using System.Collections.Generic;
|
||
10 years ago
|
using Fungus;
|
||
|
|
||
10 years ago
|
public class FungusScript : MonoBehaviour
|
||
10 years ago
|
{
|
||
|
public float stepTime;
|
||
|
|
||
10 years ago
|
public Sequence startSequence;
|
||
|
|
||
|
[System.NonSerialized]
|
||
10 years ago
|
public Sequence activeSequence;
|
||
10 years ago
|
|
||
10 years ago
|
public List<Variable> variables = new List<Variable>();
|
||
|
|
||
10 years ago
|
public void Execute()
|
||
|
{
|
||
|
if (startSequence == null)
|
||
|
{
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
ExecuteSequence(startSequence);
|
||
|
}
|
||
|
|
||
10 years ago
|
public void ExecuteSequence(Sequence sequence)
|
||
|
{
|
||
10 years ago
|
if (sequence == null)
|
||
10 years ago
|
{
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
#if UNITY_EDITOR
|
||
|
Selection.activeGameObject = sequence.gameObject;
|
||
|
#endif
|
||
|
|
||
|
activeSequence = sequence;
|
||
|
sequence.ExecuteNextCommand();
|
||
|
}
|
||
10 years ago
|
|
||
|
public Variable GetVariable(string key)
|
||
|
{
|
||
|
foreach (Variable v in variables)
|
||
|
{
|
||
|
if (v.key == key)
|
||
|
{
|
||
|
return v;
|
||
|
}
|
||
|
}
|
||
|
return null;
|
||
|
}
|
||
10 years ago
|
}
|