Ammo, wave gui, weapon staty, pilulky
This commit is contained in:
@@ -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
|
||||
|
@@ -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)
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -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));
|
||||
|
Reference in New Issue
Block a user