52 lines
1.2 KiB
C#
52 lines
1.2 KiB
C#
using DragonLi.Core;
|
||
using DragonLi.Frame;
|
||
using Mirror;
|
||
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using UnityEngine;
|
||
|
||
public class Radar : MonoBehaviour
|
||
{
|
||
Player player;
|
||
public GameObject Intersect;
|
||
//<2F>״<EFBFBD><D7B4>
|
||
public GameObject Point;
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD>״<EFBFBD><D7B4>ĸ<EFBFBD><C4B8>ڵ<EFBFBD>
|
||
public GameObject PointParent;
|
||
void Start()
|
||
{
|
||
EventDispatcher.AddEventListener<List<Vector3>>("EnemyList", EnemyList);
|
||
|
||
}
|
||
|
||
public void EnemyList(List<Vector3> vectors)
|
||
{
|
||
|
||
|
||
for (int i = PointParent.transform.childCount - 1; i >= 0; i--)
|
||
{
|
||
GameObject.Destroy(PointParent.transform.GetChild(i).gameObject);
|
||
}
|
||
for (int i = 0; i < vectors.Count; i++)
|
||
{
|
||
GameObject point = Instantiate(Point, PointParent.transform);
|
||
|
||
point.transform.localPosition = new Vector3(vectors[i].x * 3f, vectors[i].z * 3f, 0);
|
||
|
||
}
|
||
|
||
}
|
||
|
||
void Update()
|
||
{
|
||
player = GameInit.Ins.self;
|
||
if (!player) return;
|
||
Intersect.transform.localEulerAngles = new Vector3(0, 0, (-player.transform.localEulerAngles.y));
|
||
PointParent.transform.localPosition = new Vector3(-player.transform.position.x * 3f, -player.transform.position.z * 3f);
|
||
|
||
}
|
||
}
|
||
|
||
|
||
|