Пример #1
0
    void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Exit")
        {
            return;
        }
        if (other.gameObject.GetComponent <FestivalObject> ().fulfillsNeed == currentNeed)
        {
            animator.SetInteger("State", AnimationConstants.IDLE);

            if (currentNeed == Needs.BLADDER)
            {
            }
            else if (currentNeed == Needs.HYGIENE)
            {
            }
            else if (currentNeed == Needs.FUN)
            {
                income.AddCash(5);
                cashSpent += 5;
                animator.SetInteger("State", AnimationConstants.WATCH);
            }
            else if (currentNeed == Needs.THIRST)
            {
                income.AddCash(10);
                cashSpent += 10;
            }
            else if (currentNeed == Needs.HUNGER)
            {
                income.AddCash(5);
                cashSpent += 5;
            }

            highestPriority.value = 100;
            currentState          = States.Busy;
            StartCoroutine(Wait());
        }
    }
Пример #2
0
    private IEnumerator GenerateVisitors(float delay)
    {
        if (visitorsPool.Count > 0)
        {
            GameObject visitor = visitorsPool.Pop();
            visitor.SetActive(true);
            visitor.transform.SetParent(visitorsContainer);
            visitor.transform.position = visitor.transform.position + new Vector3(Random.Range(-3f, 3f), 0, Random.Range(-3f, 3f));
            income.AddCash(5);
        }
        yield return(new WaitForSeconds(delay));

        StartCoroutine(GenerateVisitors(Random.Range(minSpawnDelay, maxSpawnDelay)));
    }