Пример #1
0
    //public override void FromXML(XmlNode node, CameraPath cameraPath)
    //{
    //    base.FromXML(node, cameraPath);
    //    time = float.Parse(node["time"].FirstChild.Value);
    //    introStartEasePercentage = float.Parse(node["introStartEasePercentage"].FirstChild.Value);
    //    outroEndEasePercentage = float.Parse(node["outroEndEasePercentage"].FirstChild.Value);
    //    introCurve = XMLVariableConverter.FromXMLtoAnimationCurve(node["introCurve"]);
    //    outroCurve = XMLVariableConverter.FromXMLtoAnimationCurve(node["outroCurve"]);
    //}

    public override void FromXML(XMLNode node, CameraPath cameraPath)
    {
        base.FromXML(node, cameraPath);
        time = float.Parse(node.GetValue("time>0>_text"));
        introStartEasePercentage = float.Parse(node.GetValue("introStartEasePercentage>0>_text"));
        outroEndEasePercentage   = float.Parse(node.GetValue("outroEndEasePercentage>0>_text"));
        introCurve = XMLVariableConverter.FromXMLtoAnimationCurve(node.GetNode("introCurve>0"));
        outroCurve = XMLVariableConverter.FromXMLtoAnimationCurve(node.GetNode("outroCurve>0"));
    }
Пример #2
0
 public override void FromXML(XmlNode node, CameraPath cameraPath)
 {
     base.FromXML(node, cameraPath);
     time = float.Parse(node["time"].FirstChild.Value);
     introStartEasePercentage = float.Parse(node["introStartEasePercentage"].FirstChild.Value);
     outroEndEasePercentage   = float.Parse(node["outroEndEasePercentage"].FirstChild.Value);
     introCurve = XMLVariableConverter.FromXMLtoAnimationCurve(node["introCurve"]);
     outroCurve = XMLVariableConverter.FromXMLtoAnimationCurve(node["outroCurve"]);
 }
Пример #3
0
    public override string ToXML()
    {
        StringBuilder sb = new StringBuilder();

        sb.Append(base.ToXML());
        sb.AppendLine("<time>" + time + "</time>");
        sb.AppendLine("<introStartEasePercentage>" + introStartEasePercentage + "</introStartEasePercentage>");
        sb.AppendLine("<outroEndEasePercentage>" + outroEndEasePercentage + "</outroEndEasePercentage>");
        sb.AppendLine(XMLVariableConverter.ToXML(introCurve, "introCurve"));
        sb.AppendLine(XMLVariableConverter.ToXML(outroCurve, "outroCurve"));
        return(sb.ToString());
    }
