Esempio n. 1
0
        public virtual void move(Tile.DIRECTIONS direction)
        {
            SetFacing(direction);
            myTile.Redraw();

            if (myTile.myNeighbours[(int)direction] != null)
            {
                //Box Push Start here
                if (myTile.myNeighbours[(int)direction].MyUnit.pushable == true)
                {
                    //myTile.myNeighbours[(int)direction].Possible_moves();
                    if (Check_Box_Row(myTile, (int)direction) == true)
                    {
                        for (int b = _tiles_to_swap.Count() - 1; b >= 0; b--)
                        {
                            Swap_MyUnit(_tiles_to_swap[b], _tiles_to_swap[b].myNeighbours[(int)direction]);
                        }
                        Swap_MyUnit(myTile, myTile.myNeighbours[(int)direction]);
                        this.myTile = myTile.myNeighbours[(int)direction];
                    }
                }
                //Box push ends here
                else if (myTile.myNeighbours[(int)direction].MyUnit.allow_move == true)
                {
                    //executemovement
                    Swap_MyUnit(myTile, myTile.myNeighbours[(int)direction]);
                    this.myTile = myTile.myNeighbours[(int)direction];
                }
            }
            _tiles_to_swap.Clear();
        }
Esempio n. 2
0
        private List <Tile> _tiles_to_swap = new List <Tile>(); /// tiles_to_swap is used to swap the unit on the tile in the direction with the current tile


        public Hero(Tile spawnTile)
        {
            myTile = spawnTile;

            allow_move = false;
            pushable   = false;

            myImage = Image.FromFile(@"..\..\Resources\Hero.png");
            _facing = Tile.DIRECTIONS.BOTTOM;

            _heroSprites[0] = Image.FromFile(@"..\..\Resources\HeroSprites\HeroLeft.png");
            _heroSprites[1] = Image.FromFile(@"..\..\Resources\HeroSprites\HeroRight.png");
            _heroSprites[2] = Image.FromFile(@"..\..\Resources\HeroSprites\HeroUp.png");
            _heroSprites[3] = Image.FromFile(@"..\..\Resources\HeroSprites\Hero.png");
        }
Esempio n. 3
0
 public void SetFacing(Tile.DIRECTIONS LastFace)
 {
     _facing = LastFace;
     myImage = _heroSprites[(int)LastFace];
 }
Esempio n. 4
0
 /// <summary>
 /// Move handler of the villain.
 /// </summary>
 /// <param name="thisTile">The tile the villain is on</param>
 /// <param name="direction"></param>
 public override void move(Tile.DIRECTIONS direction)
 {
     Swap_MyUnit(myTile, myTile.myNeighbours[(int)direction]);
     myTile = myTile.myNeighbours[(int)direction];
 }