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.
59 lines
1.1 KiB
59 lines
1.1 KiB
10 years ago
|
using UnityEngine;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
|
||
|
namespace Fungus
|
||
|
{
|
||
|
[CommandInfo("Scripting",
|
||
|
"Run Script",
|
||
|
"Start executing another Fungus Script.")]
|
||
|
public class RunScript : Command
|
||
|
{
|
||
10 years ago
|
[Tooltip("Reference to another Fungus Script to execute")]
|
||
10 years ago
|
public FungusScript targetFungusScript;
|
||
|
|
||
10 years ago
|
[Tooltip("Name of sequence to execute in target Fungus Script")]
|
||
|
public string targetSequenceName;
|
||
|
|
||
|
[Tooltip("Stop executing the current sequence before executing the new Fungus Script")]
|
||
10 years ago
|
public bool stopCurrentScript = true;
|
||
|
|
||
|
public override void OnEnter()
|
||
|
{
|
||
|
if (targetFungusScript != null)
|
||
|
{
|
||
|
if (stopCurrentScript)
|
||
|
{
|
||
|
Stop();
|
||
|
}
|
||
10 years ago
|
|
||
10 years ago
|
targetFungusScript.ExecuteSequence(targetSequenceName);
|
||
10 years ago
|
|
||
|
if (!stopCurrentScript)
|
||
|
{
|
||
|
Continue();
|
||
|
}
|
||
10 years ago
|
}
|
||
|
else
|
||
|
{
|
||
|
Continue();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public override string GetSummary()
|
||
|
{
|
||
|
if (targetFungusScript == null)
|
||
|
{
|
||
|
return "<Continue>";
|
||
|
}
|
||
|
|
||
|
return targetFungusScript.name;
|
||
|
}
|
||
|
|
||
|
public override Color GetButtonColor()
|
||
|
{
|
||
|
return new Color32(235, 191, 217, 255);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|