// Use this for initialization void Start() { _characterDriver = GetComponent <CharacterDriver>(); _goTowardsTarget = true; _inPlay = true; transform.position = _startingPosition; _tray = GetComponentInChildren <DrinkPlacement>(); }
private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject == _table) { if (OnReachedTable != null) { OnReachedTable(_table); } DrinkPlacement tablePlacement = _table.GetComponent <DrinkPlacement>(); while (_tray.IsEmpty()) { tablePlacement.AddDrink(_tray.GetDrink()); } _table = null; _goTowardsTarget = false; } }