Exemple #1
0
 private void Awake()
 {
     player            = GameObject.FindGameObjectWithTag("Player");
     fpsController     = player.GetComponent <FPSControllerLPFP.FpsControllerLPFP>();
     handgun           = player.GetComponentInChildren <HandgunScriptLPFP>();
     playerCanvas      = player.GetComponentInChildren <Canvas>();
     playerInteract    = player.GetComponent <PlayerInteract>();
     playerAudioSource = player.GetComponent <AudioSource>();
 }
    private void Start()
    {
        //Save the weapon name
        storedWeaponName = weaponName;
        //Get weapon name from string to text
        currentWeaponText.text = weaponName;
        //Set total ammo text from total ammo int
        totalAmmoText.text = ammo.ToString();

        //Weapon sway
        initialSwayPosition = transform.localPosition;

        //Set the shoot sound to audio source
        shootAudioSource.clip = SoundClips.shootSound;

        currentMaxSwayAmount = maxSwayAmount;

        UpdateAmmoText();
        holstered        = true;
        crosshair.sprite = crosshairDot;
        hasBeenHolstered = true;
        ammoText.text    = "";
        current          = this;
    }