示例#1
0
    private void Awake()
    {
        Text[] t = GetComponentsInChildren <Text>();
        _statName  = t[0];
        _statValue = t[1];

        _tooltip = GameObject.Find("StatTooltip").GetComponent <StatTooltip>();
    }
示例#2
0
    private void OnValidate()
    {
        Text[] texts = GetComponentsInChildren <Text>();
        nameText  = texts[0];
        valueText = texts[1];

        if (tooltip == null)
        {
            tooltip = FindObjectOfType <StatTooltip>();
        }
    }
示例#3
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Destroy(this);
     }
     gameObject.SetActive(false);
 }
示例#4
0
    private void Awake()
    {
        _characterPanel = GameObject.Find("CharacterPanel");

        GameObject dialogue = _characterPanel.transform.parent.GetChild(3).transform.GetChild(0).gameObject;

        _dialogueParent = dialogue.GetComponent <Transform>();
        _dialogueText   = dialogue.GetComponentInChildren <Text>();
        _inventory      = _characterPanel.transform.parent.GetChild(3).transform.GetChild(1).gameObject;

        _itemTooltip = _characterPanel.transform.parent.GetChild(4).GetComponent <ItemTooltip>();
        _statTooltip = _characterPanel.transform.parent.GetChild(5).GetComponent <StatTooltip>();

        GameController.OnMouseLeftClickGameObject += OpenShop;

        _inventory.SetActive(false);
    }
示例#5
0
 private void Awake()
 {
     _charPanel   = GameObject.Find("CharacterPanel");
     _itemTooltip = GameObject.Find("ItemTooltip").GetComponent <ItemTooltip>();
     _statTooltip = GameObject.Find("StatTooltip").GetComponent <StatTooltip>();
 }
示例#6
0
    private void Awake()
    {
        _inventory      = GameObject.Find("Inventory").GetComponent <Inventory>();
        _equipmentPanel = GameObject.Find("EquipmentPanel").GetComponent <EquipmentPanel>();

        _shopInventory = GameObject.Find("ShopPanel").GetComponent <ShopInventory>();
        _playerCoins   = GameObject.Find("Coins").GetComponent <PlayerCoins>();

        _itemTooltip         = GameObject.Find("ItemTooltip").GetComponent <ItemTooltip>();
        _statTooltip         = GameObject.Find("StatTooltip").GetComponent <StatTooltip>();
        _draggedItem         = GameObject.Find("DraggedItem").GetComponent <Image>();
        _draggedItem.enabled = false;

        _statsPanel = GameObject.Find("Stats").GetComponent <StatPanel>();
        _statsPanel.SetStats(_health, _mana, _armor, _strength, _intelligence);
        GameController.maxHealth    = _health.Value;
        GameController.maxMana      = _mana.Value;
        GameController.armor        = _armor.Value;
        GameController.strength     = _strength.Value;
        GameController.intelligence = _intelligence.Value;
        _statsPanel.UpdateStatValues();

        //Setup Events:
        GameController.OnUseConsumableEvent += UseConsumable;
        //Right Click
        _inventory.OnRightClickEvent      += Equip;
        _inventory.OnRightClickEvent      += Sell;
        _inventory.OnRightClickEvent      += UseConsumable;
        _inventory.OnRightClickEvent      += HideTooltip;
        _equipmentPanel.OnRightClickEvent += Unequip;
        _shopInventory.OnRightClickEvent  += Buy;
        _shopInventory.OnRightClickEvent  += HideTooltip;
        //Pointer Enter
        _inventory.OnPointerEnterEvent      += ShowTooltip;
        _equipmentPanel.OnPointerEnterEvent += ShowTooltip;
        _shopInventory.OnPointerEnterEvent  += ShowTooltip;
        //Pointer Exit
        _inventory.OnPointerExitEvent      += HideTooltip;
        _equipmentPanel.OnPointerExitEvent += HideTooltip;
        _shopInventory.OnPointerExitEvent  += HideTooltip;
        //Begin Drag
        _inventory.OnBeginDragEvent      += BeginDrag;
        _inventory.OnBeginDragEvent      += HideTooltip;
        _equipmentPanel.OnBeginDragEvent += BeginDrag;
        _shopInventory.OnBeginDragEvent  += BeginDrag;
        //End Drag
        _inventory.OnEndDragEvent      += EndDrag;
        _equipmentPanel.OnEndDragEvent += EndDrag;
        _shopInventory.OnEndDragEvent  += EndDrag;
        //Drag
        _inventory.OnDragEvent      += Drag;
        _equipmentPanel.OnDragEvent += Drag;
        _shopInventory.OnDragEvent  += Drag;
        //Drop
        _inventory.OnDropEvent      += Drop;
        _inventory.OnDropEvent      += ShowTooltip;
        _equipmentPanel.OnDropEvent += Drop;
        _equipmentPanel.OnDropEvent += ShowTooltip;
        _shopInventory.OnDropEvent  += Drop;
        _shopInventory.OnDropEvent  += ShowTooltip;
    }