-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d67cc91
commit 254024d
Showing
10 changed files
with
10,293 additions
and
7,131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
using UnityEngine.Tilemaps; | ||
|
||
public class BossSpawner : MonoBehaviour | ||
{ | ||
public Tilemap floorTilemap; // Reference to the tilemap containing floor tiles | ||
|
||
// Start is called before the first frame update | ||
void Start() | ||
{ | ||
SpawnBossAtRandomPosition(); | ||
} | ||
|
||
void SpawnBossAtRandomPosition() | ||
{ | ||
BoundsInt bounds = floorTilemap.cellBounds; | ||
List<Vector3Int> validFloorPositions = new List<Vector3Int>(); | ||
|
||
// Iterate through all cells in the bounds to find floor tiles | ||
for (int x = bounds.xMin; x < bounds.xMax; x++) | ||
{ | ||
for (int y = bounds.yMin; y < bounds.yMax; y++) | ||
{ | ||
Vector3Int currentPos = new Vector3Int(x, y, 0); | ||
if (floorTilemap.HasTile(currentPos)) | ||
{ | ||
validFloorPositions.Add(currentPos); | ||
} | ||
} | ||
} | ||
|
||
// Select a random floor position | ||
if (validFloorPositions.Count > 0) | ||
{ | ||
Vector3Int randomFloorPosition = validFloorPositions[Random.Range(0, validFloorPositions.Count)]; | ||
Vector3 spawnPosition = floorTilemap.CellToWorld(randomFloorPosition) + new Vector3(0.5f, 0.5f, 0f); // Adjust for tile center | ||
|
||
// Move the boss to the selected position | ||
transform.position = spawnPosition; | ||
} | ||
else | ||
{ | ||
Debug.LogWarning("No valid floor positions found for boss spawn."); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,277 @@ | ||
%YAML 1.1 | ||
%TAG !u! tag:unity3d.com,2011: | ||
--- !u!1 &1982641947073638671 | ||
GameObject: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
serializedVersion: 6 | ||
m_Component: | ||
- component: {fileID: 8611562969287616908} | ||
- component: {fileID: 351134532918863842} | ||
- component: {fileID: 3112543308671902406} | ||
- component: {fileID: 765601037215907792} | ||
- component: {fileID: 7076450762560944811} | ||
- component: {fileID: 2388818083735658671} | ||
- component: {fileID: 4915210356326827529} | ||
- component: {fileID: 7085319043430451804} | ||
- component: {fileID: 2960408672335473125} | ||
m_Layer: 0 | ||
m_Name: Player 1 | ||
m_TagString: Player | ||
m_Icon: {fileID: 0} | ||
m_NavMeshLayer: 0 | ||
m_StaticEditorFlags: 0 | ||
m_IsActive: 1 | ||
--- !u!4 &8611562969287616908 | ||
Transform: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 1982641947073638671} | ||
serializedVersion: 2 | ||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} | ||
m_LocalPosition: {x: 10.14, y: 7.09, z: 0} | ||
m_LocalScale: {x: 1, y: 1, z: 1} | ||
m_ConstrainProportionsScale: 0 | ||
m_Children: [] | ||
m_Father: {fileID: 0} | ||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | ||
--- !u!212 &351134532918863842 | ||
SpriteRenderer: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 1982641947073638671} | ||
m_Enabled: 1 | ||
m_CastShadows: 0 | ||
m_ReceiveShadows: 0 | ||
m_DynamicOccludee: 1 | ||
m_StaticShadowCaster: 0 | ||
m_MotionVectors: 1 | ||
m_LightProbeUsage: 1 | ||
m_ReflectionProbeUsage: 1 | ||
m_RayTracingMode: 0 | ||
m_RayTraceProcedural: 0 | ||
m_RayTracingAccelStructBuildFlagsOverride: 0 | ||
m_RayTracingAccelStructBuildFlags: 1 | ||
m_RenderingLayerMask: 1 | ||
m_RendererPriority: 0 | ||
m_Materials: | ||
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} | ||
m_StaticBatchInfo: | ||
firstSubMesh: 0 | ||
subMeshCount: 0 | ||
m_StaticBatchRoot: {fileID: 0} | ||
m_ProbeAnchor: {fileID: 0} | ||
m_LightProbeVolumeOverride: {fileID: 0} | ||
m_ScaleInLightmap: 1 | ||
m_ReceiveGI: 1 | ||
m_PreserveUVs: 0 | ||
m_IgnoreNormalsForChartDetection: 0 | ||
m_ImportantGI: 0 | ||
m_StitchLightmapSeams: 1 | ||
m_SelectedEditorRenderState: 0 | ||
m_MinimumChartSize: 4 | ||
m_AutoUVMaxDistance: 0.5 | ||
m_AutoUVMaxAngle: 89 | ||
m_LightmapParameters: {fileID: 0} | ||
m_SortingLayerID: 0 | ||
m_SortingLayer: 0 | ||
m_SortingOrder: 0 | ||
m_Sprite: {fileID: 21300000, guid: 0f39a9205e4394ee1b6ba8269428d176, type: 3} | ||
m_Color: {r: 1, g: 1, b: 1, a: 1} | ||
m_FlipX: 0 | ||
m_FlipY: 0 | ||
m_DrawMode: 0 | ||
m_Size: {x: 2, y: 2} | ||
m_AdaptiveModeThreshold: 0.5 | ||
m_SpriteTileMode: 0 | ||
m_WasSpriteAssigned: 1 | ||
m_MaskInteraction: 0 | ||
m_SpriteSortPoint: 0 | ||
--- !u!50 &3112543308671902406 | ||
Rigidbody2D: | ||
serializedVersion: 4 | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 1982641947073638671} | ||
m_BodyType: 0 | ||
m_Simulated: 1 | ||
m_UseFullKinematicContacts: 0 | ||
m_UseAutoMass: 0 | ||
m_Mass: 1 | ||
m_LinearDrag: 0 | ||
m_AngularDrag: 0.05 | ||
m_GravityScale: 0 | ||
m_Material: {fileID: 0} | ||
m_IncludeLayers: | ||
serializedVersion: 2 | ||
m_Bits: 0 | ||
m_ExcludeLayers: | ||
serializedVersion: 2 | ||
m_Bits: 0 | ||
m_Interpolate: 0 | ||
m_SleepingMode: 1 | ||
m_CollisionDetection: 0 | ||
m_Constraints: 4 | ||
--- !u!114 &765601037215907792 | ||
MonoBehaviour: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 1982641947073638671} | ||
m_Enabled: 1 | ||
m_EditorHideFlags: 0 | ||
m_Script: {fileID: 11500000, guid: ac9691efec698a049863abfc3159596a, type: 3} | ||
m_Name: | ||
m_EditorClassIdentifier: | ||
playerSpeed: 3 | ||
playerBody: {fileID: 3112543308671902406} | ||
animator: {fileID: 7076450762560944811} | ||
maxHealth: 100 | ||
currentHealth: 0 | ||
healthbar: {fileID: 0} | ||
floorTilemap: {fileID: 0} | ||
wallTilemap: {fileID: 0} | ||
--- !u!95 &7076450762560944811 | ||
Animator: | ||
serializedVersion: 7 | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 1982641947073638671} | ||
m_Enabled: 1 | ||
m_Avatar: {fileID: 0} | ||
m_Controller: {fileID: 9100000, guid: d01807f35b2c42345960b8c401a7c092, type: 2} | ||
m_CullingMode: 0 | ||
m_UpdateMode: 0 | ||
m_ApplyRootMotion: 0 | ||
m_LinearVelocityBlending: 0 | ||
m_StabilizeFeet: 0 | ||
m_AnimatePhysics: 0 | ||
m_WarningMessage: | ||
m_HasTransformHierarchy: 1 | ||
m_AllowConstantClipSamplingOptimization: 1 | ||
m_KeepAnimatorStateOnDisable: 0 | ||
m_WriteDefaultValuesOnDisable: 0 | ||
--- !u!70 &2388818083735658671 | ||
CapsuleCollider2D: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 1982641947073638671} | ||
m_Enabled: 1 | ||
serializedVersion: 3 | ||
m_Density: 1 | ||
m_Material: {fileID: 0} | ||
m_IncludeLayers: | ||
serializedVersion: 2 | ||
m_Bits: 0 | ||
m_ExcludeLayers: | ||
serializedVersion: 2 | ||
m_Bits: 0 | ||
m_LayerOverridePriority: 0 | ||
m_ForceSendLayers: | ||
serializedVersion: 2 | ||
m_Bits: 4294967295 | ||
m_ForceReceiveLayers: | ||
serializedVersion: 2 | ||
m_Bits: 4294967295 | ||
m_ContactCaptureLayers: | ||
serializedVersion: 2 | ||
m_Bits: 4294967295 | ||
m_CallbackLayers: | ||
serializedVersion: 2 | ||
m_Bits: 4294967295 | ||
m_IsTrigger: 1 | ||
m_UsedByEffector: 0 | ||
m_CompositeOperation: 0 | ||
m_CompositeOrder: 0 | ||
m_Offset: {x: -0.016467094, y: -0.19431353} | ||
m_Size: {x: 1.5455036, y: 1.822154} | ||
m_Direction: 0 | ||
--- !u!114 &4915210356326827529 | ||
MonoBehaviour: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 1982641947073638671} | ||
m_Enabled: 1 | ||
m_EditorHideFlags: 0 | ||
m_Script: {fileID: 11500000, guid: ea11a6b6faa14e445a3cf50dbbb7fd76, type: 3} | ||
m_Name: | ||
m_EditorClassIdentifier: | ||
TheFollowed: {fileID: 0} | ||
followerSpeed: 2 | ||
animator: {fileID: 7076450762560944811} | ||
--- !u!114 &7085319043430451804 | ||
MonoBehaviour: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 1982641947073638671} | ||
m_Enabled: 1 | ||
m_EditorHideFlags: 0 | ||
m_Script: {fileID: 11500000, guid: ae0cdfc5f82c08d47ac0f5fa406acc6a, type: 3} | ||
m_Name: | ||
m_EditorClassIdentifier: | ||
floorTilemap: {fileID: 0} | ||
wallTilemap: {fileID: 0} | ||
cellSize: 1 | ||
--- !u!61 &2960408672335473125 | ||
BoxCollider2D: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 1982641947073638671} | ||
m_Enabled: 1 | ||
serializedVersion: 3 | ||
m_Density: 1 | ||
m_Material: {fileID: 0} | ||
m_IncludeLayers: | ||
serializedVersion: 2 | ||
m_Bits: 0 | ||
m_ExcludeLayers: | ||
serializedVersion: 2 | ||
m_Bits: 0 | ||
m_LayerOverridePriority: 0 | ||
m_ForceSendLayers: | ||
serializedVersion: 2 | ||
m_Bits: 4294967295 | ||
m_ForceReceiveLayers: | ||
serializedVersion: 2 | ||
m_Bits: 4294967295 | ||
m_ContactCaptureLayers: | ||
serializedVersion: 2 | ||
m_Bits: 4294967295 | ||
m_CallbackLayers: | ||
serializedVersion: 2 | ||
m_Bits: 4294967295 | ||
m_IsTrigger: 1 | ||
m_UsedByEffector: 0 | ||
m_CompositeOperation: 0 | ||
m_CompositeOrder: 0 | ||
m_Offset: {x: -0.016467094, y: -0.18772626} | ||
m_SpriteTilingProperty: | ||
border: {x: 0, y: 0, z: 0, w: 0} | ||
pivot: {x: 0.5, y: 0.5} | ||
oldSize: {x: 2, y: 2} | ||
newSize: {x: 2, y: 2} | ||
adaptiveTilingThreshold: 0.5 | ||
drawMode: 0 | ||
adaptiveTiling: 0 | ||
m_AutoTiling: 0 | ||
m_Size: {x: 0.82094765, y: 1.3742452} | ||
m_EdgeRadius: 0 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.