private void OnTriggerExit(Collider other) { if (other.CompareTag("LoadingPoint") && _defaultWorker.FacingRight) { _collectingCart = null; } }
private void OnTriggerEnter(Collider other) { if (other.CompareTag("LoadingPoint") && _defaultWorker.FacingRight) { FindTopLevelParent(other.transform); _collectingCart = _topLevelParent.transform.Find("CollectBoxHolder/CollectBox").gameObject.GetComponent <CollectingCart>(); if (_collectingCart._amountInCart == 0) { AmountElevatorCollect = AmountElevatorCollect; } else if (_collectingCart._amountInCart >= _defaultWorker.Capacity) { AmountElevatorCollect += _defaultWorker.Capacity; _collectingCart._amountInCart -= _defaultWorker.Capacity; } else if (_collectingCart._amountInCart < _defaultWorker.Capacity) { AmountElevatorCollect += _collectingCart._amountInCart; _collectingCart._amountInCart = 0; } } }
// Use this for initialization void Start() { _collectingCart = null; }