// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { unitObject = animator.gameObject; navAgent = unitObject.GetComponent <NavMeshAgent>(); troopAgent = unitObject.GetComponent <TroopAgent>(); unitWeapon = unitObject.GetComponent <UnitWeaponBehavior>(); }
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { unitObject = animator.gameObject; navAgent = unitObject.GetComponent <NavMeshAgent>(); unitBrain = unitObject.GetComponent <UnitBrain>(); unitWeapon = unitObject.GetComponent <UnitWeaponBehavior>(); //unitHUD = unitBrain.GetComponent<UnitHUD>(); unitTarget = unitBrain.CurrentTarget; }
// Use this for initialization void Start() { animator = GetComponent <Animator>(); navAgent = GetComponent <NavMeshAgent>(); unitWeapon = GetComponent <UnitWeaponBehavior>(); unitHUD = GetComponent <UnitHUD>(); visionCollider = GetComponent <SphereCollider>(); VisableTargetList = new List <Transform>(); InitWayPath(); }
private void Start() { unitWeapon = GetComponent <UnitWeaponBehavior>(); navMeshAgent = GetComponent <NavMeshAgent>(); animator = GetComponent <Animator>(); }