public override void EmitMarkers(DungeonBuilder builder) { var model = builder.Model as GridDungeonModel; if (model == null) { return; } var config = model.Config as GridDungeonConfig; if (config == null) { return; } var cellSize = config.GridCellSize; foreach (var cell in model.Cells) { var bounds = cell.Bounds; var cx = (bounds.Location.x + bounds.Size.x / 2.0f) * cellSize.x; var cy = bounds.Location.y * cellSize.y; var cz = (bounds.Location.z + bounds.Size.z / 2.0f) * cellSize.z; var position = new Vector3(cx, cy, cz); var transform = Matrix4x4.TRS(position, Quaternion.identity, Vector3.one); var markerName = (cell.CellType == CellType.Room) ? "RoomCenter" : "CorridorCenter"; builder.EmitMarker(markerName, transform, cell.Bounds.Location, cell.Id); } }
public override void EmitMarkers(DungeonBuilder builder) { var floorModel = builder.Model as FloorPlanModel; if (floorModel == null) { return; } var roomChunks = new List <FloorChunk>(); foreach (var chunk in floorModel.Chunks) { if (chunk.ChunkType == FloorChunkType.Room) { roomChunks.Add(chunk); } } var gridSize = floorModel.Config.GridSize; foreach (var roomChunk in roomChunks) { DecorateRoom(builder, roomChunk, gridSize); } }
/** Returns the wall object at given location and direction, or null if not found. */ private GameObject getDoor(int x, int y, Direction facing) { string direction = ""; if (facing.isNorth) { direction = "North"; } if (facing.isEast) { direction = "East"; } if (facing.isSouth) { direction = "North"; y--; } if (facing.isWest) { direction = "East"; x--; } var doorSearchName = DungeonBuilder.NameFromProperites(x, y, direction, "Door"); var secretSearchName = DungeonBuilder.NameFromProperites(x, y, direction, "Secret"); var gateSearchName = DungeonBuilder.NameFromProperites(x, y, direction, "Gate"); return(GameObject.Find(doorSearchName) ?? GameObject.Find(secretSearchName) ?? GameObject.Find(gateSearchName)); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); EditorGUILayout.Separator(); DungeonBuilder dungeon = (DungeonBuilder)target; room.position = EditorGUILayout.Vector3Field("Room position", room.position); room.size = EditorGUILayout.Vector2Field("Room size", room.size); if (GUILayout.Button("Create room")) { dungeon.CreateRoomGameObject(room); } var seed = dungeon.seed; var radius = dungeon.radius; var roomCount = dungeon.roomCount; if (GUILayout.Button("Create rooms")) { clearRooms(dungeon); dungeon.BuildDungeon(radius, seed, roomCount); } if (GUILayout.Button("Clear rooms")) { clearRooms(dungeon); } }
public override void EmitMarkers(DungeonBuilder builder) { var gridModel = builder.Model as GridDungeonModel; if (gridModel == null) { Debug.LogWarning("invalid builder used with this marker emitter"); return; } var config = gridModel.Config; var gridSize = config.GridCellSize; var wall2DMarkers = new List <Wall2DMarkerInfo>(); var occupied = new Dictionary <string, HashSet <IntVector> >(); foreach (var prop in builder.PropSockets) { if (prop.SocketType == DungeonConstants.ST_WALL) { var markerInfo = GetMarker2D(prop, DungeonConstants.ST_WALL2D, gridSize); RegisterMarker(markerInfo, wall2DMarkers, occupied); } else if (prop.SocketType == DungeonConstants.ST_FENCE) { var markerInfo = GetMarker2D(prop, DungeonConstants.ST_WALL2D, gridSize); RegisterMarker(markerInfo, wall2DMarkers, occupied); } else if (prop.SocketType == DungeonConstants.ST_DOOR) { var rotation = Matrix.GetRotation(ref prop.Transform); var angleStep = (Mathf.RoundToInt(rotation.eulerAngles.y / 90.0f) + 4) % 4; var doorMarker = DungeonConstants.ST_DOOR2D; if (angleStep == 1 || angleStep == 3) { // Angle is 90 or 270 doorMarker = DungeonConstants.ST_DOOR2D_90; } var markerInfo = GetMarker2D(prop, doorMarker, gridSize); RegisterMarker(markerInfo, wall2DMarkers, occupied); } } // fix the corners if (fixCorners) { FixCornerWalls(wall2DMarkers, builder.PropSockets, occupied, gridSize); } { // Add Ground2d markers. These are the same as ground markers, except that are not placed over 2d walls AddGround2DMarkers(wall2DMarkers, occupied, builder.PropSockets, gridSize); } foreach (var markerInfo in wall2DMarkers) { builder.EmitMarker(markerInfo.markerName, markerInfo.transform, markerInfo.gridPosition, markerInfo.cellId); } }
void EmitChunkMarker(DungeonBuilder builder, string markerName, Vector3 gridPositionF, float angle, Vector3 gridSize, int cellId) { var worldPosition = Vector3.Scale(gridPositionF, gridSize); var matrix = Matrix4x4.TRS(worldPosition, Quaternion.Euler(0, angle, 0), Vector3.one); var gridPosition = new IntVector(gridPositionF); builder.EmitMarker(markerName, matrix, gridPosition, cellId); }
void EmitGroundMarker(DungeonBuilder builder, int sizeX, int sizeZ, Vector3 cellSize) { var position = Vector3.Scale(new Vector3(sizeX, 0, sizeZ) / 2.0f, cellSize) + transform.position; var scale = new Vector3(sizeX, 1, sizeZ); var trans = Matrix4x4.TRS(position, Quaternion.identity, scale); builder.EmitMarker(GroundMarkerName, trans, IntVector.Zero, -1); }
private void clearRooms(DungeonBuilder dungeon) { var childCount = dungeon.transform.childCount; for (var i = childCount - 1; i >= 0; --i) { DestroyImmediate(dungeon.transform.GetChild(i).gameObject); } }
void EmitMarkerAt(DungeonBuilder builder, Vector3 cellSize, string markerName, float x, float z, float angle) { var worldPosition = Vector3.Scale(new Vector3(x, 0, z), cellSize) + transform.position; var rotation = Quaternion.Euler(0, angle, 0); var transformation = Matrix4x4.TRS(worldPosition, rotation, Vector3.one); var gridPosition = new IntVector((int)x, 0, (int)z); // Optionally provide where this marker is in the grid position builder.EmitMarker(markerName, transformation, gridPosition, -1); }
private void button1_Click(object sender, EventArgs e) { if (textBox1.Text == string.Empty) { return; } try { var wdt = new WDT("World\\maps\\" + textBox1.Text + "\\" + textBox1.Text + ".wdt"); if (!wdt.IsValid) { return; } if (wdt.IsGlobalModel) { _dungeonBuilder = new DungeonBuilder(textBox1.Text); _dungeonBuilder.OnProgress += OnProgress; _builder = null; _lastProgressX = 0; } else { int startX = startXBox.Text.Length > 0 ? int.Parse(startXBox.Text) : 0; int startY = startYBox.Text.Length > 0 ? int.Parse(startYBox.Text) : 0; int countX = countXBox.Text.Length > 0 ? int.Parse(countXBox.Text) : (64 - startX); int countY = countYBox.Text.Length > 0 ? int.Parse(countYBox.Text) : (64 - startY); startXBox.Text = startX.ToString(); startXBox.ReadOnly = true; startYBox.Text = startY.ToString(); startYBox.ReadOnly = true; countXBox.Text = countX.ToString(); countXBox.ReadOnly = true; countYBox.Text = countY.ToString(); countYBox.ReadOnly = true; _builder = new ContinentBuilder(textBox1.Text, startX, startY, countX, countY); _builder.OnTileEvent += OnTileEvent; _dungeonBuilder = null; } } catch (Exception) { return; } textBox1.ReadOnly = true; button1.Enabled = false; button1.Text = "Building..."; _buildThread = new Thread(RunBuild) { IsBackground = true }; _buildThread.Start(); }
private static void BuildToTarget(string path, BuildTarget target, bool isDevelopment = false) { bool needsPreloader = (target == BuildTarget.WebGL && preloaderEnabled); var scenes = needsPreloader ? preloaderScenes : singleScene; DungeonBuilder.ClearAll(); BuildPipeline.BuildPlayer(scenes, path, target, isDevelopment ? BuildOptions.Development : BuildOptions.None); }
public DungeonBuilder() { instance = this; createdObjectsDictionary = new Dictionary <string, GameObject>(); isBuilt = new bool[MDRDungeon.MAX_FLOORS]; MarkAllMapsAsDirty(); }
void EmitCornerMarker(DungeonBuilder builder, GridDungeonModel model, IntVector point, string markerName) { // Add an empty marker here var gridSize = model.Config.GridCellSize; var position = point * gridSize; position += Vector3.Scale(new Vector3(0.5f, 0, 0.5f), gridSize); var transform = Matrix4x4.TRS(position, Quaternion.identity, Vector3.one); builder.EmitMarker(markerName, transform, point, -1); }
void EmitCornerMarker(DungeonBuilder builder, GridDungeonModel model, IntVector point, float angleY, string markerName) { var gridSize = model.Config.GridCellSize; var position = point * gridSize; position += Vector3.Scale(new Vector3(0.5f, 0, 0.5f), gridSize); var rotation = Quaternion.Euler(0, angleY, 0); var transform = Matrix4x4.TRS(position, rotation, Vector3.one); builder.EmitMarker(markerName, transform, point, -1); }
void EmitForPoint(DungeonBuilder builder, GridDungeonModel model, IntVector point) { foreach (var config in CornerConfigs) { if (ConfigMatches(model, point, config)) { EmitCornerMarker(builder, model, point, config.markerName); break; } } }
public void Awake() { // We don't care about checking for null. If no player, the game // won't work anyway. player = FetchUtils.FetchGameObjectByTag(Tags.PLAYER).GetComponent <RogueController>(); factory = new AssetFactory(); factory.LoadAll(); builder = new DungeonBuilder(factory, transform); // Now create the first dungeon GenerateDungeon(); }
public TextAdventureWanderShould() { _one = BuildLocation("one"); _two = BuildLocation("two"); _three = BuildLocation("three"); _four = BuildLocation("four"); DungeonBuilder.Connect(DirectionCalculator.East, _one, _two); DungeonBuilder.Connect(DirectionCalculator.South, _two, _three); DungeonBuilder.Connect(DirectionCalculator.West, _three, _four); DungeonBuilder.Connect(DirectionCalculator.North, _four, _one); _engine = new TextAdventureEngine(_one, DirectionCalculator.North); }
void EmitForPoint(DungeonBuilder builder, GridDungeonModel model, IntVector point) { foreach (var config in CornerConfigs) { if (ConfigMatches(model, point, config)) { EmitCornerMarker(builder, model, point, config.RotationOffsetZ, config.MarkerName); if (config.StopOnFound) { break; } } } }
public override void EmitMarkers(DungeonBuilder builder) { if (!(builder is GridDungeonBuilder)) { Debug.LogWarning("Unsupported builder type used with marker emitter MarkerEmitterFindLowestPoint. Expected GridDungeonBuilder. Received:" + (builder != null ? builder.GetType().ToString() : "null")); return; } var gridModel = builder.Model as GridDungeonModel; var Min = new Vector3(int.MaxValue, int.MaxValue, int.MaxValue); var Max = new Vector3(-int.MaxValue, -int.MaxValue, -int.MaxValue); var gridSize = gridModel.Config.GridCellSize; if (gridModel.Cells.Count == 0) { Min = Vector3.zero; Max = Vector3.zero; } else { foreach (var cell in gridModel.Cells) { var location = cell.Bounds.Location * gridSize; var size = cell.Bounds.Size * gridSize; Min.x = Mathf.Min(Min.x, location.x); Min.y = Mathf.Min(Min.y, location.y); Min.z = Mathf.Min(Min.z, location.z); Max.x = Mathf.Max(Max.x, location.x + size.x); Max.y = Mathf.Max(Max.y, location.y + size.y); Max.z = Mathf.Max(Max.z, location.z + size.z); } } var rangeSize = Max - Min; var position = (Max + Min) / 2; position.y = Min.y; var scale = new Vector3(rangeSize.x, 1, rangeSize.z); var transform = Matrix4x4.TRS(position, Quaternion.identity, scale); builder.EmitMarker(MarkerName, transform, IntVector.Zero, -1); // Save this for other markers to use, if needed builder.Blackboard.FloatEntries.SetValue(BlackboardKeyLowestY, Min.y); }
void DecorateRoom(DungeonBuilder builder, FloorChunk roomChunk, Vector3 gridSize) { var bounds = roomChunk.Bounds; var x0 = bounds.Location.x; var x1 = bounds.Location.x + bounds.Size.x; var y = bounds.Location.y; var z0 = bounds.Location.z; var z1 = bounds.Location.z + bounds.Size.z; EmitChunkMarker(builder, "RoomCorner", new Vector3(x0, y, z0), 0, gridSize, roomChunk.Id); EmitChunkMarker(builder, "RoomCorner", new Vector3(x1, y, z0), -90, gridSize, roomChunk.Id); EmitChunkMarker(builder, "RoomCorner", new Vector3(x1, y, z1), 180, gridSize, roomChunk.Id); EmitChunkMarker(builder, "RoomCorner", new Vector3(x0, y, z1), 90, gridSize, roomChunk.Id); EmitChunkMarker(builder, "RoomCenter", new Vector3(x0 + x1, y + y, z0 + z1) / 2.0f, 270, gridSize, roomChunk.Id); }
public void BuildDungeon(bool updateCamera) { DungeonBuilder builder = new DungeonBuilder(); builder.BeginDungeon(); builder.SetSize(sizeX, sizeY); builder.SetGenerator(new DungeonGeneratorEmpty()); builder.SetRoomDecorator(roomDecorator); builder.Build(); DungeonMap dungeon = builder.GetDungeon(); SetDungeon(dungeon, updateCamera); }
void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); dungeonBuilder = GetComponent <DungeonBuilder>(); playerController = FindObjectOfType <PlayerController>(); dungeonFiller = GetComponent <DungeonFiller>(); GenerateDungeon(); }
public override void OnInspectorGUI() { DrawDefaultInspector(); DungeonBuilder script = (DungeonBuilder)target; bool isInitialized = script.IsInitialized; GUI.enabled = isInitialized; script.BuildMethod = (DungeonBuildMethod)EditorGUILayout.EnumPopup(script.BuildMethod); if (GUILayout.Button("Rebuild Map")) { script.RebuildSelectedMap(); } if (GUILayout.Button("Rebuild Dungeon")) { script.RebuildDungeon(); } GUI.enabled = true; if (!isInitialized) { GUILayout.Label("You must initialize before rebuilding."); } if (GUILayout.Button("Initialize")) { script.Initialize(); } if (GUILayout.Button("Clear")) { DungeonBuilder.ClearAll(); } GUILayout.Label("Active Level:"); if (isInitialized) { script.SelectedMap = EditorGUILayout.IntSlider(script.SelectedMap, 0, script.Maps); } }
public PotentialRoom(DungeonBuilder builder, Vector2Int pos) { this.pos = pos; for (int x = pos.x - 1; x < 3; x++) { for (int y = pos.y - 1; y < 3; y++) { Room room = builder.GetRoom(pos + new Vector2Int(x, y)); if (!room) { continue; } weight += room.OpenDoorCount; } } }
public override void EmitMarkers(DungeonBuilder builder) { if (!(builder is GridDungeonBuilder)) { Debug.LogWarning("Unsupported builder type used with marker emitter MarkerEmitterFindLowestPoint. Expected GridDungeonBuilder. Received:" + (builder != null ? builder.GetType().ToString() : "null")); return; } var gridModel = builder.Model as GridDungeonModel; foreach (var cell in gridModel.Cells) { var borderPoints = cell.Bounds.GetBorderPoints(); foreach (var borderPoint in borderPoints) { EmitForPoint(builder, gridModel, borderPoint); } } }
void Start() { DungeonBuilder dungeon = GetComponent<DungeonBuilder>(); string S_R = Scenes.getParam("seed"); if (!S_R.Equals("")) { Debug.Log(S_R); Seed = int.Parse(S_R.Split(null)[0]); Rooms = int.Parse(S_R.Split(null)[1]); } if (Seed == 0) Seed = Random.Range(1111, 999999); if (Rooms == 0) Rooms = Random.Range(10, 40); dungeon.BuildDungeon(0, Seed, Rooms); GameController.Instance.Seed = Seed; GameController.Instance.Rooms = Rooms; }
public MapScreen(int viewportWidth, int viewportHeight) { // TODO: Improve this, I would like to not be limited by map size. const int panelStatsWidth = 20; const int panelLogsHeight = 10; int mapWidth = viewportWidth - panelStatsWidth; int mapHeight = viewportHeight - panelLogsHeight; // Add stats panel StatsPanel = new StatsPanel(panelStatsWidth, viewportHeight); StatsPanel.Position = new Microsoft.Xna.Framework.Point(mapWidth, 0); Children.Add(StatsPanel); // Add logs panel LogsPanel = new LogsPanel(mapWidth, panelLogsHeight); LogsPanel.Position = new Microsoft.Xna.Framework.Point(0, mapHeight); Children.Add(LogsPanel); Map = DungeonBuilder.GenerateDungeon(mapWidth, mapHeight); // Get a console that's set up to render the map, // and add it as a child of this container so it renders MapRenderer = Map.CreateRenderer(0, 0, mapWidth, mapHeight); Children.Add(MapRenderer); // Set player to receive input, since in this example the player handles movement Map.ControlledGameObject.IsFocused = true; // Set up to recalculate FOV and set camera position appropriately when the player moves. // Also make sure we hook the new Player if that object is reassigned. Map.ControlledGameObject.Moved += Player_Moved; Map.ControlledGameObjectChanged += ControlledGameObjectChanged; // Calculate initial FOV and center camera Map.CalculateFOV(Map.ControlledGameObject.Position, Map.ControlledGameObject.FOVRadius, Radius.SQUARE); MapRenderer.CenterViewPortOnPoint(Map.ControlledGameObject.Position); }
public override void EmitMarkers(DungeonBuilder builder) { Initialize(); if (!(builder is GridDungeonBuilder)) { Debug.LogWarning("Unsupported builder type used with marker emitter MarkerEmitterFindLowestPoint. Expected GridDungeonBuilder. Received:" + (builder != null ? builder.GetType().ToString() : "null")); return; } var gridModel = builder.Model as GridDungeonModel; foreach (var cell in gridModel.Cells) { var bounds = cell.Bounds; for (var x = bounds.X; x < bounds.X + bounds.Width; x++) { for (var z = bounds.Z; z < bounds.Z + bounds.Length; z++) { var point = new IntVector(x, bounds.Location.y, z); EmitForPoint(builder, gridModel, point); } } } }
private void Awake() { Instance = this; }
// Use this for initialization private void Awake() { instance = this; }
private void PopulateExits(DungeonBuilder.Node n, GameObject g, DungeonBuilder db) { GameObject[] verticalPathOptions = Resources.LoadAll <GameObject>(RoomPath + Tileset + "/PathVertical"); GameObject[] horizontalPathOptions = Resources.LoadAll <GameObject>(RoomPath + Tileset + "/PathHorizontal"); List <RoomExit> roomExitPoints = g.GetComponentsInChildren <RoomExit>().ToList(); Tuple <int, int> positionOfNode = db.nodePositions[n.spawnIndex]; if (db.nodePositions.Any(no => n.Connections.Any(k => k.spawnIndex == no.Key) && no.Value.Equals(new Tuple <int, int>(positionOfNode.Item1 - 1, positionOfNode.Item2)))) { RoomExit exit = roomExitPoints.OrderBy(r => r.transform.localPosition.x).First(); exit.activateTile = true; for (int i = (int)exit.transform.localPosition.x - 1; i >= -distanceBetweenNodes / 2; i--) { GameObject p = Instantiate(horizontalPathOptions[Random.Range(0, horizontalPathOptions.Length)]); objectsToDestroy.Add(p); p.transform.parent = g.transform; p.transform.localPosition = Vector3.zero + Vector3.right * i + Vector3.up * exit.transform.localPosition.y; } if (n.nodeType == DungeonBuilder.NodeType.Boss && n.Connections.Any(no => no.nodeType == DungeonBuilder.NodeType.EndTreasure)) { int endNode = n.Connections.First(no => no.nodeType == DungeonBuilder.NodeType.EndTreasure).spawnIndex; if (db.nodePositions[endNode].Equals(new Tuple <int, int>(positionOfNode.Item1 - 1, positionOfNode.Item2))) { exit.activateTile = false; exit.gameObject.AddComponent <PostBossItemTakey>(); BossEnemy boss = g.GetComponentInChildren <BossEnemy>(); if (boss != null) { boss.bossExit = exit; } } } } if (db.nodePositions.Any(no => n.Connections.Any(k => k.spawnIndex == no.Key) && no.Value.Equals(new Tuple <int, int>(positionOfNode.Item1 + 1, positionOfNode.Item2)))) { RoomExit exit = roomExitPoints.OrderBy(r => r.transform.localPosition.x).Last(); exit.activateTile = true; for (int i = (int)exit.transform.localPosition.x + 1; i <= distanceBetweenNodes / 2; i++) { GameObject p = Instantiate(horizontalPathOptions[Random.Range(0, horizontalPathOptions.Length)]); objectsToDestroy.Add(p); p.transform.parent = g.transform; p.transform.localPosition = Vector3.zero + Vector3.right * i + Vector3.up * exit.transform.localPosition.y; } if (n.nodeType == DungeonBuilder.NodeType.Boss && n.Connections.Any(no => no.nodeType == DungeonBuilder.NodeType.EndTreasure)) { int endNode = n.Connections.First(no => no.nodeType == DungeonBuilder.NodeType.EndTreasure).spawnIndex; if (db.nodePositions[endNode].Equals(new Tuple <int, int>(positionOfNode.Item1 + 1, positionOfNode.Item2))) { exit.activateTile = false; exit.gameObject.AddComponent <PostBossItemTakey>(); BossEnemy boss = g.GetComponentInChildren <BossEnemy>(); if (boss != null) { boss.bossExit = exit; } } } } if (db.nodePositions.Any(no => n.Connections.Any(k => k.spawnIndex == no.Key) && no.Value.Equals(new Tuple <int, int>(positionOfNode.Item1, positionOfNode.Item2 - 1)))) { RoomExit exit = roomExitPoints.OrderBy(r => r.transform.localPosition.y).First(); exit.activateTile = true; for (int i = (int)exit.transform.localPosition.y - 1; i >= -distanceBetweenNodes / 2; i--) { GameObject p = Instantiate(verticalPathOptions[Random.Range(0, verticalPathOptions.Length)]); objectsToDestroy.Add(p); p.transform.parent = g.transform; p.transform.localPosition = Vector3.zero + Vector3.up * i + Vector3.right * exit.transform.localPosition.x; } if (n.nodeType == DungeonBuilder.NodeType.Boss && n.Connections.Any(no => no.nodeType == DungeonBuilder.NodeType.EndTreasure)) { int endNode = n.Connections.First(no => no.nodeType == DungeonBuilder.NodeType.EndTreasure).spawnIndex; if (db.nodePositions[endNode].Equals(new Tuple <int, int>(positionOfNode.Item1, positionOfNode.Item2 - 1))) { exit.activateTile = false; exit.gameObject.AddComponent <PostBossItemTakey>(); BossEnemy boss = g.GetComponentInChildren <BossEnemy>(); if (boss != null) { boss.bossExit = exit; } } } } if (db.nodePositions.Any(no => n.Connections.Any(k => k.spawnIndex == no.Key) && no.Value.Equals(new Tuple <int, int>(positionOfNode.Item1, positionOfNode.Item2 + 1)))) { RoomExit exit = roomExitPoints.OrderBy(r => r.transform.localPosition.y).Last(); exit.activateTile = true; for (int i = (int)exit.transform.localPosition.y + 1; i <= distanceBetweenNodes / 2; i++) { GameObject p = Instantiate(verticalPathOptions[Random.Range(0, verticalPathOptions.Length)]); objectsToDestroy.Add(p); p.transform.parent = g.transform; p.transform.localPosition = Vector3.zero + Vector3.up * i + Vector3.right * exit.transform.localPosition.x; } if (n.nodeType == DungeonBuilder.NodeType.Boss && n.Connections.Any(no => no.nodeType == DungeonBuilder.NodeType.EndTreasure)) { int endNode = n.Connections.First(no => no.nodeType == DungeonBuilder.NodeType.EndTreasure).spawnIndex; if (db.nodePositions[endNode].Equals(new Tuple <int, int>(positionOfNode.Item1, positionOfNode.Item2 + 1))) { exit.activateTile = false; exit.gameObject.AddComponent <PostBossItemTakey>(); BossEnemy boss = g.GetComponentInChildren <BossEnemy>(); if (boss != null) { boss.bossExit = exit; } } } } }