
怪物攻击角色时,UI上箭头执行怪物的方向
下面是插件的原码:
using UnityEngine;
using System.Collections;
public class ArrowSet : MonoBehaviour
{
public Texture arrow;
private Camera cam;
private float xCenter;
private float yCenter;
private float screenSlope;
private float halfSize;
public float size = 30;
private bool errorless = false;
public string tagToFind = "Enemy";
public float hoverAngle = 270;
public float distanceAbove = 30;
public float blindSpot = 5.0f;
public bool hoverOnScreen = true;
void Start()
{
Camera theCam = gameObject.GetComponent<Camera>();
if (gameObject.GetComponent<Camera>())
{
cam = theCam;
if (arrow != null)
{
errorless = true;
}
else
{
Debug.Log("请附上一个箭头纹理雷达箭脚本。");
errorless = false;
}
}
else
{
Debug.Log("雷达箭头必须连接到一个摄像机。");
}