Esempio n. 1
0
 public PickupItemAction(AIAgent agent, PickableItem item)
     : base(agent)
 {
     Name = "PickupItem";
     BaseUtility = 9;
     _item = item;
 }
Esempio n. 2
0
        //TODO - сделать интерфейс для контейнеров(игровых)
        public bool AddItem(PickableItem newItem)
        {
            if (_items.Count >= MaxItemsCount) return false;

            var previousItem = _items.LastOrDefault();
            _items.Add(newItem);
            newItem.transform.SetParent(transform);
            Vector3 previousSize = Vector3.zero;
            if(previousItem != null)
                previousSize = previousItem.GetComponentInChildren<BoxCollider>().size;

            newItem.transform.position = transform.position + (Vector3.up * (previousSize.y * 0.5f + 0.15f)) *(_items.Count-1);
            return true;
        }
Esempio n. 3
0
 public virtual void Eat(PickableItem food, Action callback)
 {
     StartCoroutine(EatProcess(food, callback));
 }
Esempio n. 4
0
        protected virtual IEnumerator EatProcess(PickableItem food, Action callback)
        {
            Debug.Log("Eating the" + food.Name);
            yield return new WaitForSeconds(3);

            if(BackPack.IsEmpty) Debug.LogError("Can't eat. Backpack is empty!");

            Stats.Hunger = 0;
            Destroy(food.gameObject);
            callback();
        }