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;
///
/// 所有路线
///
private List list_route = new List();
///
/// 小地图上所有Image
///
public List listAllPoint;
///
/// 显示角色在小地图的位置 ( Position EulerAngles)
///
public void ShowPlayer(Vector3 pos, float rot)
{
mapPlayer.localPosition = pos;
mapPlayer.localRotation = Quaternion.Euler(0, 0, -rot);
}
///
/// 显示所有水晶点 (所有可触发交互的地方)
///
///
public void ShowPoint(List list_Point)
{
for (int i = 0; i < list_Point.Count; i++)
{
var pos = list_Point[i];
Image newPoint = Instantiate(point, CrystalsParent);
newPoint.GetComponent().localPosition = new Vector3(pos.x, -pos.y, 0);
newPoint.gameObject.SetActive(true);
listAllPoint.Add(newPoint.GetComponent());
}
mapPlayer.transform.SetAsLastSibling();
}
public void SetRoute(int index, bool isshow)
{
list_route[index].gameObject.SetActive(isshow);
}
public void SettingMapRoute(List listMapRoutePos, string linename)
{
var line = Instantiate(LineItem, LineParent);
line.name = linename;
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]);
}
list_route.Add(line);
}
}