public void GoToWaiting() { if (_TheState == TheCustomerStates.Talking) { _TheState = TheCustomerStates.WaitingForOrder; } }
private void Update() { if (_StartCustomer == true) { if (_TheState == TheCustomerStates.Walking) { if (CustomerStates[_CurrentBehaviour].walkingPositions.Length > 0) //If Customer Needs To Walk A Specific Route To Get To The Buying Place, This Does That { transform.position = Vector3.MoveTowards(transform.position, CustomerStates[_CurrentBehaviour].walkingPositions[_CurrentPath].position, MoveSpeed * Time.deltaTime); if (transform.position == CustomerStates[_CurrentBehaviour].walkingPositions[_CurrentPath].position) { if (_CurrentPath < CustomerStates[_CurrentBehaviour].walkingPositions.Length - 1) { _CurrentPath++; } else { _TheState = TheCustomerStates.Talking; } } } else { _TheState = TheCustomerStates.Talking; } } else if (_TheState == TheCustomerStates.Talking) { if (CustomerStates[_CurrentBehaviour].Talk == true) //TODO Additional Logic Needed If Going To Work { _TimeToWait = Time.time + CustomerStates[_CurrentBehaviour].WaitingTime; _TheState = TheCustomerStates.WaitingForOrder; } else { _TimeToWait = Time.time + CustomerStates[_CurrentBehaviour].WaitingTime; _TheState = TheCustomerStates.WaitingForOrder; } } else if (_TheState == TheCustomerStates.WaitingForOrder) { if (_TimeToWait <= Time.time) //Continue With Next State If Not Delete { if (_CurrentBehaviour < CustomerStates.Length - 1) { _CurrentBehaviour++; _TheState = TheCustomerStates.Walking; _CurrentPath = 0; } else { Destroy(gameObject); } } } } }
public void ForceLastState() { _TheState = TheCustomerStates.Walking; _CurrentPath = 0; _CurrentBehaviour = CustomerStates.Length - 1; }