2021-03-04 03:58:46 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
2021-04-18 05:13:20 +01:00
|
|
|
public class Wear : Behavior
|
2021-03-04 03:58:46 +00:00
|
|
|
{
|
2026-06-15 17:48:36 +01:00
|
|
|
private readonly bool _perSecond;
|
2021-03-04 03:58:46 +00:00
|
|
|
|
2026-06-15 19:06:13 +01:00
|
|
|
public Wear(RuntimeBehaviorDefinition definition, EquippedItem item) : base(definition, item)
|
2021-04-18 05:13:20 +01:00
|
|
|
{
|
2026-06-15 19:06:13 +01:00
|
|
|
_perSecond = definition.Bool(1, true);
|
2021-04-18 05:13:20 +01:00
|
|
|
}
|
2026-06-15 19:06:13 +01:00
|
|
|
|
|
|
|
|
public Wear(RuntimeBehaviorDefinition definition, ConsumableItemEffect item) : base(definition, item)
|
2021-03-04 03:58:46 +00:00
|
|
|
{
|
2026-06-15 19:06:13 +01:00
|
|
|
_perSecond = definition.Bool(1, true);
|
2021-03-04 03:58:46 +00:00
|
|
|
}
|
|
|
|
|
|
2021-04-18 05:13:20 +01:00
|
|
|
public override bool Execute(float dt)
|
2021-03-04 03:58:46 +00:00
|
|
|
{
|
2026-06-15 17:48:36 +01:00
|
|
|
CauseWearDamage(_perSecond ? dt : 1);
|
2021-03-04 03:58:46 +00:00
|
|
|
return true;
|
|
|
|
|
}
|
2026-06-15 17:48:36 +01:00
|
|
|
}
|