// Start is called before the first frame update void Start() { player = GameObject.FindGameObjectWithTag("Player").GetComponent <weaponChooser>(); sh = GameObject.FindGameObjectWithTag("shop").GetComponent <openShopScript>(); br = GameObject.FindGameObjectWithTag("buttonBr").GetComponent <buyBarrierScript>(); st = GameObject.FindGameObjectWithTag("buttonSt").GetComponent <buySentryScript>(); bb = GameObject.FindGameObjectWithTag("buttonBb").GetComponent <buyBeetlesScript>(); }
// Update is called once per frame void Update() { if (Input.GetKeyDown("1")) { weaponChosen = 1; } else if (Input.GetKeyDown("2")) { weaponChosen = 2; } else if (Input.GetKeyDown("3")) { weaponChosen = 3; } if (weaponChosen == 0) { buyBarrierScript barrier = shopChoice.GetComponent <buyBarrierScript>(); if (barrier.amountOfBarriers > 0) { if (oneInHand == false) { placementModeBarrier(); } } } if (weaponChosen == 1) { buyBarrierScript barrier = shopChoice.GetComponent <buyBarrierScript>(); if (barrier.amountOfBarriers > 0) { if (oneInHand == false) { placementModeSentry(); } } } else if (weaponChosen == 2) { buyBarrierScript barrier = shopChoice.GetComponent <buyBarrierScript>(); if (barrier.amountOfBarriers > 0) { if (oneInHand == false) { placementModeReinforced(); } } } if (barrier.activeSelf == true && weaponChosen != 1) { Destroy(barrier); } }