Esempio n. 1
0
        void Start()
        {
            //todo this is temporary, later we should have things dragged onto the action
            //bar register themselves with the action map by the slot's action id

            PlayerSkillBook skillbook = entity.GetComponent <PlayerSkillBook>();

            if (skillbook == null)
            {
                return;
            }

            for (int i = 0; i < 9; i++)
            {
                if (skillbook.skillBookEntries.Length == i)
                {
                    return;
                }
                SkillBookEntry entry = skillbook.skillBookEntries[i];
                if (entry == null)
                {
                    continue;
                }
                string id = "Actionbar0-" + (i + 1);
                actionMap[id] = entry.action;
            }
        }
Esempio n. 2
0
    public void Start()
    {
        PlayerSkillBook skillbook = player.GetComponent <PlayerSkillBook>();

        ActionbarSlot[] slots = GetComponentsInChildren <ActionbarSlot>();
        for (int i = 0; i < slots.Length; i++)
        {
            if (skillbook.skillBookEntries.Length == i)
            {
                return;
            }
            slots[i].SetItem(skillbook.skillBookEntries[i]);
        }
    }
Esempio n. 3
0
    public override void OnInspectorGUI()
    {
        PlayerSkillBook skillBook = target as PlayerSkillBook;

        if (root == null)
        {
            if (!string.IsNullOrEmpty(skillBook.source))
            {
                new AssetDeserializer(skillBook.source, false).DeserializeInto("__default__", skillBook);
            }
            root = new SerializedObjectX(target);
        }
        EditorGUILayoutX.DrawProperties(root);
        bool didChange = root.Root.ApplyModifiedProperties();

        if (didChange)
        {
            AssetSerializer serializer = new AssetSerializer();
            serializer.AddItem(target);
            serializedObject.FindProperty("source").stringValue = serializer.WriteToString();
            serializedObject.ApplyModifiedProperties();
        }
    }