예제 #1
0
    /// <summary>
    /// 偷懒员工处理
    /// </summary>
    public NpcAIWorkerCpt HandleForDazeWorker()
    {
        Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);

        RaycastHit2D[] hitAll = Physics2D.RaycastAll(mousePos, Vector2.zero);
        foreach (RaycastHit2D itemHit in hitAll)
        {
            if (itemHit.collider.transform.tag.Equals(TagInfo.Tag_NpcBody))
            {
                GameObject     objSelect   = itemHit.collider.gameObject;
                NpcAIWorkerCpt npcAIWorker = objSelect.GetComponentInParent <NpcAIWorkerCpt>();
                if (npcAIWorker)
                {
                    //如果在偷懒 则惊醒
                    if (npcAIWorker.GetWorkerStatus() == NpcAIWorkerCpt.WorkerIntentEnum.Daze)
                    {
                        CursorHandler.Instance.SetCursor(CursorHandler.CursorType.Knock);
                        return(npcAIWorker);
                    }
                }
            }
        }
        CursorHandler.Instance.SetCursor(CursorHandler.CursorType.Def);
        return(null);
    }
예제 #2
0
 public void HandleForUI()
 {
     if (NpcHandler.Instance.builderForWorker.listNpcWorker != null)
     {
         int numberForIdle    = 0;
         int numberForChef    = 0;
         int numberForWaiter  = 0;
         int numberForAccount = 0;
         int numberForAccost  = 0;
         int numberForBeater  = 0;
         for (int i = 0; i < NpcHandler.Instance.builderForWorker.listNpcWorker.Count; i++)
         {
             NpcAIWorkerCpt npcWorker = NpcHandler.Instance.builderForWorker.listNpcWorker[i];
             NpcAIWorkerCpt.WorkerIntentEnum workerIntent = npcWorker.GetWorkerStatus();
             if (workerIntent == NpcAIWorkerCpt.WorkerIntentEnum.Idle || workerIntent == NpcAIWorkerCpt.WorkerIntentEnum.Daze)
             {
                 numberForIdle++;
             }
             else if (workerIntent == NpcAIWorkerCpt.WorkerIntentEnum.Cook)
             {
                 numberForChef++;
             }
             else if (workerIntent == NpcAIWorkerCpt.WorkerIntentEnum.WaiterSend ||
                      workerIntent == NpcAIWorkerCpt.WorkerIntentEnum.WaiterClean ||
                      workerIntent == NpcAIWorkerCpt.WorkerIntentEnum.WaiterSend)
             {
                 numberForWaiter++;
             }
             else if (workerIntent == NpcAIWorkerCpt.WorkerIntentEnum.Accounting)
             {
                 numberForAccount++;
             }
             else if (workerIntent == NpcAIWorkerCpt.WorkerIntentEnum.AccostSolicit ||
                      workerIntent == NpcAIWorkerCpt.WorkerIntentEnum.AccostGuide)
             {
                 numberForAccost++;
             }
             else if (workerIntent == NpcAIWorkerCpt.WorkerIntentEnum.Beater)
             {
                 numberForBeater++;
             }
         }
         tvNumberForIdle.text    = numberForIdle + "";
         tvNumberForChef.text    = numberForChef + "";
         tvNumberForWaiter.text  = numberForWaiter + "";
         tvNumberForAccount.text = numberForAccount + "";
         tvNumberForAccost.text  = numberForAccost + "";
         tvNumberForBeater.text  = numberForBeater + "";
     }
 }