示例#1
0
 public LocRay4(int x, int y, Dir4 dir)
 {
     this.Loc = new Loc(x, y);
     this.Dir = dir;
 }
示例#2
0
 public LocRay4(Dir4 dir)
 {
     this.Loc = Loc.Zero;
     this.Dir = dir;
 }
示例#3
0
 public LocRay4(Loc loc, Dir4 dir)
 {
     this.Loc = loc;
     this.Dir = dir;
 }
示例#4
0
 public LocRay8(Loc loc, Dir8 dir)
 {
     this.Loc = loc;
     this.Dir = dir;
 }
示例#5
0
 public LocRay4(Loc loc)
 {
     this.Loc = loc;
     this.Dir = Dir4.None;
 }
示例#6
0
 public LocRay8(Dir8 dir)
 {
     this.Loc = Loc.Zero;
     this.Dir = dir;
 }
示例#7
0
 public LocRay8(Loc loc)
 {
     this.Loc = loc;
     this.Dir = Dir8.None;
 }
示例#8
0
 public void InitSize(Loc size)
 {
     this.Size  = size;
     this.Rooms = new List <FloorRoomPlan>();
     this.Halls = new List <FloorHallPlan>();
 }
示例#9
0
 public YieldInstruction _MoveToLoc(GroundEntity ent, RogueElements.Loc pos, bool run = false)
 {
     return(_MoveToPosition(ent, pos.X, pos.Y, run));
 }
示例#10
0
        public override void ApplyToPath(IRandom rand, GridPlan floorPlan)
        {
            for (int ii = 0; ii < 10; ii++)
            {
                // always clear before trying
                floorPlan.Clear();

                int roomsToOpen = floorPlan.GridWidth * floorPlan.GridHeight * this.RoomRatio.Pick(rand) / 100;
                if (roomsToOpen < 1)
                {
                    roomsToOpen = 1;
                }
                int addBranch = this.BranchRatio.Pick(rand);
                int roomsLeft = roomsToOpen;

                Loc sourceRoom = new Loc(rand.Next(floorPlan.GridWidth), rand.Next(floorPlan.GridHeight)); // randomly determine start room
                floorPlan.AddRoom(sourceRoom, this.GenericRooms.Pick(rand), this.RoomComponents.Clone());

                GenContextDebug.DebugProgress("Start Room");

                roomsLeft--;
                int pendingBranch = 0;
                while (roomsLeft > 0)
                {
                    bool terminalSuccess = this.ExpandPath(rand, floorPlan, false);
                    bool branchSuccess   = false;
                    if (terminalSuccess)
                    {
                        roomsLeft--;
                        if (floorPlan.RoomCount > 2)
                        {
                            pendingBranch += addBranch;
                        }
                    }
                    else if (this.NoForcedBranches)
                    {
                        break;
                    }
                    else
                    {
                        pendingBranch = 100;
                    }

                    while (pendingBranch >= 100 && roomsLeft > 0)
                    {
                        branchSuccess = this.ExpandPath(rand, floorPlan, true);
                        if (!branchSuccess)
                        {
                            break;
                        }
                        pendingBranch -= 100;
                        roomsLeft--;
                    }

                    if (!terminalSuccess && !branchSuccess)
                    {
                        break;
                    }
                }

                if (roomsLeft <= 0)
                {
                    break;
                }
            }
        }