Ejemplo n.º 1
0
    public virtual void Update()
    {
        if (canBePickedUp)
        {
            if (mesh.isVisible)
            {
                EventManager.TriggerEvent("InteractableObject");

                if (ExtensionMethods.CheckForInteraction())
                {
                    switch (pickupType)
                    {
                    case Item.ItemType.EnergyShard:
                        PlayerInventory.AddEnergyShard(this.transform);
                        break;

                    case Item.ItemType.LightBox:
                        PlayerInventory.AddLightBoxes(this.transform);
                        break;

                    case Item.ItemType.LightFilter:
                        PlayerInventory.AddLightFilter(this.transform);
                        break;
                    }

                    EventManager.TriggerEvent("UpdatePlayerInventory");


                    canBePickedUp = false;
                    gameObject.SetActive(false);

                    EventManager.TriggerEvent("NonInteractableObject");
                }
            }
            else
            {
                EventManager.TriggerEvent("NonInteractableObject");
            }
        }
    }