Пример #4
0
    public virtual void FromXML(XmlNode node)
    {
        if (node["pointName"] != null)
        {
            pointName = node["pointName"].FirstChild.Value;
        }
//        baseTransform = GameObject.Find(node["baseTransform"].FirstChild.Value).transform;
        _position                  = XMLVariableConverter.FromXMLVector3(node["position"]);
        _width                     = float.Parse(node["_width"].FirstChild.Value);
        _crownAngle                = float.Parse(node["_crownAngle"].FirstChild.Value);
        _splitControlPoints        = bool.Parse(node["_splitControlPoints"].FirstChild.Value);
        _forwardControlPoint       = XMLVariableConverter.FromXMLVector3(node["_forwardControlPoint"]);
        _backwardControlPoint      = XMLVariableConverter.FromXMLVector3(node["_backwardControlPoint"]);
        _leftTrackBoundary         = XMLVariableConverter.FromXMLVector3(node["_leftTrackBoundary"]);
        _leftForwardControlPoint   = XMLVariableConverter.FromXMLVector3(node["_leftForwardControlPoint"]);
        _leftBackwardControlPoint  = XMLVariableConverter.FromXMLVector3(node["_leftBackwardControlPoint"]);
        _leftSplitControlPoints    = bool.Parse(node["_leftSplitControlPoints"].FirstChild.Value);
        _rightTrackBoundary        = XMLVariableConverter.FromXMLVector3(node["_rightTrackBoundary"]);
        _rightForwardControlPoint  = XMLVariableConverter.FromXMLVector3(node["_rightForwardControlPoint"]);
        _rightBackwardControlPoint = XMLVariableConverter.FromXMLVector3(node["_rightBackwardControlPoint"]);
        _leftSplitControlPoints    = bool.Parse(node["_leftSplitControlPoints"].FirstChild.Value);
        _trackDirection            = XMLVariableConverter.FromXMLVector3(node["_trackDirection"]);
        if (node["_trackUpQ"] != null)
        {
            _trackUpQ = XMLVariableConverter.FromXMLQuaternion(node["_trackUpQ"]);
        }
        _trackCross    = XMLVariableConverter.FromXMLVector3(node["_trackCross"]);
        shouldReRender = bool.Parse(node["shouldReRender"].FirstChild.Value);
        //lastPoint and nextPoint are set in track class
        arcLength = float.Parse(node["arcLength"].FirstChild.Value);
        if (node["_render"] != null)
        {
            _render             = bool.Parse(node["_render"].FirstChild.Value);
            _renderBounds       = bool.Parse(node["_renderBounds"].FirstChild.Value);
            _trackCollider      = bool.Parse(node["_trackCollider"].FirstChild.Value);
            _extrudeTrack       = bool.Parse(node["_extrudeTrack"].FirstChild.Value);
            _extrudeLength      = float.Parse(node["_extrudeLength"].FirstChild.Value);
            _extrudeTrackBottom = bool.Parse(node["_extrudeTrackBottom"].FirstChild.Value);
            _extrudeCurveEnd    = bool.Parse(node["_extrudeCurveEnd"].FirstChild.Value);
            _extrudeBevel       = float.Parse(node["_extrudeBevel"].FirstChild.Value);
            generateBumpers     = bool.Parse(node["generateBumpers"].FirstChild.Value);
            _boundaryHeight     = float.Parse(node["boundaryHeight"].FirstChild.Value);
        }
        trackTextureStyleIndex    = int.Parse(node["trackTextureStyleIndex"].FirstChild.Value);
        offroadTextureStyleIndex  = int.Parse(node["offroadTextureStyleIndex"].FirstChild.Value);
        boundaryTextureStyleIndex = int.Parse(node["boundaryTextureStyleIndex"].FirstChild.Value);
        bumperTextureStyleIndex   = int.Parse(node["bumperTextureStyleIndex"].FirstChild.Value);
        if (node["bottomTextureStyleIndex"] != null)
        {
            bottomTextureStyleIndex = int.Parse(node["bottomTextureStyleIndex"].FirstChild.Value);
        }
    }
