Ammo, wave gui, weapon staty, pilulky

This commit is contained in:
Kotrba Filip
2020-02-02 13:11:38 +01:00
parent efd1736239
commit b66ae414e3
13 changed files with 873 additions and 181 deletions

View File

@@ -39,9 +39,9 @@ public class BarricadeManager : MonoBehaviour
public void addPlank()
{
if (health < (barricadePlanks.Count * 35)) {
if (health < (barricadePlanks.Count * 20)) {
audioSource.PlayOneShot(buildSound);
health += 35;
health += 20;
offMeshLink.enabled = false;
}
}
@@ -59,7 +59,7 @@ public class BarricadeManager : MonoBehaviour
{
for (int i = 0; i < barricadePlanks.Count; i++)
{
if (i < (health / 35)) {
if (i < (health / 20)) {
barricadePlanks[i].SetActive(true);
}
else

View File

@@ -10,6 +10,7 @@ public class DayManager : MonoBehaviour
public AudioSource mainSource = new AudioSource();
public AudioClip dayClip;
public AudioClip nigtClip;
public GuiManager guiManager;
public int daySurvived = 0;
@@ -22,6 +23,10 @@ public class DayManager : MonoBehaviour
// Update is called once per frame
void Update()
{
if (guiManager != null)
{
guiManager.setWave(daySurvived+1);
}
float sunRotationX = transform.localEulerAngles.x;
sunRotationX = (sunRotationX > 180) ? sunRotationX - 360 : sunRotationX;
if (sunRotationX < 0 && !night)

View File

@@ -9,6 +9,7 @@ public class GuiManager : MonoBehaviour
public Text Wood;
public Text Ammo;
public Image healthBar;
public Text waves;
// Start is called before the first frame update
void Start()
@@ -35,4 +36,9 @@ public class GuiManager : MonoBehaviour
{
healthBar.fillAmount = health;
}
public void setWave(int wave)
{
waves.text = "Wave: " + wave;
}
}

View File

@@ -28,6 +28,10 @@ public class PlayerManager : MonoBehaviour
public int selectedWeapon = 0;
private float selectRate = 1;
private float selectTime = 1;
public AudioSource audio;
public AudioClip lose;
private float nextMapeTime = 2;
private float nextMapeTime2 = 2;
// Start is called before the first frame update
@@ -58,7 +62,14 @@ public class PlayerManager : MonoBehaviour
if (actualHealth <= 0)
{
SceneManager.LoadScene(SceneManager.GetActiveScene().name, LoadSceneMode.Single);
if (audio != null && lose != null && (nextMapeTime2 + 1) <= Time.time)
{
audio.PlayOneShot(lose);
nextMapeTime2 = nextMapeTime + Time.time;
}
if (nextMapeTime2 <= Time.time) {
SceneManager.LoadScene(SceneManager.GetActiveScene().name, LoadSceneMode.Single);
}
}
float hpInPrcent = (actualHealth / (health / 100.0f));