Example #1
0
        /// <summary>
        /// Parses the tokens of the chunk.
        /// </summary>
        /// <param name="tokens">The tokens.</param>
        internal override void ParseTokens(string[] tokens)
        {
            var chunks = Tokenizer.SplitChunks(tokens);

            foreach (var chunk in chunks)
            {
                int index = 0;

                switch (chunk.Ident)
                {
                case null:
                    this.Name = Tokenizer.ReadString(chunk.Tokens, ref index);
                    break;

                case "material":
                {
                    var material = new An8Material();
                    material.ParseTokens(chunk.Tokens);
                    this.Materials.Add(material);
                    break;
                }
                }
            }

            foreach (var component in An8Component.ParseComponents(tokens))
            {
                this.Components.Add(component);
            }
        }
        /// <summary>
        /// Parses the tokens of the chunk.
        /// </summary>
        /// <param name="tokens">The tokens.</param>
        internal override void ParseTokens(string[] tokens)
        {
            base.ParseTokens(tokens);

            foreach (var component in An8Component.ParseComponents(tokens))
            {
                this.Components.Add(component);
            }
        }
Example #3
0
        /// <summary>
        /// Parses the tokens of the chunk.
        /// </summary>
        /// <param name="tokens">The tokens.</param>
        internal override void ParseTokens(string[] tokens)
        {
            base.ParseTokens(tokens);

            var chunks = Tokenizer.SplitChunks(tokens);

            foreach (var chunk in chunks)
            {
                int index = 0;

                switch (chunk.Ident)
                {
                case "length":
                    this.Length = Tokenizer.ReadFloat(chunk.Tokens, ref index);
                    break;

                case "diameter":
                    this.Diameter = Tokenizer.ReadFloat(chunk.Tokens, ref index);
                    break;

                case "segments":
                    this.SegmentsCount = Tokenizer.ReadInt(chunk.Tokens, ref index);
                    break;

                case "method":
                {
                    var method = new An8Method();
                    method.ParseTokens(chunk.Tokens);
                    this.Method = method;
                    break;
                }
                }
            }

            this.Component = An8Component.ParseComponents(tokens).LastOrDefault();
        }
        /// <summary>
        /// Parses the tokens of the chunk.
        /// </summary>
        /// <param name="tokens">The tokens.</param>
        internal override void ParseTokens(string[] tokens)
        {
            var chunks = Tokenizer.SplitChunks(tokens);

            foreach (var chunk in chunks)
            {
                int index = 0;

                switch (chunk.Ident)
                {
                case null:
                    this.Name = Tokenizer.ReadString(chunk.Tokens, ref index);
                    break;

                case "length":
                    this.Length = Tokenizer.ReadFloat(chunk.Tokens, ref index);
                    break;

                case "diameter":
                    this.Diameter = Tokenizer.ReadFloat(chunk.Tokens, ref index);
                    break;

                case "orientation":
                    this.Orientation = An8Quaternion.ReadTokens(chunk.Tokens, ref index);
                    break;

                case "locked":
                    this.IsLocked = true;
                    break;

                case "dof":
                {
                    var dof = new An8DegreeOfFreedom();
                    dof.ParseTokens(chunk.Tokens);
                    this.DegreesOfFreedom.Add(dof);
                    break;
                }

                case "influence":
                {
                    var influence = new An8Influence();
                    influence.ParseTokens(chunk.Tokens);
                    this.Influence = influence;
                    break;
                }

                case "bone":
                {
                    var bone = new An8Bone();
                    bone.ParseTokens(chunk.Tokens);
                    this.Bones.Add(bone);
                    break;
                }
                }
            }

            foreach (var component in An8Component.ParseComponents(tokens))
            {
                this.Components.Add(component);
            }
        }