Пример #1
0
    public override bool Equals(object obj)
    {
        if (!(obj is Weapon))
        {
            return(ReferenceEquals(this, obj));
        }
        Weapon weapon = obj as Weapon;

        return(Name.Equals(weapon.Name) &&
               Damage.Equals(weapon.Damage) &&
               Defense.Equals(weapon.Defense) &&
               BonusAttack.Equals(weapon.BonusAttack) &&
               BonusDefense.Equals(weapon.BonusDefense) &&
               GoalSize.Equals(weapon.GoalSize) &&
               GoalPos.Equals(weapon.GoalPos) &&
               TimerSpeed.Equals(weapon.TimerSpeed));
    }
Пример #2
0
        /// <summary>
        /// event of the maze board loading
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MazeBoard_Loaded(object sender, RoutedEventArgs e)
        {
            string[] startPos = InitialPos.Split(',');
            rowStartPos = Int32.Parse(startPos[0]);
            colStartPos = Int32.Parse(startPos[1]);
            string[] goalPos = GoalPos.Split(',');
            rowGoalPos = Int32.Parse(goalPos[0]);
            colGoalPos = Int32.Parse(goalPos[1]);

            rowPlayerPos = Int32.Parse(startPos[0]);
            colPlayerPos = Int32.Parse(startPos[1]);

            width  = myCanvas.Width / Cols;
            height = myCanvas.Height / Rows;
            int counter = 0;

            // drawing the board
            for (int i = 0; i < Rows; i++)
            {
                for (int j = 0; j < Cols; j++)
                {
                    Maze.Count();
                    if (Maze[counter] == '1')
                    {
                        AddWall(j, i);
                    }
                    if (i == rowStartPos && j == colStartPos)
                    {
                        AddImage(j, i, ImageSource, "Player");
                        initialIndexInMaze = counter;
                        indexInMaze        = counter;
                    }
                    if (i == rowGoalPos && j == colGoalPos)
                    {
                        AddImage(j, i, ExitImageFile, "Exit");
                        endOfGame = counter;
                    }

                    counter++;
                }
            }
        }