// Use this for initialization void Start() { playerGun = GetComponent <Gun>(); playerAction = GetComponent <PlayerAction>(); playerHealth = GetComponent <HealthValues>(); waveValues = FindObjectOfType <WaveValues>(); scoreValues = FindObjectOfType <ScoreValues>(); }
// Use this for initialization void Start() { if (!isServer) { Destroy(this); } healthValues = GetComponent <HealthValues>(); }
void UpdateHealth() { if (playerHealth == null) { playerHealth = GetComponent <HealthValues>(); } if (playerHealth.isAlive) { float actualHealth = (float)playerHealth.actualHealth; float totalHealth = (float)playerHealth.maxHealth; uiHealthState.fillAmount = Mathf.Lerp(uiHealthState.fillAmount, actualHealth / totalHealth, fillSpeed); } }
public void PlayerRespawn() { HealthValues healthValues = GetComponent <HealthValues>(); // Reset the amount of health to his maximum healthValues.actualHealth = healthValues.maxHealth; // Add the player to the player alive count waveValues.playerAlive++; // Move the player to the respawn position transform.position = GameObject.FindGameObjectWithTag("Respawn").transform.position; // Enable the player EnablePlayer(); }