Esempio n. 1
0
    /// <summary>
    /// For all IPs of an object in a room, calculate their travel score. Set values based on the lowest score.
    /// </summary>
    /// <param name="room">The room the object is in</param>
    /// <param name="obj">The object containing the IPs</param>
    /// <param name="lowestScore">Outputting the lowest score</param>
    /// <param name="IPidx">Outputting the IP index of the IP with the lowest score on the obj</param>
    /// <param name="targetObj">Outputting the Room Object with the lowest score</param>
    /// <returns>True if a room path has the lowest score. Flase otherwise.</returns>
    private bool getLowestRoomPathScore(Room room, RoomObject obj, ref float lowestScore, ref int IPidx, ref RoomObject targetObj)
    {
        //get the path size from the camper to the room's entrance
        float baseScore  = roomPathMap[room].GetPathLength();
        bool  useRoomMap = false;

        for (int i = 0; i < obj.interactionPoints.Count; i++)
        {
            //for each interaction point, get the path length from the IP to the room entrance + wait time
            InteractionPoint ip    = obj.interactionPoints[i];
            float            score = baseScore + ip.GetIPScore();

            if (score < lowestScore)
            {
                useRoomMap  = true;
                IPidx       = i;
                targetObj   = obj;
                lowestScore = score;
            }
        }
        return(useRoomMap);
    }