Example #1
0
    // 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;
        }
    }
Example #2
0
    public List <ActivityObject> getAllAvilableActivities()
    {
        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.getStatus())
            {
                l.Add(ao);
            }
        }

        //Debug.Log(l.Count);
        return(l);
    }
Example #3
0
 private void StateCalculator()
 {
     if (targetObject != null)
     {
         if (doing is idle.searching && IsByActivity() && !targetObject.getStatus())
         {
             targetObject.setOcuppied();
             activity_counter = targetObject.getDurration();
             // printToDebug("activity counet init: " + activity_counter, 218);
             path.Clear();
             doing = idle.using_activity;
         }
         if (doing is idle.using_activity && activity_counter == 0)
         {
             targetObject.setUnOcuppied();
             doing = idle.searching;
         }
     }
 }