async ETVoid PushBack(Unit unit, Vector3 target, Buff_PushBack buff) { CharacterMoveComponent characterMoveComponent = unit.GetComponent <CharacterMoveComponent>(); float moveSpeed = Vector3.Distance(unit.Position, target) / buff.moveDuration; CharacterStateComponent characterStateComponent = unit.GetComponent <CharacterStateComponent>(); characterStateComponent.Set(SpecialStateType.NotInControl, true); //击退效果尝试打断. 以后这里要传参数,代表打断来源,然后下面这个方法里判断来源和技能允许被打断的类型 unit.GetComponent <ActiveSkillComponent>().Interrupt(TypeOfInterruption.FromNotInControl); await characterMoveComponent.PushBackedTo(target, moveSpeed); characterStateComponent.Set(SpecialStateType.NotInControl, false); }
protected override async void Run(ETModel.Session session, M2C_Pushback message) { Unit unit = UnitComponent.Instance.Get(message.Id); CharacterMoveComponent characterMoveComponent = unit.GetComponent <CharacterMoveComponent>(); float moveSpeed = Vector3.Distance(unit.Position, message.MoveTarget.ToV3()) / message.Time; CharacterStateComponent characterStateComponent = unit.GetComponent <CharacterStateComponent>(); characterStateComponent.Set(SpecialStateType.NotInControl, true); await characterMoveComponent.PushBackedTo(message.MoveTarget.ToV3(), moveSpeed); characterStateComponent.Set(SpecialStateType.NotInControl, false); }