Exemplo n.º 1
0
    void Start()
    {
        if (m_stonePowerSet == false)
        {
            m_stonePowerSet = true;
            for (int i = 0; i < activeStone.Length; i++)
            {
                stonePower[i] = Random.Range(30, 80);
            }
        }

        currentFog = fogStrength;
        canSelect  = true;

        m_playerController = FindObjectOfType <Player_Controller>();
        m_gunGeneric       = FindObjectOfType <Gun_Generic>();
        m_waveSystem       = FindObjectOfType <Wave_System>();

        m_defaultDefence        = m_playerController.m_defenceValue;
        m_defaultHealth         = m_playerController.playerHealth;
        m_defaultDamageCooldown = prototypeWeapon.damageCoolDown;
    }
Exemplo n.º 2
0
    public int AmmoWorth;          // the amount of ammo that pack is worth


    void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("Player"))                         // when the player walks over it
        {
            Gun_Generic Gun = FindObjectOfType <Gun_Generic>(); // find the active weapon

            if (Gun)                                            // if the player has a gun equiped
            {
                if (Gun.m_name == GunType || GunType == "ALL")  // if the name of the weapon matches the ammo type or the type is universal
                {
                    // increase the gun ammo count
                    Gun.m_currentAmmo += AmmoWorth;
                    // if the ammo is
                    if (Gun.m_currentAmmo > Gun.m_maxAmmo)
                    {
                        Gun.m_currentAmmo = Gun.m_maxAmmo;
                    }

                    Gun.f_updateUI();    // update the UI so it reflects the current amount
                    Destroy(gameObject); // destroy the ammo so it can't be infinate
                }
            }
        }
    }