Пример #1
0
        public void moveplayer(player p, ConsoleKeyInfo click)
        {
            switch (click.Key)
            {
            case ConsoleKey.W:
            case ConsoleKey.UpArrow:
                if (inme[inme.IndexOf(p)].location[0] != 0)
                {
                    if (layuot[p.location[0] - 1, p.location[1]] == "$")
                    {
                        getpoints(1);
                    }
                    if (layuot[p.location[0] - 1, p.location[1]] == "%")
                    {
                        getpoints(3);
                    }
                    updatemap(p.location[0], p.location[1], "*");
                    inme[inme.IndexOf(p)].location[0] -= 1;
                }
                break;

            case ConsoleKey.S:
            case ConsoleKey.DownArrow:
                if (inme[inme.IndexOf(p)].location[0] + 1 != layuot.GetLength(0))
                {
                    if (layuot[p.location[0] + 1, p.location[1]] == "$")
                    {
                        getpoints(1);
                    }
                    if (layuot[p.location[0] + 1, p.location[1]] == "%")
                    {
                        getpoints(3);
                    }
                    updatemap(p.location[0], p.location[1], "*");
                    inme[inme.IndexOf(p)].location[0] += 1;
                }
                break;

            case ConsoleKey.A:
            case ConsoleKey.LeftArrow:
                if (inme[inme.IndexOf(p)].location[1] != 0)
                {
                    if (layuot[p.location[0], p.location[1] - 1] == "$")
                    {
                        getpoints(1);
                    }
                    if (layuot[p.location[0], p.location[1] - 1] == "%")
                    {
                        getpoints(3);
                    }
                    updatemap(p.location[0], p.location[1], "*");
                    inme[inme.IndexOf(p)].location[1] -= 1;
                }
                break;

            case ConsoleKey.D:
            case ConsoleKey.RightArrow:
                if (inme[inme.IndexOf(p)].location[1] + 1 != layuot.GetLength(1))
                {
                    if (layuot[p.location[0], p.location[1] + 1] == "$")
                    {
                        getpoints(1);
                    }
                    if (layuot[p.location[0], p.location[1] + 1] == "%")
                    {
                        getpoints(3);
                    }
                    updatemap(p.location[0], p.location[1], "*");
                    inme[inme.IndexOf(p)].location[1] += 1;
                }
                break;
            }
            updatemap(p.location[0], p.location[1], p.icon.ToString());
        }
Пример #2
0
 public void playerleaves(player leaving)
 {
     inme.Remove(leaving);
     updatemap(leaving.location[0], leaving.location[1], "*");
 }