Now shows wave num

This commit is contained in:
BOT Alex 2024-04-21 11:10:18 +02:00
parent ca2bbb2e72
commit 99caba0fcc
4 changed files with 220 additions and 0 deletions

View File

@ -134,6 +134,42 @@ MonoBehaviour:
m_hasFontAssetChanged: 0 m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0} m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0} m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!1 &175775968717889075
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4451447212631766592}
m_Layer: 5
m_Name: WaveUI
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &4451447212631766592
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 175775968717889075}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1968202381421194203}
m_Father: {fileID: 3367038424042638127}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &215452377197404683 --- !u!1 &215452377197404683
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -597,6 +633,7 @@ GameObject:
- component: {fileID: 1977405528458548599} - component: {fileID: 1977405528458548599}
- component: {fileID: 1670233975246388694} - component: {fileID: 1670233975246388694}
- component: {fileID: 6882932966758703109} - component: {fileID: 6882932966758703109}
- component: {fileID: 4279539925778833905}
m_Layer: 5 m_Layer: 5
m_Name: GameUI m_Name: GameUI
m_TagString: Untagged m_TagString: Untagged
@ -626,6 +663,7 @@ RectTransform:
- {fileID: 9000047314404377693} - {fileID: 9000047314404377693}
- {fileID: 7211211680280156960} - {fileID: 7211211680280156960}
- {fileID: 6256671941795819917} - {fileID: 6256671941795819917}
- {fileID: 4451447212631766592}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
@ -763,6 +801,19 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: b3133f56145d6d44a99566fdb8dacfec, type: 3} m_Script: {fileID: 11500000, guid: b3133f56145d6d44a99566fdb8dacfec, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
--- !u!114 &4279539925778833905
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 715023913428069073}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dfac81b02cbef634d8f73a9b963b6faf, type: 3}
m_Name:
m_EditorClassIdentifier:
WaveDisplayText: {fileID: 5088525294373898032}
--- !u!1 &916661619396280674 --- !u!1 &916661619396280674
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -4296,6 +4347,141 @@ MonoBehaviour:
r: {x: 0, y: 0, z: 5, w: 5} r: {x: 0, y: 0, z: 5, w: 5}
rect2props: {x: 0.00000047683716, y: 2.4999986, z: 10.995511, w: 10.995511} rect2props: {x: 0.00000047683716, y: 2.4999986, z: 10.995511, w: 10.995511}
image: {fileID: 3990110949884708462} image: {fileID: 3990110949884708462}
--- !u!1 &7486644151878750019
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1968202381421194203}
- component: {fileID: 478676075975252442}
- component: {fileID: 5088525294373898032}
m_Layer: 5
m_Name: Wave num
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1968202381421194203
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7486644151878750019}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 4451447212631766592}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 1}
m_AnchorMax: {x: 0.5, y: 1}
m_AnchoredPosition: {x: 0, y: -124}
m_SizeDelta: {x: 200, y: 50}
m_Pivot: {x: 0.5, y: 1}
--- !u!222 &478676075975252442
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7486644151878750019}
m_CullTransparentMesh: 1
--- !u!114 &5088525294373898032
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7486644151878750019}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: 0
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 42d854f0b5fb38c4f81f6d3dbf7f1a2c, type: 2}
m_sharedMaterial: {fileID: -351613383617831628, guid: 42d854f0b5fb38c4f81f6d3dbf7f1a2c,
type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4279374591
m_fontColor: {r: 1, g: 0.07232696, b: 0.07232696, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 201.1
m_fontSizeBase: 201.1
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 1
m_HorizontalAlignment: 2
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 0
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!1 &7529504426993338500 --- !u!1 &7529504426993338500
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -6,6 +6,8 @@ using UnityEngine.UI;
public class EnemySpawnManager : MonoBehaviour public class EnemySpawnManager : MonoBehaviour
{ {
public int WaveNum = 0;
public bool HasStarted = false; public bool HasStarted = false;
public bool IsAutoPlaying = false; public bool IsAutoPlaying = false;
@ -24,8 +26,14 @@ public class EnemySpawnManager : MonoBehaviour
private Queue<Wave> waveQueue; private Queue<Wave> waveQueue;
private List<GameObject> SpawnedEnemies = new(); private List<GameObject> SpawnedEnemies = new();
public static EnemySpawnManager Instance;
private void Awake() private void Awake()
{ {
if (Instance != null)
Destroy(Instance);
Instance = this;
waveQueue = new Queue<Wave>(levelDefinition.Waves); waveQueue = new Queue<Wave>(levelDefinition.Waves);
if (PlayButton != null) if (PlayButton != null)
@ -74,6 +82,7 @@ public class EnemySpawnManager : MonoBehaviour
void PopWave() void PopWave()
{ {
time = 0; time = 0;
WaveNum++;
Wave spawnWave = waveQueue.Dequeue(); Wave spawnWave = waveQueue.Dequeue();
for (int i = 0; i < spawnWave.groups.Length; i++) for (int i = 0; i < spawnWave.groups.Length; i++)

View File

@ -0,0 +1,14 @@
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
public class WaveUIDisplayer : MonoBehaviour
{
[SerializeField] private TMP_Text WaveDisplayText;
private void Update()
{
WaveDisplayText.text = EnemySpawnManager.Instance.WaveNum.ToString();
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: dfac81b02cbef634d8f73a9b963b6faf
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: