// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus). // It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) using System.Collections; using System.Collections.Generic; namespace Fungus { /// /// Execution state of a Block. /// public enum ExecutionState { Idle, Executing, } /// /// A container for a sequence of Fungus comands. /// public interface IBlock { /// /// The execution state of the Block. /// ExecutionState State { get; } /// /// Unique identifier for the Block. /// int ItemId { get; set; } /// /// The name of the block node as displayed in the Flowchart window. /// string BlockName { get; set; } /// /// Description text to display under the block node /// string Description { get; } /// /// An optional Event Handler which can execute the block when an event occurs. /// Note: Using the concrete class instead of the interface here because of weird editor behaviour. /// EventHandler _EventHandler { get; set; } /// /// The currently executing command. /// Command ActiveCommand { get; } /// /// Timer for fading Block execution icon. /// float ExecutingIconTimer { get; set; } /// /// The list of commands in the sequence. /// List CommandList { get; } /// /// Controls the next command to execute in the block execution coroutine. /// int JumpToCommandIndex { set; } /// /// Returns the parent Flowchart for this Block. /// IFlowchart GetFlowchart(); /// /// Returns true if the Block is executing a command. /// bool IsExecuting(); /// /// Returns the number of times this Block has executed. /// int GetExecutionCount(); /// /// Start a coroutine which executes all commands in the Block. Only one running instance of each Block is permitted. /// void StartExecution(); /// /// A coroutine method that executes all commands in the Block. Only one running instance of each Block is permitted. /// /// Index of command to start execution at /// Delegate function to call when execution completes IEnumerator Execute(int commandIndex = 0, System.Action onComplete = null); /// /// Stop executing commands in this Block. /// void Stop(); /// /// Returns a list of all Blocks connected to this one. /// List GetConnectedBlocks(); /// /// Returns the type of the previously executing command. /// /// The previous active command type. System.Type GetPreviousActiveCommandType(); /// /// Recalculate the indent levels for all commands in the list. /// void UpdateIndentLevels(); } }