void Update() { switch (antState) { case AntState.GoingToColony: if (Vector3.Distance(colonyTransform.position, transform.position) < inRange) { SugarCollected = 0; sugarController.ResetSugar(); antState = AntState.CollectingSugar; seek.target = sugarController.GetRandomSugar().transform; } break; } }
void GoToColony() { // state update if (Vector3.Distance(colonyTransform.position, transform.position) < inRange) { SugarCollected = 0; sugarController.ResetSugar(); activeState = CollectSugar; sugar = sugarController.GetRandomSugar(); if (null != sugar) { seek.target = sugar.transform; } } }