Exemple #1
0
    /// <summary>
    /// Transforms the <paramref name="error"/> into a pre-defined message
    /// </summary>
    /// <param name="error"></param>
    /// <returns></returns>
    public static string ErrorToString(Error error, ClickableElement current)
    {
        string prompt = "Error at " + (current ? current.elementName : "unknown") + ": ";

        switch (error)
        {
        case Error.NoEntryState:
            prompt += "You can't have a FSM without an Entry State";
            break;

        case Error.MoreThanOneRoot:
            prompt += "You can't have a BT with more than one Root";
            break;

        case Error.RepeatedName:
            prompt += "You can't have two elements with the same name";
            break;

        case Error.NoExitTransition:
            prompt += "You can't have a " + current.GetTypeString() + " inside a " + current.parent.GetTypeString() + " with no Exit Transition";
            break;

        default:
            prompt += "Unknown error :(";
            break;
        }

        return(prompt);
    }