Alert() public static method

public static Alert ( string text, Type, type = Type.Top, float duration = 1.4f, float r = 1, float g = 1, float b = 1, float scale = 1 ) : void
text string
type Type,
duration float
r float
g float
b float
scale float
return void
示例#1
0
文件: Sensor.cs 项目: k-idzik/Lux
    /// <summary>
    /// responsible for detecting the player based on
    /// the cone of vision and checking
    /// </summary>
    private bool VisionCone()
    {
        Vector3 direction = target.transform.position - transform.position;

        float angle = Vector3.Angle(direction, transform.forward);

        Debug.DrawLine(transform.position, transform.position + Quaternion.AngleAxis(visionAngle, transform.up) * transform.forward * visionConeRange);
        Debug.DrawLine(transform.position, transform.position + Quaternion.AngleAxis(-visionAngle, transform.up) * transform.forward * visionConeRange);
        Debug.DrawLine(transform.position, transform.position + transform.forward * visionConeRange);

        if (angle > visionAngle)
        {
            return(false);
        }
        else
        {
            RaycastHit hit;


            if (Physics.Raycast(transform.position, direction, out hit, visionConeRange) && hit.transform.gameObject.tag == "Player")
            {
                //AlertManager.Instance.Alert(hit.transform); //Error
                alertMan.Alert(hit.transform);
                return(true);
            }
            else
            {
                return(false);
            }
        }
    }