void Start() { audioCtrlScript = GetComponent <audioControl>(); dedCam = GameObject.Find("waitingCam"); // if (PlayerPrefs.HasKey("coins")) // { // totalCoins = PlayerPrefs.GetInt("coins"); // } // PlayerPrefs.SetInt ("coins", totalCoins); rb = GetComponent <Rigidbody2D> (); SetCheckpoint(false); res = false; dead = false; dc = GetComponent <DiscordController>(); dc.updateDetails(String.Format("In Multiplayer | ♥ {1}", SceneManager.GetActiveScene().name.Substring(3), health)); dc.updateStartTime(); if (!isServer) { dedCam.SetActive(false); } if (!GetComponent <Camera>().GetComponent <NetworkView>().isMine) { Camera.main.GetComponent <Camera>().enabled = false; } }
public void TakeDamage() { if (health >= 2 && timeSinceLastDMG >= 1f) { Respawn(); //need to change to knockback later health--; PlayerPrefs.SetInt("health", health); Debug.Log("damage"); Debug.Log(timeSinceLastDMG); } else { health--; Death(); } timeSinceLastDMG = 0; dc.updateDetails(String.Format("In Level {0} | ♥ {1}", SceneManager.GetActiveScene().name.Substring(3), health)); }
void Start() { audioCtrlScript = GetComponent <audioControl>(); PlayerPrefs.SetInt("health", 3); if (PlayerPrefs.HasKey("coins")) { totalCoins = PlayerPrefs.GetInt("coins"); } PlayerPrefs.SetInt("coins", totalCoins); rb = GetComponent <Rigidbody2D> (); SetCheckpoint(false); res = false; dead = false; dc = GetComponent <DiscordController>(); dc.updateDetails(String.Format("In Level {0} | ♥ {1}", SceneManager.GetActiveScene().name.Substring(3), health)); dc.updateStartTime(); }