public GameKey(GameKey klic, int x, int y)
 {
     this.index = klic.index;
     Cell = new Point(x, y);
     Position = Session.FrontMap.CellToVector(Cell) + Session.Camera.Position;
     animatedSprite = klic.animatedSprite;
 }
 public Hero(int x, int y, AnimatedSprite animatedSprite)
     : base(x, y)
 {
     keys = new List<int>();
     units = new List<Unit>();
     Sprite = animatedSprite;
 }
 public GameKey(int index, AnimatedSprite sprite, int x, int y)
 {
     this.index = index;
     Cell = new Point(x, y);
     Position = Session.FrontMap.CellToVector(Cell) + Session.Camera.Position;
     animatedSprite = sprite;
     animatedSprite.IsAnimating = true;
 }
 /// <summary>
 /// Slouzi pro deserializaci(nacteni)
 /// </summary>
 /// <param name="hero"></param>
 /// <param name="animatedSprite"></param>
 public Hero(Hero hero, AnimatedSprite animatedSprite)
 {
     keys = new List<int>();
     units = new List<Unit>();
     Gender = hero.Gender;
     Cell.X = hero.Cell.X;
     Cell.Y = hero.Cell.Y;
     Position = hero.Position;
     Direction = hero.Direction;
     Sprite = animatedSprite;
     Sprite.Position = Position;
     keys = hero.keys;
 }
 public Unit(
     string name,
     int attack,
     int defense,
     AnimatedSprite animatedSprite,
     int x,
     int y,
     AttributePair atribut)
     : base(attack, defense, animatedSprite, x, y)
 {
     Name = name;
     isInHero = false;
     HitPoints = atribut;
 }
 public Character(
 int attack,
 int defense,
 AnimatedSprite sprite,
     int x,
     int y)
 {
     Attack = attack;
     Defense = defense;
     animatedSprite = sprite;
     animatedSprite.IsAnimating = true;
     HitPoints = new AttributePair();
     Cell = new Point(x, y);
     Position = Session.FrontMap.CellToVector(Cell) + Session.Camera.Position;
 }
        /// <summary>
        /// Nacteni hrdinovejch textur a animaci
        /// </summary>
        /// <param name="gender"></param>
        public static void LoadHeroSprite(string gender)
        {
            //Nahrani hera
            #region Hero load
            Texture2D playerTexture;
            if (gender == "Male")
                playerTexture = GameRef.Content.Load<Texture2D>(@"Sprites\malefighter");
            else
                playerTexture = GameRef.Content.Load<Texture2D>(@"Sprites\femalefighter");

            Dictionary<AnimationKey, Animation>  animations = new Dictionary<AnimationKey, Animation>();
            Animation animation = new Animation(3, 32, 32, 0, 0);
            animations.Add(AnimationKey.Down, animation);
            animation = new Animation(3, 32, 32, 0, 32);
            animations.Add(AnimationKey.Left, animation);
            animation = new Animation(3, 32, 32, 0, 64);
            animations.Add(AnimationKey.Right, animation);
            animation = new Animation(3, 32, 32, 0, 96);
            animations.Add(AnimationKey.Up, animation);
            playerSpriteHero = new AnimatedSprite(playerTexture, animations);
            playerSpriteHero.IsAnimating = false;

            #endregion
        }
 /// <summary>
 /// Nacteni vsech textur a animaci jednotek
 /// </summary>
 public static void LoadBases()
 {
     List<AnimatedSprite> sprites = new List<AnimatedSprite>();
     baseUnits = new Dictionary<string, Unit>();
     baseKeys = new Dictionary<int, GameKey>();
     for (int k = 0; k < 3; k++)
     {
         for (int i = 0; i < 10; i++)
         {
             AnimatedSprite sprite;
             Dictionary<AnimationKey, Animation> animations = new Dictionary<AnimationKey, Animation>();
             Animation animation;
             animation = new Animation(2, 32, 32, i * 64, k * 128 + 0);
             animations.Add(AnimationKey.Up, animation);
             animation = new Animation(2, 32, 32, i * 64, k * 128 + 32);
             animations.Add(AnimationKey.Right, animation);
             animation = new Animation(2, 32, 32, i * 64, k * 128 + 64);
             animations.Add(AnimationKey.Down, animation);
             animation = new Animation(2, 32, 32, i * 64, k * 128 + 96);
             animations.Add(AnimationKey.Left, animation);
             sprite = new AnimatedSprite(charTexture, animations);
             sprites.Add(sprite);
         }
     }
     for (int i = 0; i < 4; i++)
     {
         AnimatedSprite sprite;
         Dictionary<AnimationKey, Animation> animations = new Dictionary<AnimationKey, Animation>();
         Animation animation;
         animation = new Animation(4, 32, 32, 0, i * 32);
         animations.Add(AnimationKey.Down, animation);
         sprite = new AnimatedSprite(keyTexture, animations);
         sprites.Add(sprite);
     }
     baseUnits.Add("zena1", new Unit("zena1", 0, 0, sprites[0], 0, 0, new AttributePair(50)));
     baseUnits.Add("zena2", new Unit("zena2", 0, 0, sprites[1], 0, 0, new AttributePair(50)));
     baseUnits.Add("kaspar", new Unit("kaspar", 0, 0, sprites[2], 0, 0, new AttributePair(50)));
     baseUnits.Add("vdova", new Unit("vdova", 0, 0, sprites[3], 0, 0, new AttributePair(50)));
     baseUnits.Add("cernokneznik", new Unit("cernokneznik", 0, 0, sprites[4], 0, 0, new AttributePair(50)));
     baseUnits.Add("hunac", new Unit("hunac", 0, 0, sprites[5], 0, 0, new AttributePair(50)));
     baseUnits.Add("sliz", new Unit("sliz", 0, 0, sprites[6], 0, 0, new AttributePair(50)));
     baseUnits.Add("krab", new Unit("krab", 0, 0, sprites[7], 0, 0, new AttributePair(50)));
     baseUnits.Add("motyl", new Unit("motyl", 0, 0, sprites[8], 0, 0, new AttributePair(50)));
     baseUnits.Add("ptak", new Unit("ptak", 0, 0, sprites[9], 0, 0, new AttributePair(50)));
     baseUnits.Add("hroch", new Unit("hroch", 0, 0, sprites[10], 0, 0, new AttributePair(50)));
     baseUnits.Add("moucha", new Unit("moucha", 0, 0, sprites[11], 0, 0, new AttributePair(50)));
     baseUnits.Add("moucha1", new Unit("moucha", 0, 0, sprites[11], 0, 0, new AttributePair(50)));
     baseUnits.Add("moucha2", new Unit("moucha", 0, 0, sprites[11], 0, 0, new AttributePair(50)));
     baseUnits.Add("hydra", new Unit("hydra", 0, 0, sprites[12], 0, 0, new AttributePair(50)));
     baseUnits.Add("srdce", new Unit("srdce", 0, 0, sprites[13], 0, 0, new AttributePair(50)));
     baseUnits.Add("rohac", new Unit("rohac", 0, 0, sprites[14], 0, 0, new AttributePair(50)));
     baseUnits.Add("zena3", new Unit("zena3", 0, 0, sprites[15], 0, 0, new AttributePair(50)));
     baseUnits.Add("bilokneznik", new Unit("bilokneznik", 0, 0, sprites[16], 0, 0, new AttributePair(50)));
     baseUnits.Add("meduza", new Unit("meduza", 0, 0, sprites[17], 0, 0, new AttributePair(50)));
     baseUnits.Add("meduzak", new Unit("meduzak", 0, 0, sprites[18], 0, 0, new AttributePair(50)));
     baseUnits.Add("smrt", new Unit("smrt", 15, 10, sprites[19], 0, 0, new AttributePair(50)));
     baseUnits.Add("lizard1", new Unit("lizard1", 0, 0, sprites[20], 0, 0, new AttributePair(50)));
     baseUnits.Add("lizard2", new Unit("lizard2", 0, 0, sprites[21], 0, 0, new AttributePair(50)));
     baseUnits.Add("demon", new Unit("demon", 0, 0, sprites[22], 0, 0, new AttributePair(50)));
     baseUnits.Add("pes", new Unit("pes", 0, 0, sprites[23], 0, 0, new AttributePair(50)));
     baseUnits.Add("kytka", new Unit("kytka", 0, 0, sprites[24], 0, 0, new AttributePair(50)));
     baseUnits.Add("kostlivec", new Unit("kostlivec", 0, 0, sprites[25], 0, 0, new AttributePair(50)));
     baseUnits.Add("poutnik", new Unit("poutnik", 0, 0, sprites[26], 0, 0, new AttributePair(50)));
     baseUnits.Add("drak", new Unit("drak", 0, 0, sprites[27], 0, 0, new AttributePair(50)));
     baseUnits.Add("diamant", new Unit("diamant", 0, 0, sprites[28], 0, 0, new AttributePair(50)));
     baseUnits.Add("kentaur", new Unit("kentaur", 0, 0, sprites[29], 0, 0, new AttributePair(50)));
     baseKeys.Add(1, new GameKey(1, sprites[30], 0, 0));
     baseKeys.Add(2, new GameKey(2, sprites[31], 0, 0));
     baseKeys.Add(3, new GameKey(3, sprites[32], 0, 0));
     baseKeys.Add(4, new GameKey(4, sprites[33], 0, 0));
 }
        /// <summary>
        /// Naklonovani animaci a celeho objektu
        /// </summary>
        /// <returns></returns>
        public object Clone()
        {
            Dictionary<AnimationKey, Animation> anim = new Dictionary<AnimationKey, Animation>();
            anim.Add(AnimationKey.Down, (Animation)animations[AnimationKey.Down].Clone());
            anim.Add(AnimationKey.Up, (Animation)animations[AnimationKey.Up].Clone());
            anim.Add(AnimationKey.Left, (Animation)animations[AnimationKey.Left].Clone());
            anim.Add(AnimationKey.Right, (Animation)animations[AnimationKey.Right].Clone());

            AnimatedSprite animationClone = new AnimatedSprite(this.texture, anim);
            return animationClone;
        }