Пример #5
0
    public virtual string ToXML()
    {
        StringBuilder sb = new StringBuilder();

        sb.AppendLine("<trackpoint>");
        sb.AppendLine("<pointName>" + pointName + "</pointName>");
        sb.AppendLine("<baseTransform>" + baseTransform.name + "</baseTransform>");
        sb.AppendLine(XMLVariableConverter.ToXML(_position, "position"));//  "<RENAME>" + _position + "<RENAME>");
        sb.AppendLine("<_width>" + _width + "</_width>");
        sb.AppendLine("<_crownAngle>" + _crownAngle + "</_crownAngle>");
        sb.AppendLine("<_splitControlPoints>" + _splitControlPoints + "</_splitControlPoints>");
        sb.AppendLine(XMLVariableConverter.ToXML(_forwardControlPoint, "_forwardControlPoint"));             // + _forwardControlPoint + "<RENAME>");
        sb.AppendLine(XMLVariableConverter.ToXML(_backwardControlPoint, "_backwardControlPoint"));           // + _backwardControlPoint + "<RENAME>");
        sb.AppendLine(XMLVariableConverter.ToXML(_leftTrackBoundary, "_leftTrackBoundary"));                 // _leftTrackBoundary + "<RENAME>");
        sb.AppendLine(XMLVariableConverter.ToXML(_leftForwardControlPoint, "_leftForwardControlPoint"));     // _leftForwardControlPoint + "<RENAME>");
        sb.AppendLine(XMLVariableConverter.ToXML(_leftBackwardControlPoint, "_leftBackwardControlPoint"));   // _leftBackwardControlPoint + "<RENAME>");
        sb.AppendLine("<_leftSplitControlPoints>" + _leftSplitControlPoints + "</_leftSplitControlPoints>");
        sb.AppendLine(XMLVariableConverter.ToXML(_rightTrackBoundary, "_rightTrackBoundary"));               // _rightTrackBoundary + "<RENAME>");
        sb.AppendLine(XMLVariableConverter.ToXML(_rightForwardControlPoint, "_rightForwardControlPoint"));   // _rightForwardControlPoint + "<RENAME>");
        sb.AppendLine(XMLVariableConverter.ToXML(_rightBackwardControlPoint, "_rightBackwardControlPoint")); // _rightBackwardControlPoint + "<RENAME>");
        sb.AppendLine("<_rightSplitControlPoints>" + _rightSplitControlPoints + "</_rightSplitControlPoints>");
        sb.AppendLine(XMLVariableConverter.ToXML(_trackDirection, "_trackDirection"));                       // _trackDirection + "<RENAME>");
        sb.AppendLine(XMLVariableConverter.ToXML(_trackUpQ, "_trackUpQ"));                                   //+ _trackUpQ + "<RENAME>");
        sb.AppendLine(XMLVariableConverter.ToXML(_trackCross, "_trackCross"));                               // _trackCross + "<RENAME>");
        sb.AppendLine("<shouldReRender>" + shouldReRender + "</shouldReRender>");
        //Curve Variables
        sb.AppendLine("<lastPoint>" + lastPoint.pointName + "</lastPoint>");
        sb.AppendLine("<nextPoint>" + nextPoint.pointName + "</nextPoint>");
        sb.AppendLine("<arcLength>" + arcLength + "</arcLength>");
        sb.AppendLine("<_render>" + _render + "</_render>");
        sb.AppendLine("<_renderBounds>" + _renderBounds + "</_renderBounds>");
        sb.AppendLine("<_trackCollider>" + _trackCollider + "</_trackCollider>");
        sb.AppendLine("<_extrudeTrack>" + _extrudeTrack + "</_extrudeTrack>");
        sb.AppendLine("<_extrudeLength>" + _extrudeLength + "</_extrudeLength>");
        sb.AppendLine("<_extrudeTrackBottom>" + _extrudeTrackBottom + "</_extrudeTrackBottom>");
        sb.AppendLine("<_extrudeCurveEnd>" + _extrudeCurveEnd + "</_extrudeCurveEnd>");
        sb.AppendLine("<_extrudeBevel>" + _extrudeBevel + "</_extrudeBevel>");
        sb.AppendLine("<generateBumpers>" + generateBumpers + "</generateBumpers>");
        sb.AppendLine("<boundaryHeight>" + _boundaryHeight + "</boundaryHeight>");
        sb.AppendLine("<trackTextureStyleIndex>" + trackTextureStyleIndex + "</trackTextureStyleIndex>");
        sb.AppendLine("<offroadTextureStyleIndex>" + offroadTextureStyleIndex + "</offroadTextureStyleIndex>");
        sb.AppendLine("<boundaryTextureStyleIndex>" + boundaryTextureStyleIndex + "</boundaryTextureStyleIndex>");
        sb.AppendLine("<bumperTextureStyleIndex>" + bumperTextureStyleIndex + "</bumperTextureStyleIndex>");
        sb.AppendLine("<bottomTextureStyleIndex>" + bottomTextureStyleIndex + "</bottomTextureStyleIndex>");
        sb.AppendLine("</trackpoint>");
        return(sb.ToString());
    }
