Esempio n. 1
0
    public override string ToString()
    {
        bool   isNotEmpty = false;
        string json       = "{\"moveLength\":" + length + "\"hitboxes\":[";

        foreach (Transform child in transform)
        {
            HBox hbox = child.GetComponent <HBox>();
            if (hbox)
            {
                isNotEmpty = true;
                json      += hbox.ToString() + ", ";
            }
        }
        if (isNotEmpty)
        {
            json = json.Substring(0, json.Length - 2); //remove last semicolon and space
        }
        return(json);
    }