Ejemplo n.º 1
0
    public void GetReward()
    {
        _o = Overlord._instance;

        if (_o.currentEvent == null)
        {
            _o.currentEvent = _o.GetRandomEvent(Overlord.EventTypes.TREASURE);
        }

        animate     = true;
        shake_timer = _SHAKE_TIME_;
        GetComponent <Button>().interactable = false;

        Item i = _o.currentEvent.rewards[Random.Range(0, _o.currentEvent.rewards.Length)];

        Debug.Log(i.name);

        item.GetComponent <Image>().sprite = i.artwork;
        Text t = item.transform.Find("Text").GetComponent <Text>();

        t.text = string.Format(_TREASURE_TEXT_, i.name, i.description);
        if (_o.inventorySlots <= _o.inventory.Count)
        {
            t.text += "\nYou can't carry more objects. Leaving this treasure behind drives you more insane.";
        }

        _o.InventoryAdd(i);
    }
Ejemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        _o = Overlord._instance;
        if (_o.currentEvent == null)
        {
            _o.currentEvent = _o.GetRandomEvent(Overlord.EventTypes.MERCHANT);
        }

        confirmationPanel.SetActive(false);

        RefreshInventory();
    }
Ejemplo n.º 3
0
    private void Start()
    {
        _o = Overlord._instance;

        if (_o.eventsCompleted % 10 == 0 && _o.eventsCompleted != 0)
        {
            locations[rng.Next(locations.Length)].SetEvent(_o.CreateEvent(_o.bossFights));
        }
        else
        {
            int c = 0;
            for (int i = 0; i < numEventsRound; i++)
            {
                c = (c + rng.Next(locations.Length)) % locations.Length;

                for (int j = 0; j < locations.Length; j++)
                {
                    if (locations[c].locationEvent != null)
                    {
                        continue;
                    }

                    Overlord.EventTypes et = events[rng.Next(events.Length)];
                    locations[c].SetEvent(_o.GetRandomEvent(et));
                    break;
                }
            }
        }

        hpText.text       = "HP: " + PlayerPrefs.GetInt("player_health", 100).ToString();
        insanityText.text = "Insanity: " + _o.enemyLevel;

        for (int i = 0; i < itemsUI.Length; i++)
        {
            if (i < _o.inventory.Count)
            {
                itemsUI[i].enabled = true;
                itemsUI[i].item    = _o.inventory[i];
                itemsUI[i].tooltip = itemTooltip;
                Image img = itemsUI[i].gameObject.GetComponent <Image>();
                img.sprite = _o.inventory[i].artwork;
                img.color  = Color.white;
            }
            else
            {
                itemsUI[i].enabled = false;
            }
        }
    }