// 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)); }
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); } }
void Start() { character = GetComponent <CharacterController>(); fieldTarget = GetComponent <FieldofView>(); }