private void Start() { _player = FindObjectOfType <PlayerModel>(); _goldList = new List <GoldModel>(); _listOfGold = FindObjectOfType <ListOfGoldModel>(); _goldCollector = FindObjectOfType <GoldCollector>(); }
private void OnTriggerEnter(Collider other) { _goldCollector = other.gameObject.GetComponent <GoldCollector>(); if (_goldCollector != null && !_isCollected) { _isCollected = true; _goldCollector.AddGold(); _goldCollector.PlaceGold(this.transform, this); } }