Compare commits

...

3 Commits

Author SHA1 Message Date
br0kenpixel abd2f5e94f update readme 2026-05-05 11:59:27 +02:00
br0kenpixel 3158befb1e add more spawners 2026-05-05 11:59:08 +02:00
br0kenpixel 1e35195ab8 randomize delay between zombie spawns 2026-05-05 11:43:15 +02:00
4 changed files with 134 additions and 6 deletions
+3 -2
View File
@@ -1905,6 +1905,7 @@ MonoBehaviour:
- {fileID: 8300000, guid: 1e52096c131bbbb4f94236be610dbb22, type: 3} - {fileID: 8300000, guid: 1e52096c131bbbb4f94236be610dbb22, type: 3}
- {fileID: 8300000, guid: a6d7ea851c2ca764a829054b971cfe67, type: 3} - {fileID: 8300000, guid: a6d7ea851c2ca764a829054b971cfe67, type: 3}
- {fileID: 8300000, guid: 98cbf8c7e7fb89345a25a8606b4761eb, type: 3} - {fileID: 8300000, guid: 98cbf8c7e7fb89345a25a8606b4761eb, type: 3}
sfxDelay: 5
--- !u!82 &8752207854750903613 --- !u!82 &8752207854750903613
AudioSource: AudioSource:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -1918,13 +1919,13 @@ AudioSource:
m_audioClip: {fileID: 0} m_audioClip: {fileID: 0}
m_Resource: {fileID: 0} m_Resource: {fileID: 0}
m_PlayOnAwake: 0 m_PlayOnAwake: 0
m_Volume: 1 m_Volume: 0.3
m_Pitch: 1 m_Pitch: 1
Loop: 0 Loop: 0
Mute: 0 Mute: 0
Spatialize: 0 Spatialize: 0
SpatializePostEffects: 0 SpatializePostEffects: 0
Priority: 128 Priority: 100
DopplerLevel: 1 DopplerLevel: 1
MinDistance: 1 MinDistance: 1
MaxDistance: 500 MaxDistance: 500
+116
View File
@@ -1497,6 +1497,63 @@ Transform:
m_CorrespondingSourceObject: {fileID: 4661362728943144, guid: ce6ad725e758b1344b46e8fe8c00eb64, type: 3} m_CorrespondingSourceObject: {fileID: 4661362728943144, guid: ce6ad725e758b1344b46e8fe8c00eb64, type: 3}
m_PrefabInstance: {fileID: 113615376} m_PrefabInstance: {fileID: 113615376}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
--- !u!1001 &115860106
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 2784853915108793861, guid: 02fce1db4fc201d40a75e8b1fb24451f, type: 3}
propertyPath: m_LocalPosition.x
value: -11.35
objectReference: {fileID: 0}
- target: {fileID: 2784853915108793861, guid: 02fce1db4fc201d40a75e8b1fb24451f, type: 3}
propertyPath: m_LocalPosition.y
value: 1.505
objectReference: {fileID: 0}
- target: {fileID: 2784853915108793861, guid: 02fce1db4fc201d40a75e8b1fb24451f, type: 3}
propertyPath: m_LocalPosition.z
value: -79.2
objectReference: {fileID: 0}
- target: {fileID: 2784853915108793861, guid: 02fce1db4fc201d40a75e8b1fb24451f, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2784853915108793861, guid: 02fce1db4fc201d40a75e8b1fb24451f, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2784853915108793861, guid: 02fce1db4fc201d40a75e8b1fb24451f, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2784853915108793861, guid: 02fce1db4fc201d40a75e8b1fb24451f, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2784853915108793861, guid: 02fce1db4fc201d40a75e8b1fb24451f, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2784853915108793861, guid: 02fce1db4fc201d40a75e8b1fb24451f, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2784853915108793861, guid: 02fce1db4fc201d40a75e8b1fb24451f, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4577442700511520119, guid: 02fce1db4fc201d40a75e8b1fb24451f, type: 3}
propertyPath: m_Name
value: ZombieSpawner (1)
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 02fce1db4fc201d40a75e8b1fb24451f, type: 3}
--- !u!4 &118282469 stripped --- !u!4 &118282469 stripped
Transform: Transform:
m_CorrespondingSourceObject: {fileID: 400000, guid: 1a5f2b92e3d507a438173f443b67a160, type: 3} m_CorrespondingSourceObject: {fileID: 400000, guid: 1a5f2b92e3d507a438173f443b67a160, type: 3}
@@ -22709,6 +22766,63 @@ Transform:
m_CorrespondingSourceObject: {fileID: 4525637063645508, guid: aac3f9c5e29417449b3d93e8cea32bb0, type: 3} m_CorrespondingSourceObject: {fileID: 4525637063645508, guid: aac3f9c5e29417449b3d93e8cea32bb0, type: 3}
m_PrefabInstance: {fileID: 1576416798} m_PrefabInstance: {fileID: 1576416798}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
--- !u!1001 &1577299822
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 2784853915108793861, guid: 02fce1db4fc201d40a75e8b1fb24451f, type: 3}
propertyPath: m_LocalPosition.x
value: -3.66
objectReference: {fileID: 0}
- target: {fileID: 2784853915108793861, guid: 02fce1db4fc201d40a75e8b1fb24451f, type: 3}
propertyPath: m_LocalPosition.y
value: 6.695
objectReference: {fileID: 0}
- target: {fileID: 2784853915108793861, guid: 02fce1db4fc201d40a75e8b1fb24451f, type: 3}
propertyPath: m_LocalPosition.z
value: 14.66
objectReference: {fileID: 0}
- target: {fileID: 2784853915108793861, guid: 02fce1db4fc201d40a75e8b1fb24451f, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2784853915108793861, guid: 02fce1db4fc201d40a75e8b1fb24451f, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2784853915108793861, guid: 02fce1db4fc201d40a75e8b1fb24451f, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2784853915108793861, guid: 02fce1db4fc201d40a75e8b1fb24451f, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2784853915108793861, guid: 02fce1db4fc201d40a75e8b1fb24451f, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2784853915108793861, guid: 02fce1db4fc201d40a75e8b1fb24451f, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2784853915108793861, guid: 02fce1db4fc201d40a75e8b1fb24451f, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4577442700511520119, guid: 02fce1db4fc201d40a75e8b1fb24451f, type: 3}
propertyPath: m_Name
value: ZombieSpawner (2)
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 02fce1db4fc201d40a75e8b1fb24451f, type: 3}
--- !u!1001 &1580376817 --- !u!1001 &1580376817
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -31682,3 +31796,5 @@ SceneRoots:
- {fileID: 1721920305} - {fileID: 1721920305}
- {fileID: 1461267492} - {fileID: 1461267492}
- {fileID: 6285290630150814547} - {fileID: 6285290630150814547}
- {fileID: 115860106}
- {fileID: 1577299822}
+12 -2
View File
@@ -4,15 +4,18 @@ using UnityEngine;
public class ZombieSpawnerLogic : MonoBehaviour public class ZombieSpawnerLogic : MonoBehaviour
{ {
public GameObject Prefab; public GameObject Prefab;
public byte CooldownSeconds = 5; public byte MinCooldownSeconds = 5;
public byte MaxCooldownSeconds = 30;
public byte MaxSpawns = 5; public byte MaxSpawns = 5;
private float _currentSpawnDelay;
private float _lastSpawn; private float _lastSpawn;
private readonly List<GameObject> _spawns = new(); private readonly List<GameObject> _spawns = new();
void Start() void Start()
{ {
_lastSpawn = Time.time; _lastSpawn = Time.time;
PickNewSpawnDelay();
} }
void FixedUpdate() void FixedUpdate()
@@ -21,9 +24,15 @@ public class ZombieSpawnerLogic : MonoBehaviour
AttemptZombieSpawn(); AttemptZombieSpawn();
} }
private void PickNewSpawnDelay()
{
_currentSpawnDelay = Random.Range(MinCooldownSeconds, MaxCooldownSeconds);
Debug.Log($"Zombie spawner new spawn delay: {_currentSpawnDelay}s");
}
private void AttemptZombieSpawn() private void AttemptZombieSpawn()
{ {
if (Time.time - _lastSpawn < CooldownSeconds) if (Time.time - _lastSpawn < _currentSpawnDelay)
{ {
return; return;
} }
@@ -38,6 +47,7 @@ public class ZombieSpawnerLogic : MonoBehaviour
var newZombie = Instantiate(Prefab, transform); var newZombie = Instantiate(Prefab, transform);
_spawns.Add(newZombie); _spawns.Add(newZombie);
_lastSpawn = Time.time; _lastSpawn = Time.time;
PickNewSpawnDelay();
} }
private void RemoveDestroyedZombies() => _spawns.RemoveAll(zombie => zombie == null); private void RemoveDestroyedZombies() => _spawns.RemoveAll(zombie => zombie == null);
+3 -2
View File
@@ -10,8 +10,9 @@ Unity version: `6000.3.13f1` (LTS)
- [ ] Hudba počas hrania - [ ] Hudba počas hrania
- [ ] Viac spawnerov - [ ] Viac spawnerov
- [ ] Inteligentnejší spawner - [ ] Inteligentnejší spawner
- randomizácia delayu medzi spawnmi - [x] randomizácia delayu medzi spawnmi
- [ ] Obmedzenie priestoru aby sa nedalo dostať von z mapy (neni nutné) - [ ] deaktivovať spawner ak hráč je príliš ďaleko (*optimalizácia - neni nutné*)
- [ ] Obmedzenie priestoru aby sa nedalo dostať von z mapy (*neni nutné*)
- [x] Opraviť opakujúciú "Die" animáciu keď sa spamuje strielanie zombíka - [x] Opraviť opakujúciú "Die" animáciu keď sa spamuje strielanie zombíka
- [x] Opraviť posun zombíka na podlahe keď umiera - [x] Opraviť posun zombíka na podlahe keď umiera
- [x] Opraviť aby zombíci nevedeli ľahnúť pri kolízii s hráčom alebo inými zombíkmi - [x] Opraviť aby zombíci nevedeli ľahnúť pri kolízii s hráčom alebo inými zombíkmi