Exemplo n.º 1
0
    void FixedUpdate()
    {
        shieldSprite.color = new Color(color.x, color.y, color.z, shieldCapacity / 100);
        if (shieldCapacity < 20)
        {
            shieldSprite.color = new Color(color.x, color.y, color.z, 0);
            uiPlayerAvater.current.UpdateAvatar("LowLife");
            uiPlayerWarning.current.AddWarningTxt("WARNING! SHIELD DEPLETED!", 3f, new Vector3(99, 00, 00));
        }
        if (shieldCapacity <= 0f)
        {
            shieldCapacity = 0;
            StopAllCoroutines();
            //PLAYER SHIELD LOST
            Instantiate(playerExplosion, transform.position, transform.rotation);

            _playerlifes.LoseLife();
        }
        else if (!isGettingDamage && !isRegenerating && shieldCapacity > 0 && shieldCapacity < 100 && !interuptRegen)
        {
            uiPlayerAvater.current.UpdateAvatar("Normal");
            canRegen = true;
            RegenerateShield(5, 100, 50);
        }
        if (shieldCapacity >= maxShield)
        {
            shieldCapacity = maxShield;
            StopRegeneration();
        }
    }
Exemplo n.º 2
0
    IEnumerator CheckPlayerReturns()
    {
        while (playerLeft)
        {
            yield return(new WaitForSeconds(8f));

            if (playerLeft)
            {
                _lifes.LoseLife();
            }
        }
        StopCoroutine(CheckPlayerReturns());
        yield return(null);
    }
Exemplo n.º 3
0
    IEnumerator CheckPlayerReturns()
    {
        //IF PLAYER CONTINUES: KILL THE PLAYER
        while (playerLeft)
        {
            //Wait for 8sec for player to return
            yield return(new WaitForSeconds(8f));

            //If the player didnt return
            if (playerLeft)
            {
                //kill the player
                _lifes.LoseLife();
            }
        }
        //Stop the check
        StopCoroutine(CheckPlayerReturns());
        yield return(null);
    }