1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class ConvIndicator : MonoBehaviour
- {
- //public Sprite basicSprite;
- //public Sprite OptionalSprite;
- //public ConversationUI ConvUI;
- Conversation conv;
- Transform WorldLocation;
- bool active;
- public Image Icon;
- // Use this for initialization
- public void Init(Conversation conv,Transform worldLoc)
- {
- //if (conv.ConvType == ConversationType.Basic)
- // Icon.sprite = basicSprite;
- //else if (conv.ConvType == ConversationType.Optional)
- // Icon.sprite = OptionalSprite;
- this.conv = conv;
- WorldLocation = worldLoc;
- Show();
- }
- public void Show()
- {
- Icon.enabled = true;
- active = true;
- }
- void LateUpdate()
- {
- if (active)
- {
- Vector3 loc = WorldLocation.position;
- loc.x -= WorldLocation.localScale.x;
- loc.y += 4.5f * WorldLocation.localScale.x;
- transform.position = Camera.main.WorldToScreenPoint(loc);
- }
- }
- public void StartConversation()
- {
- //ConvUI.StartConversation(conv);
- Hide();
- }
- public void Hide()
- {
- Icon.enabled = false;
- active = false;
- }
- }
|