Differential D981 Diff 8352 ps/trunk/binaries/data/mods/public/simulation/components/UnitMotionFlying.js
Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/simulation/components/UnitMotionFlying.js
Show First 20 Lines • Show All 270 Lines • ▼ Show 20 Lines | UnitMotionFlying.prototype.MoveToTargetRange = function(target, minRange, maxRange) | ||||
this.targetX = targetPos.x; | this.targetX = targetPos.x; | ||||
this.targetZ = targetPos.y; | this.targetZ = targetPos.y; | ||||
this.targetMinRange = minRange; | this.targetMinRange = minRange; | ||||
this.targetMaxRange = maxRange; | this.targetMaxRange = maxRange; | ||||
return true; | return true; | ||||
}; | }; | ||||
UnitMotionFlying.prototype.IsInPointRange = function(x, y, minRange, maxRange) | |||||
{ | |||||
var cmpPosition = Engine.QueryInterface(this.entity, IID_Position); | |||||
var pos = cmpPosition.GetPosition2D(); | |||||
var distFromTarget = Math.euclidDistance2D(x, y, pos.x, pos.y); | |||||
if (minRange <= distFromTarget && distFromTarget <= maxRange) | |||||
return true; | |||||
return false; | |||||
}; | |||||
UnitMotionFlying.prototype.IsInTargetRange = function(target, minRange, maxRange) | |||||
{ | |||||
var cmpTargetPosition = Engine.QueryInterface(target, IID_Position); | |||||
if (!cmpTargetPosition || !cmpTargetPosition.IsInWorld()) | |||||
return false; | |||||
var targetPos = cmpTargetPosition.GetPosition2D(); | |||||
return this.IsInPointRange(targetPos.x, targetPos.y, minRange, maxRange); | |||||
}; | |||||
UnitMotionFlying.prototype.GetWalkSpeed = function() | UnitMotionFlying.prototype.GetWalkSpeed = function() | ||||
{ | { | ||||
return +this.template.MaxSpeed; | return +this.template.MaxSpeed; | ||||
}; | }; | ||||
UnitMotionFlying.prototype.SetSpeedMultiplier = function() | UnitMotionFlying.prototype.SetSpeedMultiplier = function() | ||||
{ | { | ||||
// ignore this, the speed is always the walk speed | // ignore this, the speed is always the walk speed | ||||
▲ Show 20 Lines • Show All 50 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator