示例#1
0
 private void Collect_object()
 {
     if (items[_player.postionrow, _player.postioncol] != null)
     {
         if (items[_player.postionrow, _player.postioncol].ToString().Contains("Goldcheast"))
         {
             _player.upgrade(new Goldcheast());
         }
         else if (items[_player.postionrow, _player.postioncol].ToString().Contains("bronzecheast"))
         {
             _player.upgrade(new bronzecheast());
         }
         else if (items[_player.postionrow, _player.postioncol].ToString().Contains("silvercheast"))
         {
             _player.upgrade(new silvercheast());
         }
         else if (items[_player.postionrow, _player.postioncol].ToString().Contains("silvercheast"))
         {
             _player.upgrade(new silvercheast());
         }
         else if (items[_player.postionrow, _player.postioncol].ToString().Contains("1"))
         {
             Console.WriteLine("you collected Gold Key ...");
             items[_player.postionrow, _player.postioncol] = null;
             _player.Add_key(1);
         }
         else if (items[_player.postionrow, _player.postioncol].ToString().Contains("2"))
         {
             Console.WriteLine("you collected bronze Key ...");
             items[_player.postionrow, _player.postioncol] = null;
             _player.Add_key(2);
         }
         else if (items[_player.postionrow, _player.postioncol].ToString().Contains("3"))
         {
             Console.WriteLine("you collected Silver Key ...");
             items[_player.postionrow, _player.postioncol] = null;
             _player.Add_key(3);
         }
         else if (items[_player.postionrow, _player.postioncol].ToString().Contains("Enemy"))
         {
             Console.WriteLine("Enemy attcked ...");
             items[_player.postionrow, _player.postioncol] = null;
             _player.takedamge(_enemy);
         }
         else if (items[_player.postionrow, _player.postioncol].ToString().Contains("diamond"))
         {
             Console.WriteLine("You Collected The Hidden diamond You Won ...");
             items[_player.postionrow, _player.postioncol] = null;
         }
     }
     else
     {
         Console.WriteLine("Nothig Found ....");
     }
 }