Exemple #1
0
    public virtual void FromXML(XmlNode node)
    {
        XmlNodeList textureNodes = node.SelectNodes("textures/texture");

        foreach (XmlNode textureNode in textureNodes)
        {
            TrackBuildRTexture newTexture = gameObject.AddComponent <TrackBuildRTexture>();
            newTexture.FromXML(textureNode);
            _textures.Add(newTexture);
        }

        XmlNodeList trackPointNodes = node.SelectNodes("trackpoints/trackpoint");

        foreach (XmlNode trackPointNode in trackPointNodes)
        {
            TrackBuildRPoint point = gameObject.AddComponent <TrackBuildRPoint>();
            point.FromXML(trackPointNode);
            point.baseTransform = baseTransform;
            point.isDirty       = true;
            _points.Add(point);
        }

        if (node["meshResolution"] != null)
        {
            _meshResolution = float.Parse(node["meshResolution"].FirstChild.Value);
        }
        if (node["includeCollider"] != null)
        {
            includeCollider = bool.Parse(node["includeCollider"].FirstChild.Value);
        }
        if (node["includeColliderRoof"] != null)
        {
            includeColliderRoof = bool.Parse(node["includeColliderRoof"].FirstChild.Value);
        }
        if (node["trackColliderWallHeight"] != null)
        {
            trackColliderWallHeight = float.Parse(node["trackColliderWallHeight"].FirstChild.Value);
        }
        if (node["trackBumpers"] != null)
        {
            trackBumpers = bool.Parse(node["trackBumpers"].FirstChild.Value);
        }
        if (node["bumperHeight"] != null)
        {
            bumperHeight = float.Parse(node["bumperHeight"].FirstChild.Value);
        }
        if (node["bumperWidth"] != null)
        {
            bumperWidth = float.Parse(node["bumperWidth"].FirstChild.Value);
        }
        if (node["bumperAngleThresold"] != null)
        {
            bumperAngleThresold = float.Parse(node["bumperAngleThresold"].FirstChild.Value);
        }
        if (node["disconnectBoundary"] != null)
        {
            _disconnectBoundary = bool.Parse(node["disconnectBoundary"].FirstChild.Value);
        }
        if (node["renderBoundaryWallReverse"] != null)
        {
            _renderBoundaryWallReverse = bool.Parse(node["renderBoundaryWallReverse"].FirstChild.Value);
        }


        RecalculateCurves();
    }