public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { TargetActor = animator.GetComponent <NonPlayer>(); TargetObject = (BaseObject)(TargetActor.GetData(ConstValue.ActorData_GetTarget)); if (TargetObject == null) { Debug.LogError("타겟널이야 홍은기 븅시나"); } if (TargetActor.AI.CURRENT_AI_STATE == eStateType.STATE_SPECIAL) { TargetActor.AI.IS_SKILL = true; bIsAttack = false; CurTime = 0f; } //get_target을 보내 타겟 정보를 가져옴 //타겟(플레이어)의 위치를 구함 Vector3 targetPos = TargetObject.SelfTransform.position; //보스의 위치를 구함 SelfPos = TargetActor.SelfTransform.position; //FireBallCreate.transform.position = SelfPos; //FireBallCreate.transform.localRotation = TargetActor.SelfTransform.rotation; //보스와 타겟의 방향을 구함. Vector3 norPos = (SelfPos - targetPos).normalized * 2f; TargetPos = targetPos + norPos; }
// 첫 번째와 마지막 프레임을 제외하고 각 업데이트 프레임에서 호출됩니다. public override void OnStateUpdate( Animator animator, AnimatorStateInfo animatorStateInfo, int layerIndex) { if (animatorStateInfo.normalizedTime >= 1.0f && TargetActor.AI.IS_ATTACK) { //BaseObject bo = // animator.GetComponentInParent<BaseObject>(); //bo.ThrowEvent("AttackEnd",eStateType.STATE_IDLE); if (TargetActor.AI.CURRENT_AI_STATE == eStateType.STATE_ATTACK) { TargetActor.AI.IS_ATTACK = false; } } if (bLookAt) { Vector3 Dir = ((TargetActor.GetData(ConstValue.ActorData_GetTarget) as BaseObject).SelfTransform.position - TargetActor.SelfTransform.position).normalized; TargetActor.SelfTransform.forward = Dir; } if (bIsAttack == false && animatorStateInfo.normalizedTime >= RunSkillTiming) { bLookAt = false; bIsAttack = true; TargetActor.RunSkill(); } // GiantEnemy 일 때 3타공격 발동. (하드코딩임.. 구조상 이게 제일 편함) if (bGiantEnemy && bFinalAttack == false && animatorStateInfo.normalizedTime >= RunSkillTiming + 0.29f) { bFinalAttack = true; TargetActor.ThrowEvent(ConstValue.EventKey_SelectSkill, 1); TargetActor.RunSkill(); } //if (animatorStateInfo.normalizedTime >= 1.0f // && TargetActor.AI.IS_ATTACK) //{ // //BaseObject bo = // // animator.GetComponentInParent<BaseObject>(); // //bo.ThrowEvent("AttackEnd",eStateType.STATE_IDLE); // if (TargetActor.AI.CURRENT_AI_STATE == eStateType.STATE_ATTACK) // TargetActor.AI.IS_ATTACK = false; //} //if (bIsAttack == false // && animatorStateInfo.normalizedTime >= 0.5f) //{ // bIsAttack = true; // TargetActor.RunSkill(); //} }
public override void OnStateEnter(Animator animator, AnimatorStateInfo animatorStateInfo, int layerIndex) { TargetActor = animator.GetComponentInParent<NonPlayer>(); if (TargetActor.AI.CURRENT_AI_STATE == eStateType.STATE_SPECIAL) { TargetActor.AI.IS_SKILL = true; bIsAttack = false; CurTime = 0f; } TargetObject = (BaseObject)(TargetActor.GetData(ConstValue.ActorData_GetTarget)); Vector3 targetPos = TargetObject.SelfTransform.position; SelfPos = TargetActor.SelfTransform.position; Vector3 norPos = (SelfPos - targetPos).normalized * 2f; TargetPos = targetPos + norPos; }