private void decreaseNeeds() { foreach (NeedObject no in needs) { if (doing is idle.using_activity && targetObject.getNeed() == no.getNeed()) { no.increaseBy(targetObject.getWeight()); } else { if (Random.Range(0, 8) % 2 == 0) { no.decrease(); } } } }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Escape)) { Debug.Log("exit"); Application.Quit(); } if (unlockUpdate) { foreach (GameObject go in activ_list) { ActivityObject ao = go.GetComponent <ActivityObject>(); if (ao.getNeed() == activities.social) { go.gameObject.transform.position = ao.getLocation(); //go.gameObject.transform.Translate( ao.getLocation(),Space.World); NPCObject npc_temp = go.GetComponent <NPCObject>(); dict[go].material.SetColor("_Color", npc_temp.getStatusColor()); if (npc_temp.getCurrentIdleStats() == idle.searching) { ao.invokeStatusMassage("(" + ao.getX() + "," + ao.getY() + ")"); } else { ao.invokeStatusMassage(npc_temp.getOccupiedActivity() + ""); } } else { if (ao.getStatus()) { ao.invokeStatusMassage("Occupied"); dict[go].material.SetColor("_Color", Color.red); } else { ao.invokeStatusMassage("avilable"); dict[go].material.SetColor("_Color", Color.green); } } } unlockUpdate = false; } }
public List <ActivityObject> getRelevantActivities(activities activity) { List <ActivityObject> l = new List <ActivityObject>(); foreach (GameObject go in activ_list) { ActivityObject ao = go.GetComponent <ActivityObject>(); //Debug.Log("object need " + ao.getNeed()+ " vs " + activity); if (ao.getNeed() == activity) { //Debug.Log("match found"); l.Add(ao); } } //Debug.Log(l.Count); return(l); }