Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class weaponpurchase : MonoBehaviour {
- public GameObject weaponToActivate;
- public GameObject weaponToDeActivate;
- public bool abletoPurchase = false;
- public int weaponcost;
- public void OnTriggerEnter(Collider other)
- {
- weaponToDeActivate = GameObject.FindGameObjectWithTag("currentweapon");
- abletoPurchase = true;
- }
- public void OnTriggerExit(Collider other)
- {
- abletoPurchase = false;
- weaponToDeActivate = null;
- }
- void Update ()
- {
- if (abletoPurchase == true && Input.GetButtonDown("Activate"))
- {
- weaponToDeActivate.SetActive(false);
- weaponToActivate.SetActive(true);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement