Ejemplo n.º 1
0
 // Use this for initialization
 void Start()
 {
     playerGun    = GetComponent <Gun>();
     playerAction = GetComponent <PlayerAction>();
     playerHealth = GetComponent <HealthValues>();
     waveValues   = FindObjectOfType <WaveValues>();
     scoreValues  = FindObjectOfType <ScoreValues>();
 }
Ejemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        if (!isServer)
        {
            Destroy(this);
        }

        healthValues = GetComponent <HealthValues>();
    }
Ejemplo n.º 3
0
    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);
        }
    }
Ejemplo n.º 4
0
    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();
    }