// Use this for initialization protected override void Start() { base.Start(); EB_Sprite = GO_Billboard.GetComponent <EnemyBillboard>(); pathfinder = GetComponent <UnityEngine.AI.NavMeshAgent>(); skinMaterial = GetComponent <Renderer>().material; originalColour = skinMaterial.color; currentState = State.Roam; fieldOfView = GetComponent <AC_FieldOfView>(); fieldOfNoise = GetComponent <AC_FieldOfNoise>(); mFL_moveSpeed = pathfinder.speed; player = GetComponent <AC_Player>(); //desiredVelocity = pathfinder.speed * 5; pathfinder.autoBraking = false; if (GameObject.FindGameObjectWithTag("Player") != null) { hasTarget = true; target = GameObject.FindGameObjectWithTag("Player").transform; //targetEntity = target.GetComponent<AC_Living>(); //targetEntity.OnDeath += OnTargetDeath; myCollisionRadius = GetComponent <CapsuleCollider>().radius; targetCollisionRadius = target.GetComponent <CapsuleCollider>().radius; InvokeRepeating("Chase", .1F, .1F); } GotoNextPoint(); }
void OnSceneGUI() { AC_FieldOfNoise fow = (AC_FieldOfNoise)target; Handles.color = Color.black; Handles.DrawWireArc(fow.transform.position, Vector3.up, Vector3.forward, 360, fow.viewRadius); Vector3 viewAngleA = fow.DirFromAngle(-fow.viewAngle / 2, false); Vector3 viewAngleB = fow.DirFromAngle(fow.viewAngle / 2, false); Handles.DrawLine(fow.transform.position, fow.transform.position + viewAngleA * fow.viewRadius); Handles.DrawLine(fow.transform.position, fow.transform.position + viewAngleB * fow.viewRadius); Handles.color = Color.red; foreach (Transform VisibleTarget in fow.VisibleTargets) { Handles.DrawLine(fow.transform.position, VisibleTarget.position); } }