Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dyingIsMainstream
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gamejam-gpn15
dyingIsMainstream
Commits
37a7a601
Commit
37a7a601
authored
9 years ago
by
Tim Reiter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
only healthbars of playing players are shown.
healthbars are disabled when a player dies.
parent
769aa1ef
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
1 deletion
+10
-1
UI.prefab
Assets/Resources/Prefabs/UI.prefab
+0
-0
PlayerHealth.cs
Assets/Scripts/PlayerHealth.cs
+10
-1
game.unity
Assets/game.unity
+0
-0
No files found.
Assets/Resources/Prefabs/UI.prefab
View file @
37a7a601
No preview for this file type
This diff is collapsed.
Click to expand it.
Assets/Scripts/PlayerHealth.cs
View file @
37a7a601
...
...
@@ -15,7 +15,15 @@ public class PlayerHealth : MonoBehaviour {
public
void
init
(
int
playerNumber
)
{
string
healthbarName
=
"HealthBar"
+
playerNumber
;
Debug
.
Log
(
healthbarName
);
string
healthbarParentName
=
"HealthBarParent"
+
playerNumber
;
//wichtig um healthbars von nicht vorhandenen spielern auszublenden
GameObject
healthbarParent
=
GameObject
.
Find
(
healthbarParentName
);
//activate all children, which are disabled by default:
foreach
(
Transform
child
in
healthbarParent
.
transform
)
{
child
.
gameObject
.
SetActive
(
true
);
}
healthbar
=
GameObject
.
Find
(
healthbarName
).
GetComponent
<
Scrollbar
>();
if
(
name
.
EndsWith
(
"(Clone)"
))
...
...
@@ -31,6 +39,7 @@ public class PlayerHealth : MonoBehaviour {
Debug
.
Log
(
"Player "
+
name
+
" dead."
);
alive
=
false
;
((
GameStateTracker
)
Object
.
FindObjectOfType
(
typeof
(
GameStateTracker
))).
playerDied
(
name
);
healthbar
.
gameObject
.
SetActive
(
false
);
//hide healthbar
Destroy
(
gameObject
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Assets/game.unity
View file @
37a7a601
No preview for this file type
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment