public ResidentialHouse(GameWorld gameWorldRef, GamePlayer playerRef, Point Location)
            : base("building1", gameWorldRef, playerRef, Location)
        {
            // filling the occupied_cells_locations List
            // (the purpose is to make these cells not walkable)
            #region Occupied Cells Work
            int cells_east = 3, cells_west = 5;

            Point west_indexer = Location;
            Point east_indexer = Location;

            for (int i = 0; i < cells_west; i++)
            {
                for (int j = 0; j < cells_east; j++)
                {
                    OccupiedCellsLocations.Add(east_indexer);
                    east_indexer = east_indexer.WalkTo(Direction.NE);
                }
                west_indexer = west_indexer.WalkTo(Direction.NW);
                east_indexer = west_indexer;
            }

            // now set the Mapcells at locations found to be not walkable..
            foreach (var location in OccupiedCellsLocations)
            {
                MapRef.MapCellAt(location).Walkable = false;
            }
            #endregion

            // making smoke on the roof
            #region smoke
            smoke = new SpriteAnimation(GameGraphics.GetTexture("smoke").SourceTexture);
            smoke.AddAnimation("normal", 0, 0, 30, 64, 16, 0.15f);
            smoke.Position = Camera.WorldToScreen(new Vector2(this.BuildingOrigin.X + 65, this.BuildingOrigin.Y - 64 + 35));
            smoke.CurrentAnimation = "normal";
            smoke.DrawDepth = BuildingInfo.SmokeDrawDepth;
            smoke.IsAnimating = true;
            #endregion

            selectionGroup = GroupMapper.HouseGroup;

            SelectionLineTexture = GameGraphics.GetTexture("residence_selection_line");

            #region Setting Entity Properties
            MaxHealth = 500;
            MaxDefense = 100;
            MaxAttack = 0;

            Health = MaxHealth;
            Defense = MaxDefense;
            Attack = MaxAttack;
            #endregion
        }
        protected CreatureBase(string animationIdentifier, 
            int frameWidth, int frameHeight, int frames,
            GameWorld gameWorldRef, GamePlayer playerRef, Vector2 position, float animationSpeed)
        {
            PlayerRef = playerRef;
            GameWorldRef = gameWorldRef;
            _mapRef = gameWorldRef.Map ;

            // walking animation is unified in all creatures
            #region setting appropriate walking animation
            AnimationSet = GameGraphics.GetTexture(animationIdentifier);
            Animation = new SpriteAnimation(AnimationSet.SourceTexture);

            Animation.AddAnimation("Walk_E", 0, frameHeight * 0, frameWidth, frameHeight, frames, animationSpeed);
            Animation.AddAnimation("Walk_N", 0, frameHeight * 1, frameWidth, frameHeight, frames, animationSpeed);
            Animation.AddAnimation("Walk_NE", 0, frameHeight * 2, frameWidth, frameHeight, frames, animationSpeed);
            Animation.AddAnimation("Walk_NW", 0, frameHeight * 3, frameWidth, frameHeight, frames, animationSpeed);
            Animation.AddAnimation("Walk_S", 0, frameHeight * 4, frameWidth, frameHeight, frames, animationSpeed);
            Animation.AddAnimation("Walk_SE", 0, frameHeight * 5, frameWidth, frameHeight, frames, animationSpeed);
            Animation.AddAnimation("Walk_SW", 0, frameHeight * 6, frameWidth, frameHeight, frames, animationSpeed);
            Animation.AddAnimation("Walk_W", 0, frameHeight * 7, frameWidth, frameHeight, frames, animationSpeed);

            Animation.AddAnimation("Idle_E", 3 * frameWidth, frameHeight * 0, frameWidth, frameHeight, 1, 0.2f);
            Animation.AddAnimation("Idle_N", 3 * frameWidth, frameHeight * 1, frameWidth, frameHeight, 1, 0.2f);
            Animation.AddAnimation("Idle_NE", 3 * frameWidth, frameHeight * 2, frameWidth, frameHeight, 1, 0.2f);
            Animation.AddAnimation("Idle_NW", 3 * frameWidth, frameHeight * 3, frameWidth, frameHeight, 1, 0.2f);
            Animation.AddAnimation("Idle_S", 3 * frameWidth, frameHeight * 4, frameWidth, frameHeight, 1, 0.2f);
            Animation.AddAnimation("Idle_SE", 3 * frameWidth, frameHeight * 5, frameWidth, frameHeight, 1, 0.2f);
            Animation.AddAnimation("Idle_SW", 3 * frameWidth, frameHeight * 6, frameWidth, frameHeight, 1, 0.2f);
            Animation.AddAnimation("Idle_W", 3 * frameWidth, frameHeight * 7, frameWidth, frameHeight, 1, 0.2f);

            CurrentAnimation = "Idle_SE";

            Animation.IsAnimating = true;

            #endregion

            Position = position;
            _currentMoveDir = Vector2.Zero;
            _previousMovDir = Vector2.Zero;
            Distination = position;

            HealthStatusLine = new StatusLine(StatusLineType.Green);
            _healthStatusLineOffset = new Vector2(-13, -50);

            Actions = new ActionManager();
        }
        public TrainingCamp(GameWorld gameWorldRef, GamePlayer playerRef, Point Location)
            : base("building6", gameWorldRef, playerRef, Location)
        {
            // filling the occupied_cells_locations List
            // (the purpose is to make these cells not walkable)
            #region Occupied Cells Work

            const int cellsEast = 3;
            const int cellsWest = 4;

            Point westIndexer = Location;
            Point eastIndexer = Location;

            for (int i = 0; i < cellsWest; i++)
            {
                for (int j = 0; j < cellsEast; j++)
                {
                    OccupiedCellsLocations.Add(eastIndexer);
                    eastIndexer = eastIndexer.WalkTo(Direction.NE);
                }
                westIndexer = westIndexer.WalkTo(Direction.NW);
                eastIndexer = westIndexer;
            }

            // add the irregular occupied cells..
            Point indexer = Location;
            indexer = indexer.WalkTo(Direction.SW);
            indexer = indexer.WalkTo(Direction.NW);
            indexer = indexer.WalkTo(Direction.NW);
            OccupiedCellsLocations.Add(indexer);
            indexer = indexer.WalkTo(Direction.NW);
            OccupiedCellsLocations.Add(indexer);

            // now set the Mapcells at locations found to be not walkable..
            foreach (var location in OccupiedCellsLocations)
            {
                MapRef.MapCellAt(location).Walkable = false;
            }

            //setting depths of irregular occupied cells..
            float irregularDepth1;
            float irregularDepth2;
            indexer = Location.WalkTo(Direction.SW).WalkTo(Direction.NW).WalkTo(Direction.NW);
            irregularDepth1 = MapRef.MapCellAt(indexer).DrawDepth;
            indexer = indexer.WalkTo(Direction.NW);
            irregularDepth2 = MapRef.MapCellAt(indexer).DrawDepth;

            int segIndexer = (ImgSegmentsDepthsOrdered.Count / 2) - 3; // indexes segment no. 3 counting from middle segment leftwards
            SegDepth newSegment = new SegDepth(ImgSegmentsDepthsOrdered[segIndexer].SegRect, irregularDepth1);
            ImgSegmentsDepthsOrdered[segIndexer] = newSegment;
            segIndexer--;
            SegDepth newSegment2 = new SegDepth(ImgSegmentsDepthsOrdered[segIndexer].SegRect, irregularDepth1);
            ImgSegmentsDepthsOrdered[segIndexer] = newSegment2;
            segIndexer--;
            SegDepth newSegment3 = new SegDepth(ImgSegmentsDepthsOrdered[segIndexer].SegRect, irregularDepth2);
            ImgSegmentsDepthsOrdered[segIndexer] = newSegment3;
            #endregion

            #region Generating Custom Built Units Locations
               //remove last location
            BuiltUnitsLocations.RemoveAt(BuiltUnitsLocations.Count-1);
            //get the new last location
            var loc = BuiltUnitsLocations[BuiltUnitsLocations.Count-1];

            Vector2 cell = new Vector2(MapRef.WorldToMapCell(loc).X,
                    MapRef.WorldToMapCell(loc).Y);

            cell = cell.WalkTo(Direction.SW);
            BuiltUnitsLocations.Add(MapRef.MapCellAt(cell).CenterPosition);
            cell = cell.WalkTo(Direction.NW);
            BuiltUnitsLocations.Add(MapRef.MapCellAt(cell).CenterPosition);
            cell = cell.WalkTo(Direction.NW);
            BuiltUnitsLocations.Add(MapRef.MapCellAt(cell).CenterPosition);

            #endregion

            // making smoke on the roof
            #region smoke
            _smoke = new SpriteAnimation(GameGraphics.GetTexture("smoke").SourceTexture);
            _smoke.AddAnimation("normal", 0, 0, 30, 64, 16, 0.1f);
            _smoke.Position = Camera.WorldToScreen(new Vector2( this.BuildingOrigin.X+85, this.BuildingOrigin.Y-60));
            _smoke.CurrentAnimation = "normal";
            _smoke.DrawDepth = BuildingInfo.SmokeDrawDepth;
            _smoke.IsAnimating = true;
            #endregion

            selectionGroup = GroupMapper.CampGroup;

            SelectionLineTexture = GameGraphics.GetTexture("camp_selection_line");

            #region Setting Entity Properties
            MaxHealth = 800;
            MaxDefense = 300;
            MaxAttack = 0;

            Health = MaxHealth;
            Defense = MaxDefense;
            Attack = MaxAttack;
            #endregion
        }
 public MobileSprite(Texture2D texture)
 {
     asSprite = new SpriteAnimation(texture);
 }