/// <summary> /// Checks if some interactable or shop is in his trigger. /// </summary> /// <param name="collision"></param> private void OnTriggerEnter2D(Collider2D collision) { // Get the right component to start the interaction. if (collision.GetComponent <Interactable>() != null && collision.GetComponent <Interactable>().IsInteractable || collision.GetComponent <ShopArea>() != null || collision.GetComponent <HealingTrigger>() != null) { PlayerController.Instance.OnInteracting += StartInteraction; if (collision.GetComponent <Interactable>() != null) { target = collision.GetComponent <Interactable>(); } else if (collision.GetComponent <ShopArea>() != null) { targetShop = collision.GetComponent <ShopArea>(); } else if (collision.GetComponent <HealingTrigger>() != null) { healArea = collision.GetComponent <HealingTrigger>(); } tmp = ObjectPool.Instance.GetFromPool(Emotion.Attention.ToString()); tmp.transform.parent = PlayerController.Instance.EmotionHolder; tmp.transform.localPosition = Vector3.zero; tmp.SetActive(true); } }
// Token: 0x06000E05 RID: 3589 RVA: 0x00060A34 File Offset: 0x0005EC34 protected void DrawBuyButton(Rect position, string text, ShopArea area = ShopArea.Shop) { GUI.contentColor = ColorScheme.UberStrikeYellow; if (GUITools.Button(position, new GUIContent(text), BlueStonez.buttondark_medium)) { BuyPanelGUI buyPanelGUI = PanelManager.Instance.OpenPanel(PanelType.BuyItem) as BuyPanelGUI; if (buyPanelGUI) { buyPanelGUI.SetItem(this.Item, this._location, this._recommendation, false); } } GUI.contentColor = Color.white; }
/// <summary> /// Checks if the interaction left the trigger. /// </summary> /// <param name="collision"></param> private void OnTriggerExit2D(Collider2D collision) { if (target != null || targetShop != null || healArea != null) { // Desubscribe to the event of player hitting action button. PlayerController.Instance.OnInteracting -= StartInteraction; target = null; targetShop = null; healArea = null; if (PlayerController.Instance.EmotionHolder.childCount > 0) { GameObject tmp = PlayerController.Instance.EmotionHolder.GetChild(0).gameObject; ObjectPool.Instance.AddToPool(tmp, Emotion.Attention.ToString()); } } }
// Start is called before the first frame update private void Start() { // These are just tmps. target = new Interactable(); targetShop = new ShopArea(); }