2026-06-13 04:56:50 +01:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
2020-12-22 03:13:43 +00:00
|
|
|
* 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/. */
|
|
|
|
|
|
|
|
|
|
using System;
|
2020-05-12 01:42:13 +01:00
|
|
|
using System.Linq;
|
2021-04-18 05:13:20 +01:00
|
|
|
public class Trigger : Behavior, IActivatedBehavior
|
2020-05-12 01:42:13 +01:00
|
|
|
{
|
|
|
|
|
public bool _pulled;
|
2026-06-14 16:25:23 +01:00
|
|
|
public bool Pulled => _pulled;
|
2020-05-12 01:42:13 +01:00
|
|
|
|
2026-06-15 18:51:59 +01:00
|
|
|
public Trigger(RuntimeBehaviorDefinition definition, EquippedItem item) : base(definition, item) { }
|
|
|
|
|
public Trigger(RuntimeBehaviorDefinition definition, ConsumableItemEffect item) : base(definition, item) { }
|
2020-05-12 01:42:13 +01:00
|
|
|
|
2021-04-18 05:13:20 +01:00
|
|
|
public override bool Execute(float dt)
|
2020-05-12 01:42:13 +01:00
|
|
|
{
|
|
|
|
|
if (_pulled)
|
|
|
|
|
{
|
|
|
|
|
_pulled = false;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2021-01-25 05:53:36 +00:00
|
|
|
|
|
|
|
|
public void Activate()
|
|
|
|
|
{
|
|
|
|
|
_pulled = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Deactivate()
|
|
|
|
|
{
|
|
|
|
|
}
|
2026-06-16 09:01:05 +01:00
|
|
|
|
|
|
|
|
public void RestoreRuntimeState(bool pulled)
|
|
|
|
|
{
|
|
|
|
|
_pulled = pulled;
|
|
|
|
|
}
|
2026-06-14 16:25:23 +01:00
|
|
|
}
|