本文整理匯總了C#中wServer.realm.Entity.TryGetHistory方法的典型用法代碼示例。如果您正苦於以下問題:C# Entity.TryGetHistory方法的具體用法?C# Entity.TryGetHistory怎麽用?C# Entity.TryGetHistory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類wServer.realm.Entity
的用法示例。
在下文中一共展示了Entity.TryGetHistory方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Predict
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;
}
示例2: Predict
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;
}
示例3: Predict
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;
}