コード例 #1
0
    public void AddWeaponType(Tps_Weapon weapon)
    {
        playerInventory.AddWeapon(weapon);
        weaponText.text += (" " + (playerInventory.FindeWeaponIndex(weapon) + 1) + ": " + weapon.WeaponName);

        if (!playerInventory.HasWeapon(weapon))
        {
            weaponContainer.Add(weapon);
        }
    }
コード例 #2
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject == player)
     {
         AudioSource.PlayClipAtPoint(WeaponGrab, transform.position);
         if (!playerInventory.HasWeapon(this))
         {
             controller.AddWeaponType(this);
             this.transform.parent   = GameObject.FindGameObjectWithTag(Tags.weaponContainer).transform;
             this.transform.position = GameObject.FindGameObjectWithTag(Tags.weaponContainer).transform.position;
             this.gameObject.SetActive(false);
         }
     }
 }