public void EnterMap(ExplorerTeam activeTeam, LocRay8 entryPoint) { ActiveTeam = activeTeam; //place characters around in order ActiveTeam.Leader.CharLoc = entryPoint.Loc; if (entryPoint.Dir != Dir8.None) { ActiveTeam.Leader.CharDir = entryPoint.Dir; } foreach (Character character in ActiveTeam.Players) { //TODO: there may be a problem here; the method for finding a free space searches through all characters already in the map //since the active team has already been added to the map, all characters are counted and can block themselves when reassigning locations //warp all active team allies next to the player of this floor Loc?endLoc = GetClosestTileForChar(character, entryPoint.Loc); if (endLoc == null) { endLoc = entryPoint.Loc; } character.CharLoc = endLoc.Value; if (entryPoint.Dir != Dir8.None) { character.CharDir = entryPoint.Dir; } if (!character.Dead) { UpdateExploration(character); } } }
public void EnterGroundEdit(int entryPoint) { if (ZoneManager.Instance.CurrentGround.Entities[0].Markers.Count > 0) { LocRay8 entry = ZoneManager.Instance.CurrentGround.GetEntryPoint(entryPoint); FocusedLoc = entry.Loc; } DiagManager.Instance.DevEditor.OpenGround(); }
public MapTabEntrancesViewModel() { SelectedEntity = new LocRay8(); Directions = new ObservableCollection <string>(); foreach (Dir8 dir in DirExt.VALID_DIR8) { Directions.Add(dir.ToLocal()); } }
public void EnterFloor(int entryPointIndex) { LocRay8 entry = new LocRay8(Loc.Zero, Dir8.Down); if (entryPointIndex < ZoneManager.Instance.CurrentMap.EntryPoints.Count) { entry = ZoneManager.Instance.CurrentMap.EntryPoints[entryPointIndex]; } EnterFloor(entry); }
public void EnterMapEdit(int entryPoint) { if (ZoneManager.Instance.CurrentMap.EntryPoints.Count > 0) { LocRay8 entry = ZoneManager.Instance.CurrentMap.EntryPoints[entryPoint]; FocusedLoc = entry.Loc; } DiagManager.Instance.DevEditor.OpenMap(); }
public void EnterGround(string entryPoint) { LocRay8 entry = ZoneManager.Instance.CurrentGround.GetEntryPoint(entryPoint); if (entry.Dir == Dir8.None) { entry.Dir = DataManager.Instance.Save.ActiveTeam.Leader.CharDir; } EnterGround(entry.Loc, entry.Dir); }
public void EnterFloor(LocRay8 entryPoint) { //put the carry-overs in the new map foreach (MapStatus status in ZoneManager.Instance.CurrentZone.CarryOver) { ZoneManager.Instance.CurrentMap.Status.Add(status.ID, status); } ZoneManager.Instance.CurrentZone.CarryOver.Clear(); ZoneManager.Instance.CurrentMap.EnterMap(DataManager.Instance.Save.ActiveTeam, entryPoint); ResetFloor(); }
public void ResizeJustified(int width, int height, Dir8 anchorDir) { foreach (MapLayer layer in Layers) { layer.ResizeJustified(width, height, anchorDir); } //tiles Grid.LocAction changeOp = (Loc loc) => { Tiles[loc.X][loc.Y].Effect.UpdateTileLoc(loc); }; Grid.LocAction newOp = (Loc loc) => { Tiles[loc.X][loc.Y] = new Tile(0, loc); }; Loc diff = Grid.ResizeJustified(ref Tiles, width, height, anchorDir.Reverse(), changeOp, newOp); //discovery array changeOp = (Loc loc) => { }; newOp = (Loc loc) => { }; Grid.ResizeJustified(ref DiscoveryArray, width, height, anchorDir.Reverse(), changeOp, newOp); foreach (Character character in IterateCharacters()) { character.CharLoc = Collision.ClampToBounds(width, height, character.CharLoc + diff); character.UpdateFrame(); UpdateExploration(character); } //items foreach (MapItem item in Items) { item.TileLoc = Collision.ClampToBounds(width, height, item.TileLoc + diff); } //entry points for (int ii = 0; ii < EntryPoints.Count; ii++) { EntryPoints[ii] = new LocRay8(EntryPoints[ii].Loc + diff, EntryPoints[ii].Dir); } }
public void EnterGround(int entryPoint) { LocRay8 entry = ZoneManager.Instance.CurrentGround.GetEntryPoint(entryPoint); EnterGround(entry.Loc, entry.Dir); }
/// <summary> /// chooses and caegorizes the tile to be sealed /// </summary> /// <param name="map"></param> /// <param name="sealList"></param> /// <param name="plan"></param> /// <param name="loc"></param> /// <param name="dir"></param> /// <returns>Whether it affected the tile outwards or not</returns> private bool sealBorderRay(T map, Dictionary <Loc, SealType> sealList, IFloorRoomPlan plan, LocRay8 locRay, Dir8 side1, Dir8 side2) { Loc forthLoc = locRay.Loc + locRay.Dir.GetLoc(); bool hasAdjacent = false; bool hasCondition = false; for (int ii = 0; ii < plan.Adjacents.Count; ii++) { IFloorRoomPlan adjacentPlan = map.RoomPlan.GetRoomHall(plan.Adjacents[ii]); if (Collision.InBounds(adjacentPlan.RoomGen.Draw, forthLoc)) { hasAdjacent = true; if (BaseRoomFilter.PassesAllFilters(adjacentPlan, this.Filters)) { hasCondition = true; break; } } } if (!hasAdjacent) { //in the case where the extending tile is within no adjacents // all normal walls shall be turned into impassables // everything else is saved into the lock list sealBorderTile(map, sealList, SealType.Locked, forthLoc); return(true); } else if (!hasCondition) { //in the case where the extending tile is within an adjacent and that adjacent DOESNT pass filter // all normal walls for the INWARD border shall be turned into impassables // everything else for the INWARD border shall be saved into a key list if (map.Tiles[forthLoc.X][forthLoc.Y].TileEquivalent(map.RoomTerrain)) { sealBorderTile(map, sealList, SealType.Key, locRay.Loc); } else { sealBorderTile(map, sealList, SealType.Locked, locRay.Loc); } //when transitioning between inward and outward //-when transitioning from outward to inward, the previous outward tile needs an inward check //-when transitioning from inward to outward, the current outward tile needs a inward check //in the interest of trading redundancy for simplicity, an inward block will just block the tiles to the sides //regardless of if they've already been blocked //redundancy will be handled by hashsets if (side1 != Dir8.None) { Loc sideLoc = locRay.Loc + side1.GetLoc(); sealBorderTile(map, sealList, SealType.Locked, sideLoc); } if (side2 != Dir8.None) { Loc sideLoc = locRay.Loc + side2.GetLoc(); sealBorderTile(map, sealList, SealType.Locked, sideLoc); } return(false); } else { //in the case where the extending tile is within an adjacent and that adjacent passes filter // do nothing and skip these tiles return(true); } }
private void sealCornerRay(T map, Dictionary <Loc, SealType> sealList, IFloorRoomPlan plan, LocRay8 locRay) { DirH dirH; DirV dirV; locRay.Dir.Separate(out dirH, out dirV); bool outwardsH = sealBorderRay(map, sealList, plan, new LocRay8(locRay.Loc, dirH.ToDir8()), dirV.ToDir8().Reverse(), Dir8.None); bool outwardsV = sealBorderRay(map, sealList, plan, new LocRay8(locRay.Loc, dirV.ToDir8()), dirH.ToDir8().Reverse(), Dir8.None); //when two directions of a corner tile face inward, or outward, or a combination of inward and outward //-both inward: needs to not be redundant across the two sides - handled by hashset, no action needed //-one inward and one outward: can coexist - no action needed //-both outward: needs to check the outward diagonal to see if it forces inward // -if it doesnt force inward, do an outward operation // -if it does, do an inward operation if (outwardsH && outwardsV) { sealBorderRay(map, sealList, plan, locRay, Dir8.None, Dir8.None); } }