示例#1
0
 public void fill(Consumable new_content) //Fill Mug w/ new Consumable
 {
     if (content is null)
     {
         content = new_content;
         if (UIContent != null)
         {
             UIContent.DisplayIcon(content.Sprite);
         }
         UIContent.gameObject.SetActive(true);
     }
     else
     {
         Debug.Log(gameObject.name + " cannot be filled (already full) with " + new_content.Type);
     }
 }
示例#2
0
    //Update client attributes in fonction of the newStatus. Should only be called once by Update.
    protected void updateStatus(string newStatus)
    {
        switch (newStatus)
        {
        case "entering":
            client_renderer.color = Color.white;
            toggleAgent(true);
            if (UIWaitingTimer != null)
            {
                UIWaitingTimer.gameObject.SetActive(false);
            }
            break;

        case "waiting":
            client_renderer.color = Color.white;
            toggleAgent(false);
            if (UIWaitingTimer != null)
            {
                UIWaitingTimer.DisplayIcon(true);
                UIWaitingTimer.gameObject.SetActive(true);
            }
            break;

        case "consuming":
            client_renderer.color = Color.white;
            toggleAgent(false);
            if (UIWaitingTimer != null)
            {
                UIWaitingTimer.gameObject.SetActive(false);
            }
            break;

        case "event":
            client_renderer.color = Color.red;
            toggleAgent(true);
            if (UIWaitingTimer != null)
            {
                UIWaitingTimer.gameObject.SetActive(false);
            }
            break;

        case "leaving":
            client_renderer.color = Color.white;
            toggleAgent(true);
            if (UIWaitingTimer != null)
            {
                UIWaitingTimer.gameObject.SetActive(false);
            }
            break;

        default:
            break;
        }

        //Navigation
        if (agent.enabled) //Assign destination
        {
            agent.SetDestination(currentObjective);
        }
        else //Warp to destination
        {
            gameObject.transform.position = currentObjective;
        }

        // if(status=="event"&&!agent.enabled)
        //     Debug.LogWarning("Wrong status update : "+ gameObject.name + _prevStatus + status +" "+ _lastStatusRequest);
    }