Esempio n. 1
0
        public void Pickup(Item item, int stacks)
        {
            if (!IsAlive)
            {
                return;
            }
#if DEBUG_COMBAT
            _combatLog.Log($"<b>{gameObject.name}</b> picked up item <b>{item.name}</b>");
#endif

            var state = _itemStates.FirstOrDefault(s => s.Item.Equals(item));

            if (state != null)
            {
                state.Stacks += stacks;
            }
            else
            {
                _itemStates.Add(new ItemState(item, stacks));
            }

            OnItemPickup?.Invoke(item, stacks);

            // Todo: track picked items and their stats
            foreach (var buff in item.Buffs)
            {
                ApplyBuff(buff, this, stacks = 1);
            }
        }
Esempio n. 2
0
 void Start()
 {
     ListOptions = new Dictionary <string, string[]> ();
     sentences   = new Queue <string> ();
     intCanvas   = GameObject.Find("InteractDialogue").GetComponent <Canvas> ();
     this.inv    = GameObject.FindObjectOfType <Inventory> ();
     OIP         = FindObjectOfType <OnItemPickup> ();
 }
Esempio n. 3
0
 // Use this for initialization
 void Start()
 {
     GC            = FindObjectOfType <GameController> ();
     npc           = FindObjectOfType <NPCController> ();
     player        = FindObjectOfType <PlayerData> ();
     inventory     = FindObjectOfType <Inventory> ();
     dia           = FindObjectOfType <DialogueList> ();
     moveJoystick  = FindObjectOfType <JoyStick> ();
     OIP           = FindObjectOfType <OnItemPickup> ();
     doThingText   = GameObject.Find("DoThingText").GetComponent <Text> ();
     doThingButton = GameObject.Find("DoThingButton").GetComponent <Button> ();
     doThingCanvas = GameObject.Find("DoThingsCanvas").GetComponent <Canvas> ();
     finishCanvas  = GameObject.Find("FinishCanvas").GetComponent <Canvas> ();
     anim          = GetComponentInChildren <Animator>();
 }
Esempio n. 4
0
    public void InvokeItemPickup(Collider collider)
    {
        AbstractItem itemToPickup = collider.gameObject.GetComponent <AbstractItem>();

        if (itemToPickup == null)
        {
            return;
        }

        Debug.DrawLine(transform.position, collider.transform.position, Color.yellow);

        if ((transform.position - collider.transform.position).sqrMagnitude < 1.25f)
        {
            if (OnItemPickup != null)
            {
                OnItemPickup.Invoke(itemToPickup);
                collider.gameObject.SetActive(false);
            }
        }
    }
Esempio n. 5
0
 public void ItemPickupEvent(ItemInstance itemInstance, GameObject ship) => OnItemPickup?.Invoke(itemInstance, ship);