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);
 }
 //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);
 }
 //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); }
 }
Exemple #4
0
 public void AddCoord(Coordinates otherCoord)
 {
     x = x + otherCoord.x;
     y = y + otherCoord.y;
     str_xy = ToStringPair(x, y);
 }
Exemple #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;
 }
Exemple #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;
            }
        }
Exemple #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;
     }
 }