public override void OnInspectorGUI()
    {
        serializedObject.Update();



        EditorGUI.BeginChangeCheck();
        {
            EditorFieldUtility.ReadOnlyComponentField(target as MonoBehaviour, this);

            EditorGUILayout.BeginHorizontal();
            WereAllGonnaDieAnywayNew.InventorySystem.Inventory _target = (WereAllGonnaDieAnywayNew.InventorySystem.Inventory)target;
            EditorGUILayout.PrefixLabel("Game Data DB");
            _target.db = EditorGUILayout.ObjectField(_target.db, typeof(GameDatabaseSO), true) as GameDatabaseSO;
            EditorGUILayout.EndHorizontal();

            if (reorderableList != null)
            {
                reorderableList.Layout();
            }
        }
        if (EditorGUI.EndChangeCheck())
        {
            serializedObject.ApplyModifiedProperties();
        }
    }
        public CreatureFactoryData(GameObject actor)
        {
            Creature target = actor.GetComponent <Creature>();

            WereAllGonnaDieAnywayNew.InventorySystem.Inventory inventory = actor.GetComponent <WereAllGonnaDieAnywayNew.InventorySystem.Inventory>();

            ActorID     = target.CreatureID;
            Statlist    = target.Stats.StatList;
            ItemsInBag  = inventory.ItemsInBag;
            ActorObject = actor;

            SpriteIndex = Int32.Parse(actor.transform.GetChild(0).name);

            Name = actor.name;

            //add location and ai data later
        }
        /// <summary>
        /// UpdatesCreture data in CitizenMasterList
        /// </summary>
        /// <param name="actor"></param>
        /// <returns></returns>
        //add an observer to call this or delegate
        public bool UpdateCreatureData(GameObject actor)
        {
            if (!ReadActorData(actor.GetComponent <Creature>().CreatureID, out CreatureFactoryData tmp))
            {
                Debug.LogWarning("Creature data does not exists");
                return(false);
            }
            else
            {
                Creature target = actor.GetComponent <Creature>();
                WereAllGonnaDieAnywayNew.InventorySystem.Inventory inventory = actor.GetComponent <WereAllGonnaDieAnywayNew.InventorySystem.Inventory>();
                tmp.ItemsInBag = inventory.ItemsInBag;
                tmp.Statlist   = target.Stats.StatList;
                tmp.position   = actor.transform.position;
                //update location data;

                return(true);
            }
        }
예제 #4
0
 public void UpdateInventory(WereAllGonnaDieAnywayNew.InventorySystem.Inventory source)
 {
     playerInventory = TOOLS.CloneObject <List <ItemFactoryData> >(source.ItemsInBag);
 }
예제 #5
0
 public void InitializeHarvestPoint()
 {
     HarvestInventory = GetComponent <WereAllGonnaDieAnywayNew.InventorySystem.Inventory>();
 }
 public void ShareItem(WereAllGonnaDieAnywayNew.InventorySystem.Inventory targetInventory, int qty, string ItemName)
 {
     // transfer item from common to target
 }
    // Resource Management

    public void AddItem(WereAllGonnaDieAnywayNew.InventorySystem.Inventory source, int qty, string ItemName)
    {
        source.TransferItemData(ItemName, qty, out ItemFactoryData targetItem);
        addItemToStock(targetItem);
    }