private static double Predict(Entity host, Entity target, ProjectileDesc desc) { Position? history = target.TryGetHistory(100); if (history == null) return 0; double originalAngle = Math.Atan2(history.Value.Y - host.Y, history.Value.X - host.X); double newAngle = Math.Atan2(target.Y - host.Y, target.X - host.X); float bulletSpeed = desc.Speed / 100; double angularVelo = (newAngle - originalAngle) / (100 / 1000f); return angularVelo * bulletSpeed; }
private double Predict(Entity entity, ProjectileDesc desc) { var history = entity.TryGetHistory(100); if (history == null) return 0; var originalAngle = Math.Atan2(history.Value.Y - Host.Self.Y, history.Value.X - Host.Self.X); var newAngle = Math.Atan2(entity.Y - Host.Self.Y, entity.X - Host.Self.X); var bulletSpeed = desc.Speed / 100f; var dist = Dist(entity, Host.Self); var angularVelo = (newAngle - originalAngle) / (100 / 1000f); return angularVelo * bulletSpeed; }
static double Predict(Entity host, Entity target, ProjectileDesc desc) { Position? history = target.TryGetHistory(100); if (history == null) return 0; var originalAngle = Math.Atan2(history.Value.Y - host.Y, history.Value.X - host.X); var newAngle = Math.Atan2(target.Y - host.Y, target.X - host.X); var bulletSpeed = desc.Speed / 100f; var dist = BehaviorUtils.Dist(target, host); var angularVelo = (newAngle - originalAngle) / (100 / 1000f); return angularVelo * bulletSpeed; }