Beispiel #1
0
 protected void ObstructionNullCheck(Obstruction obstruction)
 {
     if (obstruction is null)
     {
         throw new ArgumentNullException($"{nameof(obstruction)} is null!");
     }
 }
Beispiel #2
0
        private static void Main(string[] args)
        {
            var field  = new Field(100, 100);
            var player = new Player(field, Point.Create(0, 0));

            var apple = new Bonus(field, Point.Create(3, 0), Bonus.Type.Apple);

            player.GoRight(3);
            player.TryGetBonus(field, apple);
            WinCheck(player, field);

            var bear = new Monster(field, Point.Create(2, 0), Monster.Type.Bear);

            player.GoLeft(1);
            player.TryMonsterEvent(bear);
            WinCheck(player, field);

            var stone = new Obstruction(field, Point.Create(2, 1), Obstruction.Type.Stone);

            player.GoUp(1);
            player.TryObstructionEvent(stone);
            WinCheck(player, field);

            var cherry = new Bonus(field, Point.Create(0, 1), Bonus.Type.Cherry);

            player.GoDown(2);
            player.TryGetBonus(field, cherry);
            WinCheck(player, field);
        }
Beispiel #3
0
        public void TryObstructionEvent(Obstruction obstruction)
        {
            ObstructionNullCheck(obstruction);

            if (IsOverlayed(this, obstruction))
            {
                SetStop();
            }
        }