コード例 #1
0
ファイル: TextureProvider.cs プロジェクト: nezek6/Wizardry
 public AnimationTexture GetTexture(string name)
 {
     if (animationTextures.ContainsKey(name)){
         return animationTextures[name];
     }
     Texture2D texture = content.Load<Texture2D>(name);
     Color[,] colorArray = TextureTo2DArray(texture);
     AnimationTexture at = new AnimationTexture(texture, colorArray);
     animationTextures.Add(name, at);
     return at;
 }
コード例 #2
0
ファイル: Animation.cs プロジェクト: nezek6/Wizardry
 public Animation(AnimationTexture texture, int frameCount, int frametime, float scale, bool flip)
 {
     Initialize(texture, frameCount, frametime, scale, flip);
 }
コード例 #3
0
ファイル: Animation.cs プロジェクト: nezek6/Wizardry
        public void Initialize(AnimationTexture texture, int frameCount, int frametime, float scale, bool flip)
        {
            colorArray = texture.ColorArray;

            // Keep a local copy of the values passed in
            this.FrameWidth = texture.Texture.Width / frameCount;
            this.FrameHeight = texture.Texture.Height;
            this.frameCount = frameCount;
            this.frameTime = frametime;
            this.scale = scale;

            this.flip = flip;

            spriteStrip = texture.Texture;

            // Set the time to zero
            elapsedTime = 0;
            currentFrame = 0;
            biggestSide = Math.Max((frameWidth * scale), (frameHeight * scale));
            boundingBox = new Rectangle(0, 0, (int)(biggestSide), (int)(biggestSide));

            // Set the Animation to active by default
            Active = true;
        }