コード例 #1
0
    // Start is called before the first frame update
    void Start()
    {
        rb            = GetComponent <Rigidbody2D>();
        fov_transform = FOV.transform;

        anim = GetComponent <Animator>();

        view = (FieldofView)FOV.GetComponent(typeof(FieldofView));
    }
コード例 #2
0
    private void OnSceneGUI()
    {
        FieldofView fov = (FieldofView)target;

        Handles.color = Color.white;
        Handles.DrawWireArc(fov.transform.position, Vector3.up, Vector3.forward, 360, fov.viewRadius);
        Vector3 viewAngleA = fov.DirFromAngle(-fov.viewAngle / 2, false);
        Vector3 viewAngleB = fov.DirFromAngle(fov.viewAngle / 2, false);

        Handles.DrawLine(fov.transform.position, fov.transform.position + viewAngleA * fov.viewRadius);
        Handles.DrawLine(fov.transform.position, fov.transform.position + viewAngleB * fov.viewRadius);

        Handles.color = Color.red;
        foreach (Transform visibleTarget in fov.visibleTargets)
        {
            Handles.DrawLine(fov.transform.position, visibleTarget.position);
        }
    }
コード例 #3
0
 void Start()
 {
     character   = GetComponent <CharacterController>();
     fieldTarget = GetComponent <FieldofView>();
 }