123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- using DG.Tweening;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class MinMap : MonoBehaviour
- {
- public RectTransform mapPlayer;
- public Transform CrystalsParent;
- public Image point;
- public LineRenderer LineItem;
- public Transform LineParent;
- public RectTransform Rpoint;
- public Image Map;
-
-
-
- public List<LineRenderer> list_route = new List<LineRenderer>();
-
-
-
- public List<Image> listAllPoint;
-
-
-
- public void ShowPlayer(Vector3 pos, float rot)
- {
- mapPlayer.localPosition = pos;
- mapPlayer.localRotation = Quaternion.Euler(0, 0, -rot);
- }
- private void Update()
- {
- this.transform.localPosition = new Vector3(0.294f, 0.2405f,2.7f);
- this.transform.localEulerAngles = Vector3.zero;
- }
-
-
-
-
- public void ShowPoint(List<Vector3> list_Point)
- {
- for (int i = 0; i < list_Point.Count; i++)
- {
- var pos = list_Point[i];
- Image newPoint = Instantiate(point, CrystalsParent);
- newPoint.GetComponent<RectTransform>().localPosition = new Vector3(pos.x, -pos.y, 0);
- newPoint.gameObject.SetActive(true);
- listAllPoint.Add(newPoint.GetComponent<Image>());
- }
- mapPlayer.transform.SetAsLastSibling();
- }
- public void SetRoute(int index, bool isshow)
- {
- list_route[index].gameObject.SetActive(isshow);
- }
- public Material mats;
- public void SettingMapRoute(List<Vector3> listMapRoutePos, string linename)
- {
- var line = Instantiate(LineItem, LineParent);
- line.name = linename;
- line.GetComponent<LineRenderer>().material = mats;
- line.transform.localPosition = Vector3.zero;
- line.startWidth = 3;
- line.endWidth = 3;
- line.positionCount = 0;
- line.positionCount = listMapRoutePos.Count;
- for (int i = 0; i < listMapRoutePos.Count; i++)
- {
- line.SetPosition(i, listMapRoutePos[i]);
- }
- line.gameObject.AddComponent<LineEffect>();
- list_route.Add(line);
- }
- }
|