Example #1
0
    private void HasBeenServed()
    {
        Vector3 outOfScreenDestination = ClientDestination.ComputeSpawnOrQuitPosition();

        PutMoneyOnCounter();
        // Clients leaving are shown behind every other clients
        outOfScreenDestination.z = 1;
        StartCoroutine(MoveTowardsDestination(outOfScreenDestination, DestroyClient));
    }
Example #2
0
    private void SpawnClient()
    {
        Client     clientSpawned;
        ClientData clientDataToSpawn;
        GameObject clientSpawnedGameObject;
        GameObject orderSpawnedGameObject;

        clientDataToSpawn       = (_isClientsInfinite) ? (_clientGenerator.GetNextClient()) : (_clientsList.Dequeue());
        clientSpawnedGameObject = Instantiate(_clientGenericPrefab, ClientDestination.ComputeSpawnOrQuitPosition(), Quaternion.identity, transform);
        if (!clientSpawnedGameObject.TryGetComponent <Client>(out clientSpawned))
        {
            Debug.LogError("Error: No Component 'Client' was found on gameObject '" + clientSpawnedGameObject.name + "'.");
        }
        else
        {
            orderSpawnedGameObject = Instantiate(_orderUIPrefab, Camera.main.WorldToScreenPoint(clientSpawnedGameObject.transform.GetChild(0).transform.position), Quaternion.identity, _orderParent);
            clientSpawned.CreateClient(clientDataToSpawn, orderSpawnedGameObject.GetComponent <InteractibleOrder>());
            orderSpawnedGameObject.SetActive(false);
        }
    }