Permalink
Showing
with
514 additions
and 52 deletions.
- +357 −11 SpaceShooter/Assets/Main.unity
- +1 −1 SpaceShooter/Assets/Prefabs/Asteroid.prefab
- +3 −3 SpaceShooter/Assets/Prefabs/Bolt.prefab
- +20 −2 SpaceShooter/Assets/Scripts/DestroyByContact.cs
- +26 −0 SpaceShooter/Assets/Scripts/HealthScript.cs
- +11 −0 SpaceShooter/Assets/Scripts/HealthScript.cs.meta
- +4 −1 SpaceShooter/Assets/Scripts/PlayerController.cs
- +22 −0 SpaceShooter/Assets/Scripts/ScoreScript.cs
- +11 −0 SpaceShooter/Assets/Scripts/ScoreScript.cs.meta
- +30 −8 SpaceShooter/Assets/SpaceShooterRedux (1)/Backgrounds/purple.png.meta
- BIN SpaceShooter/Builds/Build/Builds.data.unityweb
- BIN SpaceShooter/Builds/Build/Builds.wasm.code.unityweb
- +26 −26 SpaceShooter/Builds/Build/Builds.wasm.framework.unityweb
- +3 −0 SpaceShooter/ProjectSettings/TagManager.asset
@@ -0,0 +1,26 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
using UnityEngine.UI; | ||
|
||
public class HealthScript : MonoBehaviour | ||
{ | ||
|
||
public static int healthValue = 100; | ||
Text health; | ||
void Start() | ||
{ | ||
health = GetComponent<Text>(); | ||
} | ||
|
||
// Update is called once per frame | ||
void Update() | ||
{ | ||
health.text = "Health:" + healthValue; | ||
if (healthValue <= 1) | ||
{ | ||
Time.timeScale = 0; | ||
health.text = "Game Over"; | ||
} | ||
} | ||
} |
@@ -0,0 +1,22 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
using UnityEngine.UI; | ||
|
||
|
||
public class ScoreScript : MonoBehaviour | ||
{ | ||
|
||
public static int scoreValue = 0; | ||
Text score; | ||
void Start() | ||
{ | ||
score = GetComponent<Text>(); | ||
} | ||
|
||
// Update is called once per frame | ||
void Update() | ||
{ | ||
score.text = "Score: " + scoreValue; | ||
} | ||
} |
Binary file not shown.
Binary file not shown.