Пример #6
0
    public virtual string ToXML()
    {
        StringBuilder sb = new StringBuilder();

        sb.AppendLine("<texture>");
        sb.AppendLine("<customName>" + customName + "</customName>");
        sb.AppendLine("<tiled>" + tiled + "</tiled>");
        sb.AppendLine("<patterned>" + patterned + "</patterned>");
        sb.AppendLine("<flipped>" + flipped + "</flipped>");
        sb.AppendLine("<type>" + type + "</type>");
        sb.AppendLine(XMLVariableConverter.ToXML(_tileUnitUV, "_tileUnitUV"));
        sb.AppendLine(XMLVariableConverter.ToXML(_textureUnitSize, "_textureUnitSize"));
        sb.AppendLine("<tiledX>" + tiledX + "</tiledX>");
        sb.AppendLine("<tiledY>" + tiledY + "</tiledY>");
        sb.AppendLine(XMLVariableConverter.ToXML(maxUVTile, "maxUVTile"));
        sb.AppendLine(XMLVariableConverter.ToXML(minWorldUnits, "minWorldUnits"));
        sb.AppendLine(XMLVariableConverter.ToXML(maxWorldUnits, "maxWorldUnits"));
        sb.AppendLine("<_proceduralMaterial>" + AssetDatabase.GetAssetPath(_proceduralMaterial) + "</_proceduralMaterial>");
        sb.AppendLine("<_userMaterial>" + AssetDatabase.GetAssetPath(_userMaterial) + "</_userMaterial>");
        sb.AppendLine("<texture>" + AssetDatabase.GetAssetPath(material.mainTexture) + "</texture>");
        sb.AppendLine(XMLVariableConverter.ToXML(material.color, "color"));
        sb.AppendLine("</texture>");
        return(sb.ToString());
    }
Пример #7
0
    public virtual void FromXML(XmlNode node)
    {
        material = new Material(Shader.Find("Diffuse"));
        if (node["customName"] != null)
        {
            customName = node["customName"].FirstChild.Value;
        }
        tiled     = bool.Parse(node["tiled"].FirstChild.Value);
        patterned = bool.Parse(node["patterned"].FirstChild.Value);
        flipped   = bool.Parse(node["flipped"].FirstChild.Value);
        if (node["type"] != null)
        {
            type = (Types)System.Enum.Parse(typeof(Types), node["type"].FirstChild.Value);
        }
        _tileUnitUV      = XMLVariableConverter.FromXMLVector2(node["_tileUnitUV"]);
        _textureUnitSize = XMLVariableConverter.FromXMLVector2(node["_textureUnitSize"]);
        tiledX           = int.Parse(node["tiledX"].FirstChild.Value);
        tiledY           = int.Parse(node["tiledY"].FirstChild.Value);
        maxUVTile        = XMLVariableConverter.FromXMLVector2(node["maxUVTile"]);
        minWorldUnits    = XMLVariableConverter.FromXMLVector2(node["minWorldUnits"]);
        maxWorldUnits    = XMLVariableConverter.FromXMLVector2(node["maxWorldUnits"]);

        ProceduralMaterial loadedProcedualMaterial = null;

        if (node["_proceduralMaterial"] != null)
        {
            if (node["_proceduralMaterial"].HasChildNodes)
            {
                loadedProcedualMaterial = (ProceduralMaterial)AssetDatabase.LoadAssetAtPath(node["_proceduralMaterial"].FirstChild.Value, typeof(ProceduralMaterial));
            }
        }
        if (loadedProcedualMaterial != null)
        {
            _proceduralMaterial = loadedProcedualMaterial;
        }

        Material loadedMaterial = null;

        if (node["_userMaterial"] != null)
        {
            if (node["_userMaterial"].HasChildNodes)
            {
                loadedMaterial = (Material)AssetDatabase.LoadAssetAtPath(node["_userMaterial"].FirstChild.Value, typeof(Material));
            }
        }
        if (loadedMaterial != null)
        {
            _userMaterial = loadedMaterial;
        }


        if (node["texture"].HasChildNodes)
        {
            material.mainTexture = (Texture2D)AssetDatabase.LoadAssetAtPath(node["texture"].FirstChild.Value, typeof(Texture2D));
        }

        if (node["color"].HasChildNodes)
        {
            material.color = XMLVariableConverter.FromXMLtoColour(node["color"]);
        }
    }