// Update is called once per frame void Update() { if (WithinRange() && stateControl.CurrentState() == States.Idle) { if (goalIsSource) { stateControl.StartCollecting(); } else { stateControl.StartDepositing(); } } if (stateControl.CurrentState() != States.Idle && WithinRange() == false) { stateControl.GoIdle(); transferAmount = 1; } }