Пример #1
0
        private TextureSequence ReadTextureSequence()
        {
            TextureSequence textureSequence = new TextureSequence();

            textureSequence.TextureFileName  = input.ReadString();
            textureSequence.IsUseStaticTime  = input.ReadBoolean();
            textureSequence.IsRepeat         = input.ReadBoolean();
            textureSequence.IsRandomMode     = input.ReadBoolean();
            textureSequence.IsFixedFrameMode = input.ReadBoolean();
            textureSequence.FrameWidth       = input.ReadSingle();
            textureSequence.FrameHeight      = input.ReadSingle();
            textureSequence.StaticInterval   = input.ReadSingle();
            textureSequence.Count            = input.ReadUInt32();
            textureSequence.StartIndex       = input.ReadUInt32();

            // read TimeTable structures.
            int timeTableCount = input.ReadInt32();

            if (timeTableCount > 0)
            {
                textureSequence.TimeTable = new List <float>();

                for (int i = 0; i < timeTableCount; i++)
                {
                    textureSequence.TimeTable.Add(input.ReadSingle());
                }
            }

            return(textureSequence);
        }
Пример #2
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="resourcePath">texture resource path</param>
        /// <param name="info">particle information structure</param>
        /// <param name="textureSequence">texture sequence class</param>
        public Particle(string resourcePath, ParticleInfo info, 
                        TextureSequence textureSequence) : base()
        {
            if (String.IsNullOrEmpty(resourcePath))
                throw new ArgumentNullException("resourcePath");
            if (info == null)
                throw new ArgumentNullException("info");

            this.sequenceInfo = info;            

            this.textureSequence = textureSequence;
            this.resourcePath = resourcePath;

            //  Create particle's scene root
            this.sceneRoot = new GameSceneNode();
            this.sceneRoot.Name = "Particle Scene Root";

            AddChild(this.sceneRoot);

            Create();
        }