示例#1
0
    void Awake()
    {
        _playerAudio = GetComponent <AudioSource>();
        _movement    = GetComponent <TankMovement>();
        _gun         = GetComponentInChildren <TimedGun>();

        health = startingHealth;
        _startingHealthIconColour = healthIcon.color;
    }
示例#2
0
    private void SelectWeapon()
    {
        if (_prevSelectedWeapon == selectedWeaponIndex)
        {
            return;
        }

        int i = 0;

        foreach (Transform weapon in transform)
        {
            if (i == selectedWeaponIndex)
            {
                weapon.gameObject.SetActive(true);
                selectedWeapon = weapon.GetComponent <TimedGun>();
            }
            else
            {
                weapon.gameObject.SetActive(false);
            }

            i++;
        }
    }