示例#1
0
        //Debug fonction to see map evolution
        public void printMap()
        {
            int rowLength = map.GetLength(0);
            int colLength = map.GetLength(1);

            for (int i = 0; i < rowLength; i++)
            {
                for (int j = 0; j < colLength; j++)
                {
                    Adventurer test = AdventureCell.Find(adventurer => adventurer.x == j && adventurer.y == i);
                    if (test == null)
                    {
                        if (map[i, j] != null)
                        {
                            Console.Write(map[i, j].affCell());
                        }
                        else
                        {
                            Console.Write(string.Format("{0} ", /*map[i, j]*/ "   .   "));
                        }
                    }
                    else
                    {
                        Console.Write(test.affCell());
                    }
                }
                Console.Write(Environment.NewLine + Environment.NewLine);
            }
        }
示例#2
0
        public bool generateCell(String line)
        {
            string[] lineOpt = cleanStringOption(line);

            if (lineOpt[0] == "M")
            {
                map[Int32.Parse(lineOpt[2]), Int32.Parse(lineOpt[1])] = new MountainCell();
            }
            else if (lineOpt[0] == "T")
            {
                map[Int32.Parse(lineOpt[2]), Int32.Parse(lineOpt[1])] = new TreasureCell(Int32.Parse(lineOpt[3]));
            }
            else if (lineOpt[0] == "A")
            {
                Adventurer adventurer = new Adventurer(lineOpt[1], lineOpt[4], lineOpt[5], Int32.Parse(lineOpt[3]), Int32.Parse(lineOpt[2]));
                //map[Int32.Parse(lineOpt[3]), Int32.Parse(lineOpt[2])] = adventurer;
                AdventureCell.Add(adventurer);
            }
            return(true);
        }