private void BestTriggererChanged(ObjectTriggererBase old, ObjectTriggererBase newBest)
 {
     if (newBest != null)
     {
         window.Show();
         Repaint(newBest);
     }
     else
     {
         window.Hide();
     }
 }
        public virtual void Repaint(ObjectTriggererBase triggerer)
        {
            if(window.isVisible == false)
                window.Show();
            
            Sprite icon = null;
            if (triggerer != null)
                icon = GetIcon(triggerer.triggerKeyCode);

            if (imageIcon != null && imageIcon.sprite != icon)
                imageIcon.sprite = icon;

            if (shortcutText != null)
            {
                if (triggerer != null)
                {
                    if (shortcutText.text != triggerer.triggerKeyCode.ToString())
                    {
                        shortcutText.text = triggerer.triggerKeyCode.ToString();
                    }
                    else
                        shortcutText.text = "";
                }
            }
        }
 protected virtual void UpdatePosition(ObjectTriggererBase triggerer)
 {
     if(triggerer != null)
         transform.position = Camera.main.WorldToScreenPoint(triggerer.transform.position);
 }
        public void Update()
        {
            if (bestTriggerer == null || enabled == false)
                return;

            if (Input.GetKeyDown(bestTriggerer.triggerKeyCode) && bestTriggerer.triggerKeyCode != KeyCode.None)
            {
                bool removeSource;
                bestTriggerer.Toggle(InventoryPlayerManager.instance.currentPlayer, out removeSource, true);
                if (removeSource)
                {
                    triggerersInRange.Remove(bestTriggerer);
                    bestTriggerer = null;
                }
            }
        }
Ejemplo n.º 5
0
        private void HandleItemTriggerer(ObjectTriggererBase triggerer)
        {
            if (triggerer != null)
            {
                if (triggerer.inRange == false && showOutOfRangeLootables == false)
                    return;

                var a = triggerer as ObjectTriggererItem;
                if (a != null)
                {
                    bool shouldDestroySource;
                    HandleInfoBox(a.GetItem(out shouldDestroySource));

                    return;
                }
            }

            if(isHoveringWrapper == false)
                Hide();
        }
        public void UpdateBestTriggerer()
        {
            // Check for Triggerers in range.
            if(enabled)
                bestTriggerer = GestBestTriggerer();

        }
        protected void NotifyNewBestTriggerer(ObjectTriggererBase before, ObjectTriggererBase after)
        {
            // New best triggerer   
            if (OnChangedBestTriggerer != null)
                OnChangedBestTriggerer(before, after);

        }
        public void NotifyTriggererUnUsed(ObjectTriggererBase triggerer)
        {

        }
        public void NotifyCursorExitTriggerer(ObjectTriggererBase triggerer)
        {
            triggerer.NotifyCursorExitTriggerer();
            isHoveringTriggerer = false;

            if (OnCursorExitTriggerer != null)
                OnCursorExitTriggerer(triggerer);

        }
        public void NotifyCursorEnterTriggerer(ObjectTriggererBase triggerer)
        {
            triggerer.NotifyCursorEnterTriggerer();
            isHoveringTriggerer = true;

            // New best triggerer
            if (OnCursorEnterTriggerer != null)
                OnCursorEnterTriggerer(triggerer);

        }