Exemplo n.º 1
0
 // Use this for initialization
 void Start()
 {
     DontDestroyOnLoad(transform);
     foreach (Transform child in transform)
     {
         SkillAtom skillAtom = child.GetComponent <SkillAtom>();
         if (skillAtom != null)
         {
             skillAtoms.Add(skillAtom.skillAtomName, skillAtom);
         }
     }
     if (!visuzalizationText && visualize)
     {
         CreateVisualizer();
     }
     SceneManager.sceneLoaded += CheckForVisualization;
 }
Exemplo n.º 2
0
    void AddKnowledgeBaseIfDoesntExist()
    {
        GameObject knowledgebaseGameObject = Instantiate(_KnowledgeBase) as GameObject;

        knowledgebase = knowledgebaseGameObject.GetComponent <Knowledgebase>();

        GameObject skillAtomGO = new GameObject();

        skillAtomGO.transform.SetParent(knowledgebaseGameObject.transform);
        skillAtomGO.name = skillAtom.name;

        SkillAtom newSA = skillAtomGO.AddComponent <SkillAtom>();

        newSA.skillAtomName  = skillAtom.name;
        newSA.initialMastery = skillAtom.GetMastery();

        skillAtom = newSA;
    }
Exemplo n.º 3
0
    // Use this for initialization
    void Awake()
    {
        knowledgebase = FindObjectOfType <Knowledgebase>() as Knowledgebase;
        if (knowledgebase == null)
        {
            AddKnowledgeBaseIfDoesntExist();
            Debug.LogWarning("No skill atom knowledgebase found by detector, tried to automatically add the requirements. Please add a knowledgebase to your scene to ensure there is no unexpected behavior.", transform);
        }
        // TODO: Create some way of having these be ordered by priority.
        hints.AddRange(transform.GetComponents <Hint>());

        if (!skillAtom.gameObject.activeInHierarchy)
        {
            SkillAtom[] allSkillAtoms;
            allSkillAtoms = FindObjectsOfType <SkillAtom>();
            foreach (SkillAtom skill in allSkillAtoms)
            {
                if (skill.name == skillAtom.name)
                {
                    skillAtom = skill;
                }
            }
        }
    }
Exemplo n.º 4
0
    // --- Class Functions ---

    /* Function called to add a skill atom to the Knowledgebase
     * Parameters:
     *	name - a string corresponding to the name of the SkillAtom to be used
     *		as the key for looking up the SkillAtom
     *	SA - the SkillAtom to add to the Knowledgebase
     */
    public void AddSkillAtom(string name, SkillAtom SA)
    {
        skillAtoms.Add(name, SA);
        // TODO: Maybe catch ArgumentException and do something in the case of
        //		an already existing name instance.
    }