Пример #1
0
    void Update()
    {
        if (firstDoggo)
        {
            return;
        }

        for (int i = doggosData.Count - 1; i >= 0; i--)
        {
            DoggoStayData dsd = doggosData[i];
            dsd.remainingTime -= Time.deltaTime;
            if (dsd.remainingTime <= 0)
            {
                doggosData.RemoveAt(i);
                ClientAtTheDoorData catdt             = new ClientAtTheDoorData(dsd.dogs);
                Coroutine           doorBellCoroutine = StartCoroutine(DoorbellCoroutine());
                catdt.doorbellCoroutine = doorBellCoroutine;
                clientsData.Add(catdt);
            }
        }

        for (int i = 0; i < clientsData.Count; i++)
        {
            ClientAtTheDoorData catdt = clientsData[i];
            catdt.totalWaitTime += Time.deltaTime;
        }

        if (clientsData.Count > 0)
        {
            door.EnableInteractive();
        }
        else
        {
            door.DisableInteractive();
        }

        maxSpawnedDogsAtOnce += Time.deltaTime / 120;

        delayBetweenPhoneCallsMin -= Time.deltaTime / 5;
        delayBetweenPhoneCallsMax -= Time.deltaTime / 5;

        delayBetweenPhoneCallsMin = Mathf.Max(delayBetweenPhoneCallsMin,
                                              delayBetweenPhoneCallsAbsMin);

        delayBetweenPhoneCallsMax = Mathf.Max(delayBetweenPhoneCallsMax,
                                              delayBetweenPhoneCallsAbsMin);
    }
Пример #2
0
    public void RegisterDogs(Doggo[] dogs)
    {
        float time;

        if (firstDoggo)
        {
            firstDoggo = false;
            time       = firstDoggoStayTime;
        }
        else
        {
            time = UnityEngine.Random.Range(stayTimeMin, stayTimeMax);
        }

        DoggoStayData dsd = new DoggoStayData(dogs, time);

        doggosData.Add(dsd);
        gm.totalNumberOfDoggos += dogs.Length;
    }