Пример #1
0
 public void MoveParty(int dx,int dy)
 {
     Coordinates testLocation = new Coordinates(location.str_xy);
     testLocation.Delta(dx, dy);
     if (!GlobalVars.GMap.tLList[testLocation.x][testLocation.y].isWall) { location.Delta(dx, dy); }
     location.Delta(dx, dy);
 }
Пример #2
0
 //For party initialization at random location
 public Party(Map map, List<PlayerChar> chars)
 {
     foreach (PlayerChar p in chars) { PartyMembers.Add(p); }
     location = new Coordinates(map.openSpace[pRand.Next(0, map.openSpace.Count)].coord.str_xy);
 }
Пример #3
0
 //For when the location of the party has already been determined
 public Party(Coordinates start, List<PlayerChar> chars)
 {
     location = new Coordinates(start.str_xy);
     foreach(PlayerChar p in chars) { PartyMembers.Add(p); }
 }
Пример #4
0
 public void AddCoord(Coordinates otherCoord)
 {
     x = x + otherCoord.x;
     y = y + otherCoord.y;
     str_xy = ToStringPair(x, y);
 }
Пример #5
0
 public Tile(int x_in, int y_in)
 {
     coord = new Coordinates(x_in, y_in);
     for (int i = 0; i < 8; i++)
     {
         neighbors.Add(new Coordinates(x_in + direction_ops[i, 0], y_in + direction_ops[i, 1]));
     }
     x = coord.x;
     y = coord.y;
 }
Пример #6
0
        internal void InitDungeon(int xmax, int ymax, int steps)
        {
            Random rand = new Random();
            Coordinates startCoord = new Coordinates(rand.Next(1, xmax - 1), rand.Next(1, ymax - 1));
            Coordinates nextCoord = new Coordinates(startCoord.x, startCoord.y);
            int[] directionHelper = { -1, 0, 1 };
            int[] direction = { directionHelper[rand.Next(0, 3)], directionHelper[rand.Next(0, 3)] };
            //nextCoord.

            for (int i = 0; i < steps; i++)
            {
                int temp = rand.Next(1, 11);
                int[] dirModX = { 0, 3 };
                int[] dirModY = { 0, 3 };
                if (nextCoord.x == 1) { dirModX[0] = 1; }
                else if (nextCoord.x == xmax - 2) { dirModX[1] = 2; }
                else { dirModX[0] = 0; dirModX[1] = 3; }
                if (nextCoord.y == 1) { dirModY[0] = 1; }
                else if (nextCoord.y == ymax - 2) { dirModY[1] = 2; }
                else { dirModY[0] = 0; dirModY[1] = 3; }
                if (temp >= 8)
                {
                    direction[0] = directionHelper[rand.Next(dirModX[0], dirModX[1])];
                    direction[1] = directionHelper[rand.Next(dirModY[0], dirModY[1])];
                }
                if (nextCoord.x + direction[0] < 1 || nextCoord.x + direction[0] > xmax - 2) { continue; }
                if (nextCoord.y + direction[1] < 1 || nextCoord.y + direction[1] > ymax - 2) { continue; }
                nextCoord.x = nextCoord.x + direction[0];
                nextCoord.y = nextCoord.y + direction[1];
                this.tLList[nextCoord.x][nextCoord.y].isWall = false;
            }
        }
Пример #7
0
 internal void InitCave(int xmax, int ymax, int steps)
 {
     Random rand = new Random();
     Coordinates startCoord = new Coordinates(rand.Next(1, xmax - 1), rand.Next(1, ymax - 1));
     //Coordinates startCoord = new Coordinates(0, 1);
     Coordinates nextCoord = new Coordinates(startCoord.x, startCoord.y);
     Tile startTile = tLList[startCoord.x][startCoord.y];
     this.tLList[startCoord.x][startCoord.y].isWall = false;
     for (int i = 0; i < steps; i++)
     {
         nextCoord = tLList[nextCoord.x][nextCoord.y].neighbors[rand.Next(0, tLList[nextCoord.x][nextCoord.y].neighbors.Count)];
         this.tLList[nextCoord.x][nextCoord.y].isWall = false;
     }
 }