|
|
|
|
/// <summary>
|
|
|
|
|
/// This is Radar System. using to detection an objects and showing on minimap by Tags[]
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using System.Collections;
|
|
|
|
|
|
|
|
|
|
//λ<EFBFBD><EFBFBD>
|
|
|
|
|
//public enum Alignment { None,LeftTop, RightTop, LeftBot, RightBot ,MiddleTop ,MiddleBot}
|
|
|
|
|
|
|
|
|
|
public class RadarSystem : MonoBehaviour {
|
|
|
|
|
|
|
|
|
|
private Vector2 inposition;
|
|
|
|
|
public float Size = 400;
|
|
|
|
|
public float Distance = 100;
|
|
|
|
|
public float Alpha = 0.5f;
|
|
|
|
|
//public Texture2D NavBG;
|
|
|
|
|
public Vector2 PositionOffset = new Vector2(-70,6);
|
|
|
|
|
public bool MapRotation;
|
|
|
|
|
public bool Show = true;
|
|
|
|
|
public Color ColorMult = Color.white;
|
|
|
|
|
public GameObject NavSprite;
|
|
|
|
|
private float eulaerAngleY_Cur = 0, eulaerAngleY_last = 0;
|
|
|
|
|
|
|
|
|
|
void Start()
|
|
|
|
|
{
|
|
|
|
|
eulaerAngleY_Cur = this.transform.eulerAngles.y;
|
|
|
|
|
eulaerAngleY_last = this.transform.eulerAngles.y;
|
|
|
|
|
}
|
|
|
|
|
void Update()
|
|
|
|
|
{
|
|
|
|
|
eulaerAngleY_Cur = this.transform.eulerAngles.y;
|
|
|
|
|
float deltaY = eulaerAngleY_Cur - eulaerAngleY_last;
|
|
|
|
|
//inposition = Vector2.zero + PositionOffset;
|
|
|
|
|
inposition = new Vector2(Screen.width-150,250) ;
|
|
|
|
|
if (Mathf.Abs(deltaY)>0.01)
|
|
|
|
|
{
|
|
|
|
|
NavSprite.transform.Rotate(Vector3.forward, deltaY);
|
|
|
|
|
}
|
|
|
|
|
eulaerAngleY_last = eulaerAngleY_Cur;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
float[] list;
|
|
|
|
|
//void OnGUI(){
|
|
|
|
|
// if(!Show)
|
|
|
|
|
// return;
|
|
|
|
|
|
|
|
|
|
// GUI.color = new Color(ColorMult.r,ColorMult.g,ColorMult.b,Alpha);
|
|
|
|
|
// if(MapRotation){
|
|
|
|
|
|
|
|
|
|
// GUIUtility.RotateAroundPivot (-(this.transform.eulerAngles.y), inposition + new Vector2(Size/2f, Size/2f));
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// if(NavBG)
|
|
|
|
|
// GUI.DrawTexture(new Rect(inposition.x,inposition.y,Size,Size),NavBG);
|
|
|
|
|
// GUIUtility.RotateAroundPivot ((this.transform.eulerAngles.y), inposition + new Vector2(Size/2f, Size/2f));
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|