using UnityEngine;
using System.Collections;

public class CodeAction : TurnAction
{
    public delegate ActionResult CodeActionDelegate();
    private CodeActionDelegate code;
 
    public CodeAction(CodeActionDelegate codeToRun, int priority = -1)
    {
        code = codeToRun;
        if (priority != -1)
            Priority = priority;
    }

    override public void Perform()
    {
        if (code == null)
            Result = ActionResult.Abort;
        else
            Result = code();
    }
}
