Stop more simple behaviors retaining configs
This commit is contained in:
parent
fa7217fcc8
commit
8930b7945e
9 changed files with 37 additions and 32 deletions
|
|
@ -26,25 +26,25 @@ public class VelocityLimit : Behavior
|
|||
{
|
||||
public float Limit { get; private set; }
|
||||
|
||||
private VelocityLimitConfig _data;
|
||||
private readonly PerformanceStat _topSpeed;
|
||||
|
||||
public VelocityLimit(VelocityLimitConfig data, EquippedItem item) : base(data, item)
|
||||
{
|
||||
_data = data;
|
||||
Limit = Evaluate(_data.TopSpeed);
|
||||
_topSpeed = data.TopSpeed;
|
||||
Limit = Evaluate(_topSpeed);
|
||||
}
|
||||
|
||||
public VelocityLimit(VelocityLimitConfig data, ConsumableItemEffect item) : base(data, item)
|
||||
{
|
||||
_data = data;
|
||||
Limit = Evaluate(_data.TopSpeed);
|
||||
_topSpeed = data.TopSpeed;
|
||||
Limit = Evaluate(_topSpeed);
|
||||
}
|
||||
|
||||
public override bool Execute(float dt)
|
||||
{
|
||||
Limit = Evaluate(_data.TopSpeed);
|
||||
Limit = Evaluate(_topSpeed);
|
||||
if (length(Entity.Velocity) > Limit)
|
||||
Entity.Velocity = normalize(Entity.Velocity) * Limit;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue