コード例 #1
0
    // Adds a new blackboard entry and returns its key for later retrieval
    public AIBlackBoardEntry AddEntry <T>(string entryName, T entryObject)
    {
        if (Initialised)
        {
            Debug.LogWarning("Registering entry \"" + entryName + "\" after initialisation is complete!");
        }

        int nameHash            = entryName.GetHashCode();
        AIBlackBoardEntry entry = null;

        if (!m_blackboardEntries.TryGetValue(nameHash, out entry))
        {
            entry = new AIBlackBoardEntry(entryName, (System.Object)entryObject);
            m_blackboardEntries.Add(nameHash, entry);
        }
#if AI_OUTPUT
        else
        {
            Debug.LogWarning("\"" + entryName + "\" already added.");
        }
#endif

        return(entry);
    }
コード例 #2
0
 public override void RegisterBlackboardEntries()
 {
     m_headTrackEntry = m_parentAI.Blackboard.AddEntry <Vector3>("headtrack_target", Vector3.forward);
     m_faceTarget     = m_parentAI.Blackboard.AddEntry <Vector3>("turn_target", Vector3.forward);
 }