Пример #1
0
    private void CreateGravityBody(JSONNode node)
    {
        string  name         = node["name"].Value;
        Vector3 position     = new Vector3(node["position"][0], node["position"][1], node["position"][2]);
        Vector3 initVelocity = new Vector3(node["initVelocity"][0], node["initVelocity"][1], node["initVelocity"][2]);
        float   mass         = node["mass"].AsFloat;
        float   size         = node["size"].AsFloat;
        Color   color        = JSONNodeToColor(node["color"]);
        bool    includeTrail = node["trail"].AsBool;

        if (color == null)
        {
            Debug.Log("Color is null");
            color = Color.gray;
        }

        GameObject gObj = GravityBody.CreateGravityBody(name, position, mass, size, color, initVelocity, includeTrail);
    }