private void Awake() { _aiFieldOfView = GetComponent <AiFieldOfView>(); _aiPathfinding = GetComponent <AiPathfinding>(); _aiAttack = GetComponent <AiAttack>(); _animator = GetComponent <Animator>(); }
private void SetComponents() { _agent = this.gameObject.GetComponent <NavMeshAgent>(); _anim = this.gameObject.transform.GetChild(0).GetComponent <Animator>(); _aiStateMachine = _anim.GetBehaviour <AIStateMachine>(); _aiStateMachine.AIBehaviour = this; _aiFOV = this.gameObject.GetComponent <AiFieldOfView>(); }
private void OnSceneGUI() { AiFieldOfView aiFow = (AiFieldOfView)target; Handles.color = Color.white; Handles.DrawWireArc(aiFow.transform.position, Vector3.up, Vector3.forward, 360, aiFow.ViewRadius); Vector3 viewAngleA = aiFow.DirFromAngle(-aiFow.ViewAngle / 2, false); Vector3 viewAngleB = aiFow.DirFromAngle(aiFow.ViewAngle / 2, false); Handles.DrawLine(aiFow.transform.position, aiFow.transform.position + viewAngleA * aiFow.ViewRadius); Handles.DrawLine(aiFow.transform.position, aiFow.transform.position + viewAngleB * aiFow.ViewRadius); }