Exemplo n.º 1
0
    // SwitchToPrimary method
    void SwitchToPrimary(GameObject _Primary)
    {
        // Set Active (false) the current weapon
        if (weapon != null)
        {
            weapon.SetActive(false);
        }

        _PlayerShoot.CancelInvoke("Shoot");
        weapon = _Primary.transform.GetChild(0).gameObject;
        weapon.SetActive(true);
        if (weapon.tag == "L96")
        {
            CrossHair.SetActive(false);
        }
        else
        {
            CrossHair.SetActive(true);
        }

        CurrentWeapon            = PrimaryWeapon;
        _PlayerShoot.CurrentAmmo = _PlayerShoot.CurrentAmmoP;
        Primary   = true;
        Secondery = false;

        currentGraphics              = weapon.GetComponent <WeaponGraphics>();
        _PlayerShoot.currentWeapon   = CurrentWeapon;
        _PlayerShoot.weaponAnimation = currentGraphics.GetComponent <WeaponAnimation>();
    }
Exemplo n.º 2
0
    private void Die()
    {
        deaths += 1;

        isDead = true;

        shoot.CancelInvoke("Shoot");

        for (int i = 0; i < disableOnDeath.Length; i++)
        {
            disableOnDeath[i].enabled = false;
        }

        for (int i = 0; i < enableOnDeath.Length; i++)
        {
            enableOnDeath[i].enabled = true;
        }

        CancelInvoke("Damaged");
        InvokeRepeating("Dead", 0f, 0.1f);

        rb.isKinematic = false;

        StartCoroutine(Respawn());
    }
Exemplo n.º 3
0
    private void Die()
    {
        isDead = true;
        playerShoot.CancelInvoke();
        for (int i = 0; i < disableOnDeath.Length; i++)
        {
            disableOnDeath[i].enabled = false;
        }

        Collider col = GetComponent <Collider>();

        if (col != null)
        {
            col.enabled = false;
        }

        Debug.Log(transform.name + " IS DEAD!!!!");
        if (isLocalPlayer)
        {
            uiManager.ShowDeathText();
        }
        Invoke("Respawn", GameManager.instance.matchSettings.respawnTime);
    }