コード例 #1
0
ファイル: DecisionMaker.cs プロジェクト: Pokoi/SGDJamII
        /**
         * @brief Choose the best destiny hidding place and gets its destination coordinates
         * @return The destination coordinates of the desired hidding place
         */
        public Vector3 ChooseNewDestinyHiddingPlace()
        {
            var hiddingPlaces = agent.GetCurrentRoom().GetHiddingPlaces();

            ArtificialIntelligence.HiddingPlace origin = agent.GetCurrentHiddingPlace();

            float   bestHeuristic = float.MaxValue;
            Vector3 destiny       = Vector3.zero;

            foreach (ArtificialIntelligence.HiddingPlace hp in hiddingPlaces)
            {
                if (hp != origin && hp.GetMaxOccupation() > hp.GetCurrentOccupation())
                {
                    changeHiddingPlaceAction.Reset(origin, hp);
                    ChangeDestinationWhenHeuristicImprovement
                    (
                        changeHiddingPlaceAction.CalculateHeuristic(),
                        ref bestHeuristic,
                        changeHiddingPlaceAction.GetDestination(),
                        ref destiny
                    );
                }
            }

            currentAction = ActionTypes.CHANGE_HIDDING_PLACE;
            agent.Unhide();

            return(destiny == Vector3.zero ? ChooseDestinyRoom() : destiny);
        }
コード例 #2
0
ファイル: Locomotion.cs プロジェクト: Pokoi/SGDJamII
 /**
  * @brief Event called when the agent starts moving
  */
 public void OnStartMoving()
 {
     intelligentAgent.Unhide();
     if (emitter)
     {
         //Play sound
     }
 }