public virtual void Update(SkillObjMoveController ctrl, SkillBulletMove move, float deltaTime, float timeMS) { float dis = move.UpdateMove2D(deltaTime, timeMS); ctrl.SetMovingDistance(ctrl.GetMovingDistance() + dis); ctrl.SetLifeTime(ctrl.GetLifeTime() - deltaTime / 1000f); }
public override void Update(SkillObjMoveController ctrl, SkillBulletMove move, float deltaTime, float timeMS) { double MoveDir = move.GetSpeedDirection_Radian(); int tarId = ctrl.GetTarID(); var target = ctrl.GetTar(); if (target != null && !target.IsDead()) { MoveDir = BattleHelper.Radian2PI(MoveDir); var tarPos = target.GetPos(); Vector3_Hzy selfPos = ctrl.GetPos(); double radian = BattleHelper.RadianA2B_2D(tarPos, selfPos); radian = BattleHelper.Radian2PI(radian); if (radian != MoveDir) { float tickRadian = ctrl.GetMovingFloatParam(Key_TickRadian_MovingFloatParam); double something = ((5 + tickRadian) * System.Math.PI / 180); double changeRadian = BattleHelper.RadianA2B_Sym(radian, MoveDir, something); tickRadian += deltaTime * 0.6f / 30; ctrl.SetMovingFloatParam(Key_TickRadian_MovingFloatParam, tickRadian); MoveDir = BattleHelper.Radian2PI(MoveDir + changeRadian); move.SetSpeedDirection((float)MoveDir); } } else { ctrl.SetLifeTime(-1); return; } base.Update(ctrl, move, deltaTime, timeMS); }
public override void Update(SkillObjMoveController ctrl, SkillBulletMove move, float deltaTime, float timeMS) { double MoveDir = move.GetSpeedDirection_Radian(); int tarId = ctrl.GetTarID(); var target = ctrl.GetTar(); if (target != null && !target.IsDead()) { MoveDir = BattleHelper.Radian2PI(MoveDir); var tarPos = target.GetPos(); Vector3_Hzy selfPos = ctrl.GetPos(); double radian = BattleHelper.RadianA2B_2D(tarPos, selfPos); radian = BattleHelper.Radian2PI(radian); if (radian != MoveDir) { float tickRadian = ctrl.GetMovingFloatParam(Key_TickRadian_MovingFloatParam); double something = ((5 + tickRadian) * System.Math.PI / 180); double changeRadian = BattleHelper.RadianA2B_Sym(radian, MoveDir, something); tickRadian += deltaTime*0.6f/30; ctrl.SetMovingFloatParam(Key_TickRadian_MovingFloatParam, tickRadian); MoveDir = BattleHelper.Radian2PI(MoveDir + changeRadian); move.SetSpeedDirection((float)MoveDir); } } else { ctrl.SetLifeTime(-1); return; } base.Update(ctrl, move, deltaTime, timeMS); }
public override void Init(SkillObjMoveController ctrl, SkillBulletMove move, float lifeTime = -1) { base.Init(ctrl, move, lifeTime); }
public override void Update(SkillObjMoveController ctrl, SkillBulletMove move, float deltaTime, float timeMS) { base.Update(ctrl, move, deltaTime, timeMS); var tarPos = ctrl.GetVecParam(); if (move.SpeedDirection.x == 0 && move.SpeedDirection.y == 0) { SkillVector3 lastPos = move.GetMoveStruct().position; var disX = tarPos.x - lastPos.x; var disZ = tarPos.y - lastPos.y; if (disX * disX + disZ * disZ <= 0.3 * 0.3) { move.SpeedValue = 0; var action = ctrl.GetMoveCallBackAction(); if (action != null) { action(ctrl); } } } else { // P(tarPos) // /| // / | // / | // (lastPos)A————*————————————B(p) // C(AP在AB上的投影点) SkillVector3? lastPos = null; foreach (var p in move.GetMovingTrajectory()) { if(lastPos != null) { SkillVector3 AP = tarPos - lastPos.Value; SkillVector3 AB = p - lastPos.Value; ; var dot_AB_AP = AB.Dot2D(AP); var disAB_Pow_2 = AB.DisPow2(); double min_P2AB = 0; if(dot_AB_AP <= 0) { //AP min_P2AB = AP.DisPow2(); } else if(dot_AB_AP >= disAB_Pow_2) { //BP min_P2AB = (p - tarPos).DisPow2(); } else { //PC = -AP + AC min_P2AB = (-AP + (dot_AB_AP/ disAB_Pow_2)*AB).DisPow2(); } if (min_P2AB <= 0.3 * 0.3) { move.SpeedValue = 0; var action = ctrl.GetMoveCallBackAction(); if (action != null) { action(ctrl); } break; } } lastPos = p; } } return; }
//public virtual bool CheckSummon() //{ // return true; //} public virtual void Init(SkillObjMoveController ctrl, SkillBulletMove move, float lifeTime = -1) { ctrl.SetLifeTime(lifeTime); }
public override void Update(SkillObjMoveController ctrl, SkillBulletMove move, float deltaTime, float timeMS) { base.Update(ctrl, move, deltaTime, timeMS); var tarPos = ctrl.GetVecParam(); if (move.SpeedDirection.x == 0 && move.SpeedDirection.y == 0) { SkillVector3 lastPos = move.GetMoveStruct().position; var disX = tarPos.x - lastPos.x; var disZ = tarPos.y - lastPos.y; if (disX * disX + disZ * disZ <= 0.3 * 0.3) { move.SpeedValue = 0; var action = ctrl.GetMoveCallBackAction(); if (action != null) { action(ctrl); } } } else { // P(tarPos) // /| // / | // / | // (lastPos)A————*————————————B(p) // C(AP在AB上的投影点) SkillVector3?lastPos = null; foreach (var p in move.GetMovingTrajectory()) { if (lastPos != null) { SkillVector3 AP = tarPos - lastPos.Value; SkillVector3 AB = p - lastPos.Value;; var dot_AB_AP = AB.Dot2D(AP); var disAB_Pow_2 = AB.DisPow2(); double min_P2AB = 0; if (dot_AB_AP <= 0) { //AP min_P2AB = AP.DisPow2(); } else if (dot_AB_AP >= disAB_Pow_2) { //BP min_P2AB = (p - tarPos).DisPow2(); } else { //PC = -AP + AC min_P2AB = (-AP + (dot_AB_AP / disAB_Pow_2) * AB).DisPow2(); } if (min_P2AB <= 0.3 * 0.3) { move.SpeedValue = 0; var action = ctrl.GetMoveCallBackAction(); if (action != null) { action(ctrl); } break; } } lastPos = p; } } return; }
public override void Update(SkillObjMoveController ctrl, SkillBulletMove move, float deltaTime, float timeMS) { ctrl.SetLifeTime(ctrl.GetLifeTime() - deltaTime / 1000f); return; }
public override void Update(SkillObjMoveController ctrl, SkillBulletMove move, float deltaTime, float timeMS) { base.Update(ctrl, move, deltaTime, timeMS); return; }