private void _Update(int diff) { if (info.fatalRadius > 0 && stateMachine.passiveSource) { var fatal_ = Vector3_.Distance(stateMachine.passiveSource.position_, stateMachine.creature.position_) < info.fatalRadius; if (fatal ^ fatal_) { stateMachine.passiveSource.stateMachine.SetParam(StateMachineParam.fatal, fatal_ ? 1 : -1, true); } fatal = fatal_; } if (m_waitToResetKey) { m_waitToResetKey = false; stateMachine.SetParam(StateMachineParam.key, 0); stateMachine.SetParam(StateMachineParam.process, 2); stateMachine.SetParam(StateMachineParam.moveBreak, true); } if (!stateMachine.playable) { return; } if (m_falling) { if (!stateMachine.creature.onGround) { m_fallTime += diff; return; } m_falling = false; m_fallTime = 0; } m_time += diff; var frames = m_time / 33 - m_currentFrame; m_normalizedTime = (float)m_time / m_length; IncreaseFrame(frames); UpdateAnimMotion(); if (loop && m_currentFrame >= frameCount) { m_waitToLoop = true; } if (ended && !noDefaultTrans && !stateMachine.GetBool(StateMachineParam.isDead)) { m_waitToDefault = true; } }
public override void OnUpdate(int diff) { if (!enableUpdate) { return; } base.OnUpdate(diff); if (firstStep) { var direction = randomPosition - position_; direction.Normalize(); var p = position_ + direction * (velocity + acceleration * m_time * 0.001) * diff * 0.001; if (p.y < 0) { p.y = 0; } position = position_ = p;; if (Vector3_.Distance(position_, randomPosition) < 0.2 || Vector3_.Dot(startPos - randomPosition, position_ - randomPosition) <= 0) { enableUpdate = false; firstStep = false; } return; } var targetPos = (Vector3_)target.LogicPosition + offset; position = position_ = motion.Evaluate(diff * 0.001); var d = Vector3_.Distance(position_, targetPos); var a = Vector3_.Dot(startPos - targetPos, position_ - targetPos); FightRecordManager.RecordLog <LogEffectPos>(log => { log.tag = (byte)TagType.EffectPos; log.pos = new double[3]; log.pos[0] = position_.x; log.pos[1] = position_.y; log.pos[2] = position_.z; log.distance = d; log.angle = a; }); if (d < 0.2 || a <= 0) { Destroy(); } }
private double CalcSlanteThrowTime() { return(Vector3_.Distance(startPos, end.LogicPosition) / data.velocity * 0.5); }