void Start() { _playerInput = transform.parent.parent.GetComponent <PlayerInput_Script>(); _playerInv = _playerInput.GetComponent <PlayerInv_Script>(); _swordPivot = transform.parent; _audioSource = _playerInv.GetComponent <AudioSource>(); }
void OnTriggerEnter2D(Collider2D col) { if (col.tag == "Player") { PlayerInv_Script pi = col.GetComponent <PlayerInv_Script>(); if (pi.BloodAmount < pi.MaxBloodAmount) { pi.GainBlood(BloodValue); Destroy(this.gameObject); } } }
void OnTriggerEnter2D(Collider2D col) { if (col.tag == "Player") { Debug.Log("Player at bed"); if (_playerInv == null) { _playerInv = col.GetComponent <PlayerInv_Script>(); } _allowInteraction = true; PlanetBedInfoScreen.SetActive(true); UpdateInfoText(); } }
void Start() { _playerInv = FindObjectOfType <PlayerInv_Script>(); _playerInput = _playerInv.GetComponent <PlayerInput_Script>(); _sword = _playerInv.transform.GetComponentInChildren <Sword_Script>(); _gameManangerScript = _playerInv.GameManagScript; _infoTextScreen = ShopButtons[0].transform.parent.parent.GetChild(2).gameObject; _infoText = _infoTextScreen.GetComponentInChildren <TextMeshProUGUI>(); _audioSource = GetComponent <AudioSource>(); ShopUI.SetActive(false); UpdateBloodBankUI(); _shopButtonsTexts = new List <TextMeshProUGUI>(); SetUpButtons(); }