void Update()
    {
        if (player == null)
        {
            player = GameObject.FindGameObjectWithTag("Player");
        }

        if (playerInventory == null && player != null)
        {
            playerInventory = player.GetComponent <ShootBehaviour>();
        }


        // Handle player pick weapon action.
        if (this.pickable && Input.GetKeyDown(KeyCode.E))
        {
            // Disable weapon physics.
            rbody.isKinematic = true;
            this.col.enabled  = false;

            // Setup weapon and add in player inventory.
            playerInventory.AddWeapon(this);
            Destroy(interactiveRadius);
            this.Toggle(true);
            this.pickable = false;

            // Change active weapon HUD.
            TooglePickupHUD(false);
        }
    }
示例#2
0
 public void PickUpWeapon(ShootBehaviour shootBehaviour)
 {
     playerShootBehavior = shootBehaviour;
     rbody.isKinematic   = true;
     this.col.enabled    = false;
     playerShootBehavior.AddWeapon(this);
     interactiveRadius.enabled = false;
     this.Pickable             = false;
     currentInventoryAmmoCount = playerShootBehavior.GetInventory().GetCurrentAmmo(weaponType) + mag;
     playerShootBehavior.GetInventory().AddAmmoToInventory(weaponType, mag);
 }
示例#3
0
 private void Update()
 {
     if (isPickable == true && Input.GetButtonDown(ButtonName.Pick))
     {
         weaponRigidbody.isKinematic = true;
         weaponCollider.enabled      = false;
         playerInventory.AddWeapon(this);
         Destroy(interactiveRadius);
         ToggleWeapon(true);
         isPickable = false;
         TogglePickHUD(false);
     }
 }
    private void Update()
    {
        if (this.pickable && Input.GetButtonDown(ButtonName.Pick))
        {
            // 주울 수 있는 상태에서 pick 버튼을 눌렀다

            //disable physics weapon
            weaponRigidbody.isKinematic = true;
            weaponCollider.enabled      = false;
            playerInventory.AddWeapon(this);
            Destroy(interactiveRadius);
            this.Toggle(true);
            this.pickable = false;
            TogglePickHUD(false);
        }
    }
示例#5
0
    void Update()
    {
        // Handle player pick weapon action.
        if (this.pickable && Input.GetButtonDown(playerInventory.pickButton))
        {
            // Disable weapon physics.
            rbody.isKinematic = true;
            this.col.enabled  = false;

            // Setup weapon and add in player inventory.
            playerInventory.AddWeapon(this);
            Destroy(interactiveRadius);
            this.Toggle(true);
            this.pickable = false;

            // Change active weapon HUD.
            TooglePickupHUD(false);
        }
    }
示例#6
0
 //player interaction with weapons
 void OnTriggerStay(Collider other)
 {
     if (!isLocalPlayer)
     {
         return;
     }
     if (other.tag == "Gun")
     {
         InteractiveWeapon tempWeapon = other.GetComponent <InteractiveWeapon>();
         tempWeapon.pickable = true;
         tempWeapon.TooglePickupHUD(true, this.playerCamera);
         if (Input.GetButtonDown(Player.pickButton) && tempWeapon && tempWeapon.pickable == true)//pick up weapon
         {
             this.Weapon = tempWeapon;
             if (Weapon.label == "AWM")
             {
                 Player.shotRateFactor = 0.1f;
             }
             else
             {
                 Player.shotRateFactor = 1f;
             }
             Player.AddWeapon(Weapon);
             tempWeapon.TooglePickupHUD(false, this.playerCamera);
             Weapon.Toggle(true);
             if (isServer)
             {
                 RpcpickWeapon(this.Weapon.id);
             }
             else
             {
                 CmdpickWeapon(this.Weapon.id);
             }
         }
     }
 }