Last active
May 1, 2019 22:44
-
-
Save SenpaiRar/4f96567d14ae8fef5f69bdfcdee85570 to your computer and use it in GitHub Desktop.
This is the script for weapons that are on the ground
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class Weapon_Pickup : ClickableParent { | |
public Weapon_Template thisWeaponData; | |
public float MinimumDistance; | |
public override void OnClick(Vector3 ClickPosition) | |
{ | |
if(Vector3.Distance(transform.position, ClickPosition) <= MinimumDistance){ //we check if the player is within distance | |
//We find the Player's gameoject and get the Weapon_Parent script on it. We then use the PickUpWeapon function and feed the Weapon_Template from this object | |
GameObject.Find("Player").GetComponent<Weapon_Parent>().PickUpWeapon(thisWeaponData); | |
Destroy(gameObject); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment