/// <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;
                }

                case "bone":
                {
                    var bone = new An8Bone();
                    bone.ParseTokens(chunk.Tokens);
                    this.RootBone = bone;
                    break;
                }
                }
            }
        }
Пример #2
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 "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);
            }
        }