Пример #1
0
        /// <summary>
        /// Serializes the <see cref="InkContent"/> object to Xml in a format
        /// suitable for import into OneNote.
        /// </summary>
        /// <param name="parentNode">
        /// A reference to the parent XML node that we should serialize ourselves
        /// as a child of.
        /// </param>
        protected internal override void SerializeToXml(XmlNode parentNode)
        {
            XmlDocument xmlDocument = parentNode.OwnerDocument;

            XmlElement ink = xmlDocument.CreateElement("Ink");

            parentNode.AppendChild(ink);

            InkData.SerializeToXml(ink);
        }
Пример #2
0
    private void ReadDataToAffectors(string path)
    {
        string  jsonString = File.ReadAllText(path);
        InkData character  = JsonUtility.FromJson <InkData>(jsonString);

        AffectorCounts = character.inks.Length / 3;
        _affectors     = new ParticleFlock.BoidAffector[AffectorCounts];
        for (int i = 0; i < AffectorCounts; i++)
        {
            int   xIndex = i * 3;
            int   yIndex = i * 3 + 1;
            int   zIndex = i * 3 + 2;
            float xPos   = character.inks[xIndex];
            float yPos   = character.inks[yIndex];
            //float zPos = character.inks[zIndex];
            Vector3 position = new Vector3(xPos, yPos, 0);
            var     affector = new ParticleFlock.BoidAffector();
            affector.position = position;
            affector.force    = 0;
            _affectors[i]     = affector;
        }
    }