public void GetScripts() //get script components { try { PC = GameObject.FindWithTag("Player").GetComponent <PlayerController>(); } catch { PC = null; } try { PS = GameObject.Find("Pistol").GetComponent <PlayerShooting>(); if (PS != null) { PS.CancelReload(); } } catch { PM = null; } try { PM = GameObject.Find("Machete").GetComponent <PlayerMelee>(); } catch { PM = null; } try { UCI = GameObject.Find("Player").GetComponent <UseConsumableItem>(); if (UCI != null && UseConsumableItem.playerIsHealing) { UCI.StopHeal(); } } catch { UCI = null; } try { SS = GameObject.FindWithTag("Player").GetComponent <SlotSelection>(); } catch { SS = null; } }
void Awake() { PS = pistol.GetComponent <PlayerShooting>(); UCI = GameObject.FindGameObjectWithTag("Player").GetComponent <UseConsumableItem>(); try { CCO = GameObject.FindGameObjectWithTag("CarryOverInventory").GetComponent <CarryOverInventory>(); } catch { CCO = null; } }