Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        animator = GetComponent <Animator>();
        target   = gameObject;

        bladder = gameObject.AddComponent <Need> ();
        hunger  = gameObject.AddComponent <Need>();
        hygiene = gameObject.AddComponent <Need> ();
        fun     = gameObject.AddComponent <Need>();
        thirst  = gameObject.AddComponent <Need>();

        GameObject map = GameObject.FindGameObjectWithTag("Map");

        sceneObject = map.GetComponent <SceneObject> ();

        bladder.CreateNeed(Needs.BLADDER, Random.Range(1f, 5f));
        sortedNeeds.Add(bladder);

        hunger.CreateNeed(Needs.HUNGER, Random.Range(1f, 5f));
        sortedNeeds.Add(hunger);

        hygiene.CreateNeed(Needs.HYGIENE, Random.Range(1f, 5f));
        sortedNeeds.Add(hygiene);

        fun.CreateNeed(Needs.FUN, Random.Range(3f, 6f));
        sortedNeeds.Add(fun);

        thirst.CreateNeed(Needs.THIRST, Random.Range(1f, 5f));
        sortedNeeds.Add(thirst);

        InvokeRepeating("UpdateNeed", 2, 5f);

        highestPriority = fun;

        GameObject cash = GameObject.FindGameObjectWithTag("Cash");

        income = cash.GetComponent <Income> ();

        int random = (int)Random.Range(0, names.Length);

        name = names[random];

        exit = GameObject.FindGameObjectWithTag("Exit");
        CalculateOverallHapiness();
        agent = GetComponent <NavMeshAgent> ();
    }