示例#1
0
        private static void CreateTestSoldier()
        {
            var bank = new PlayerUnitTextureBank();

            Spritesheet     ss   = AssetRegistry.TEST_ENTITY;
            SpriteAnimation idle = new SpriteAnimation()
                                   .SetLoop(true)
                                   .SetPingPong(true);

            idle.AddFrame(ss.GetSpriteAt(0, 0), 200);
            idle.AddFrame(ss.GetSpriteAt(1, 0), 200);
            idle.AddFrame(ss.GetSpriteAt(2, 0), 200);
            bank.AddAnimation(PlayerUnitAnimationType.Idle, idle);

            Register(PlayerUnitType.TestSoldier, bank);
        }
        private static SpriteAnimation CreateAnimation(params Point[] tilesetCoord)
        {
            SpriteAnimation animation = new SpriteAnimation();

            foreach (Point coord in tilesetCoord)
            {
                Sprite tileSprite = AssetRegistry.TILESET.GetSpriteAt(coord.X, coord.Y);
                animation.AddFrame(tileSprite, 1000);
            }
            return(animation);
        }