コード例 #1
0
 public void Update(StMyPos pos, CharacterProtagonist player)
 {
     if ((pos.x < (BoundaryX - 1)) && (pos.y < (BoundaryY - 1)) && ((pos.x * pos.y) != 0))
     {
         // System.Console.WriteLine($"{pos.x}, {pos.y}");
         maps[player.Pos.x, player.Pos.y] = char.MinValue;
         player.Pos         = pos;
         maps[pos.x, pos.y] = player.Name;
     }
 }
コード例 #2
0
        public bool CheckNextStepStatus(StMyPos pos)
        {
            // 检查下一步的活动, 行动, 打怪, 拾取等
            var nextStep = maps[pos.x, pos.y];

            // switch(nextStep)
            // {
            // case (char)AllTypes.road.ToString():
            // System.Console.WriteLine("可走");
            // break;
            // }

            if (maps[pos.x, pos.y] != char.MinValue)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #3
0
        public StMyPos MoveBehavior(StMyPos pos)
        {
            key = Console.ReadKey();

            if (key.Key == ConsoleKey.UpArrow)//获取输入,并改变玩家的坐标
            {
                pos.x -= 1;
            }
            else if (key.Key == ConsoleKey.DownArrow)
            {
                pos.x += 1;
            }
            else if (key.Key == ConsoleKey.LeftArrow)
            {
                pos.y -= 1;
            }
            else if (key.Key == ConsoleKey.RightArrow)
            {
                pos.y += 1;
            }

            return(pos);
        }
コード例 #4
0
 public StMyPos MoveBehavior(StMyPos pos)
 {
     // throw new System.NotImplementedException();
     return(pos);
 }