public override void ActionState(FSMBase fsm) { base.ActionState(fsm); //获取最小值 Vector3 movement = (fsm.SelectTargetByDistanceMin(fsm.chStatus.scoutDistance).position - fsm.transform.position).normalized; //fsm.chMotor.MoveSpeed=followSpeed; //Debug.Log(movement); //fsm.chMotor.Movement(movement); }
public override void ActionState(FSMBase fsm) { base.ActionState(fsm); Vector3 attackMovement = Vector3.zero; //攻击间隔判断 if (!isAttack && lastAttackTime + fsm.chStatus.attackInterval < Time.time) { attackMovement = (fsm.SelectTargetByDistanceMin(fsm.chStatus.scoutDistance).position - fsm.transform.position).normalized * 10; //给一个初始初速度 fsm.chMotor.SetVelocity(attackMovement); //设置动画 fsm.anim.SetTrigger(fsm.chStatus.chParameter.Attack01); fsm.anim.SetFloat("Attack01_Angle", attackMovement.x); //速度延时停止 fsm.AttackStop(0.5f); lastAttackTime = Time.time; } }