// 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) { ThisNPC = animator.transform.GetComponent <NPCMoveTest>(); SaveOtherNPC(); ThisNPC.Overtaking = true; _OvertSpeed = ThisNPC.configData.Speed /** 2*/; }
private void CheckOvertake(NPCMoveTest _other) { if (_other != null) { float _distance = Vector3.Distance(ThisNPC.transform.position, _other.transform.position); if ((_distance > 5f && !_other.Overtaking) || _other.direction == ThisNPC.direction) { ThisNPC.OvertakeZone = _OvertakeZone; ThisNPC.GetComponent <Animator>().SetBool("CanOvertake", true); } } else { ThisNPC.OvertakeZone = _OvertakeZone; ThisNPC.GetComponent <Animator>().SetBool("CanOvertake", true); } }
// 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) { ThisNPC = animator.transform.GetComponent <NPCMoveTest>(); ZoneCheck(); CheckDistance(); }
// 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) { Character = animator.GetComponent <NPCMoveTest>(); CheckDistance(animator); UpdateNPCValues(); }