コード例 #1
0
 void DetermineTarget()
 {
     if (_UAIagent.GetTopAction().handle == Eating)
     {
         _destination = EatingWayPoint.transform.position;
     }
     else if (_UAIagent.GetTopAction().handle == Urinate)
     {
         _destination = ToiletWayPoint.transform.position;
     }
     else if (_UAIagent.GetTopAction().handle == Playing)
     {
         _destination = ComputerWayPoint.transform.position;
     }
 }
コード例 #2
0
ファイル: OverlayUI.cs プロジェクト: fachryip/UtilityAI
    // Update is called once per frame
    void Update()
    {
        for (int i = 0; i < propertyElements.Count; i++)
        {
            propertyElements[i].GetComponent <OverlayUIPropertyElement>().SetPropertyUI();
        }
        for (int i = 0; i < considerationElements.Count; i++)
        {
            considerationElements[i].GetComponent <OverlayUIConsiderationElement>().SetConsiderationUI();
        }
        for (int i = 0; i < actionConsiderationElements.Count; i++)
        {
            actionConsiderationElements[i].GetComponent <OverlayUIConsiderationElement>().SetConsiderationUI();
        }
        for (int i = 0; i < actionElements.Count; i++)
        {
            actionElements[i].GetComponent <OverlayUIActionElement>().SetActionUI();
        }
        if (displayingAgent)
        {
            currentActionText.text = "Current Action: \n" + displayedAgent.GetTopAction().name;
            actionTimerText.text   = "Time Left: " + displayedAgent.actionTimer.ToString("0.00");
        }

        for (int i = 0; i < historyElements.Count; i++)
        {
            Destroy(historyElements[i]);
        }

        historyElements.Clear();

        if (displayingAgent)
        {
            for (int i = 0; i < displayedAgent.actionHistory.Count; i++)
            {
                actionHistoryContent.GetComponent <RectTransform>().sizeDelta = new Vector2(155, historyElements.Count * 15 + 15);
                GameObject tempHistory = Instantiate(historyElement,
                                                     new Vector3(actionHistoryContent.transform.position.x,
                                                                 actionHistoryContent.transform.position.y,
                                                                 actionHistoryContent.transform.position.z), Quaternion.identity) as GameObject;
                tempHistory.GetComponent <Text> ().text = displayedAgent.actionHistory [i];
                tempHistory.transform.SetParent(actionHistoryContent.transform);
                historyElements.Add(tempHistory);
            }

            if (displayingCurve)
            {
                utilityIndicator.transform.localPosition  = new Vector3(0, (displayedConsideration.utilityScore) * 128 - 64, 0);
                propertyIndicator.transform.localPosition = new Vector3(displayedConsideration.propertyScore * 128 - 64, 0, 0);
            }

            if (displayingActionCurve)
            {
                actionUtilityIndicator.transform.localPosition  = new Vector3(0, (displayedActionConsideration.utilityScore) * 128 - 64, 0);
                actionPropertyIndicator.transform.localPosition = new Vector3(displayedActionConsideration.propertyScore * 128 - 64, 0, 0);
            }
        }
    }
コード例 #3
0
 void DetermineTarget()
 {
     if (agent.GetTopAction().handle == Sleep)
     {
         destination    = homeWaypointIn.transform.position;
         preDestination = homeWaypointOut.transform.position;
     }
     else if (agent.GetTopAction().handle == Shower)
     {
         destination    = homeWaypointIn.transform.position;
         preDestination = homeWaypointOut.transform.position;
     }
     else if (agent.GetTopAction().handle == EatAtRestaurant)
     {
         destination    = restaurantWaypointIn.transform.position;
         preDestination = restaurantWaypointOut.transform.position;
     }
     else if (agent.GetTopAction().handle == EatAtHome)
     {
         destination    = homeWaypointIn.transform.position;
         preDestination = homeWaypointOut.transform.position;
     }
     else if (agent.GetTopAction().handle == WatchMovie)
     {
         destination    = cinemaWaypointIn.transform.position;
         preDestination = cinemaWaypointOut.transform.position;
     }
     else if (agent.GetTopAction().handle == Work)
     {
         destination    = officeWaypointIn.transform.position;
         preDestination = officeWaypointOut.transform.position;
     }
     else if (agent.GetTopAction().handle == GetGroceries)
     {
         destination    = groceryStoreWaypointIn.transform.position;
         preDestination = groceryStoreWaypointOut.transform.position;
     }
     else if (agent.GetTopAction().handle == DrinkCoffee)
     {
         destination    = homeWaypointIn.transform.position;
         preDestination = homeWaypointOut.transform.position;
     }
     else if (agent.GetTopAction().handle == WorkAtHome)
     {
         destination    = homeWaypointIn.transform.position;
         preDestination = homeWaypointOut.transform.position;
     }
 }