Added a health bar

This commit is contained in:
Pasha Bibko
2026-01-20 15:45:24 +00:00
parent db4ece3445
commit 7307a64e77
4 changed files with 63 additions and 16 deletions

View File

@@ -9,6 +9,7 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 4417313079524746681}
- component: {fileID: 582498797338587669}
m_Layer: 0
m_Name: ShieldBar
m_TagString: Untagged
@@ -26,12 +27,26 @@ Transform:
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 3}
m_LocalScale: {x: 0.050000004, y: 0.050000004, z: 0.05}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 1
m_Children:
- {fileID: 7207716708273798845}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &582498797338587669
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 228621501325938318}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 260819a4950a1f54d921ee3d6b3da010, type: 3}
m_Name:
m_EditorClassIdentifier:
HealthBarObject: {fileID: 850249494288935909}
Spawner: {fileID: 0}
--- !u!1001 &7173193334112115030
PrefabInstance:
m_ObjectHideFlags: 0
@@ -100,6 +115,12 @@ PrefabInstance:
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 7bc83d134a74a2a468929a7200cba18e, type: 3}
--- !u!4 &850249494288935909 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 7512281513308713651, guid: 7bc83d134a74a2a468929a7200cba18e,
type: 3}
m_PrefabInstance: {fileID: 7173193334112115030}
m_PrefabAsset: {fileID: 0}
--- !u!4 &7207716708273798845 stripped
Transform:
m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: 7bc83d134a74a2a468929a7200cba18e,

View File

@@ -422,21 +422,11 @@ PrefabInstance:
propertyPath: m_Name
value: ShieldBar
objectReference: {fileID: 0}
- target: {fileID: 4417313079524746681, guid: c0a03ce6c4f39224299267b83719ceb7,
- target: {fileID: 582498797338587669, guid: c0a03ce6c4f39224299267b83719ceb7,
type: 3}
propertyPath: m_LocalScale.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4417313079524746681, guid: c0a03ce6c4f39224299267b83719ceb7,
type: 3}
propertyPath: m_LocalScale.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4417313079524746681, guid: c0a03ce6c4f39224299267b83719ceb7,
type: 3}
propertyPath: m_LocalScale.z
value: 1
objectReference: {fileID: 0}
propertyPath: Spawner
value:
objectReference: {fileID: 447617108}
- target: {fileID: 4417313079524746681, guid: c0a03ce6c4f39224299267b83719ceb7,
type: 3}
propertyPath: m_LocalPosition.x
@@ -487,6 +477,16 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5539847617648870874, guid: c0a03ce6c4f39224299267b83719ceb7,
type: 3}
propertyPath: m_LocalScale.x
value: 80
objectReference: {fileID: 0}
- target: {fileID: 5539847617648870874, guid: c0a03ce6c4f39224299267b83719ceb7,
type: 3}
propertyPath: m_LocalScale.z
value: 80
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
@@ -1286,7 +1286,7 @@ PrefabInstance:
- target: {fileID: 1912500691838987139, guid: e29ce1fe47a855c4e907d4312c9e9d6e,
type: 3}
propertyPath: m_IsActive
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2020022267469913571, guid: e29ce1fe47a855c4e907d4312c9e9d6e,
type: 3}

View File

@@ -0,0 +1,15 @@
using UnityEngine;
namespace InterfaceOff.WorldScene
{
public class HealthBar : MonoBehaviour
{
public Transform HealthBarObject;
public WindowSpawner Spawner;
private void Update()
{
HealthBarObject.localScale = new Vector3(100f, (20 - Spawner.SpawnedWindowCount) * 5f, 100f);
}
}
}

View File

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