Add TriggerActionFactory and related resources for button and logic sequence components
This commit is contained in:
@@ -15,6 +15,7 @@ using GameCore.Interaction;
|
||||
using GameCore.Inventory;
|
||||
using GameCore.Logging;
|
||||
using GameCore.Logging.Interfaces;
|
||||
using GameCore.Logic;
|
||||
using GameCore.Movement;
|
||||
using GameCore.Player;
|
||||
using Godot;
|
||||
@@ -64,7 +65,8 @@ public partial class GamePresenter : Node
|
||||
|
||||
var effectFactory = new EffectFactory();
|
||||
var requirementFactory = new InteractionRequirementFactory();
|
||||
var componentFactory = new ComponentFactory(effectFactory, requirementFactory);
|
||||
var triggerActionFactory = new TriggerActionFactory();
|
||||
var componentFactory = new ComponentFactory(effectFactory, requirementFactory, triggerActionFactory);
|
||||
var weaponDataService = new GodotWeaponDataService(WeaponDatabase, effectFactory);
|
||||
|
||||
_presenterFactory = new PresenterFactory(_world, componentFactory, _presenterRegistry, this);
|
||||
@@ -85,6 +87,7 @@ public partial class GamePresenter : Node
|
||||
|
||||
_world.RegisterSystem(new InteractionSystem(InteractionRange));
|
||||
_world.RegisterSystem(new DoorSystem());
|
||||
_world.RegisterSystem(new LogicSequenceSystem(_world));
|
||||
|
||||
_world.RegisterSystem(new WeaponSystem());
|
||||
_world.RegisterSystem(new ProjectileSystem());
|
||||
|
||||
@@ -125,10 +125,12 @@ public partial class HudPresenterComponent : Control, IPresenterComponent
|
||||
var lookingAt = _world.GetComponent<IsLookingAtInteractableComponent>(_playerEntity);
|
||||
if (lookingAt != null)
|
||||
{
|
||||
var door = _world.GetComponent<DoorComponent>(lookingAt.Target);
|
||||
var targetEntity = lookingAt.Target;
|
||||
var interactKey = "F";
|
||||
|
||||
var door = _world.GetComponent<DoorComponent>(targetEntity);
|
||||
if (door != null)
|
||||
{
|
||||
var interactKey = "F";
|
||||
_interactLabel.Text = door.CurrentState switch
|
||||
{
|
||||
DoorComponent.DoorState.Locked => $"[{interactKey}] Interact (Locked)",
|
||||
@@ -140,7 +142,26 @@ public partial class HudPresenterComponent : Control, IPresenterComponent
|
||||
}
|
||||
else
|
||||
{
|
||||
_interactLabel.Visible = false;
|
||||
var button = _world.GetComponent<ButtonComponent>(targetEntity);
|
||||
if (button != null)
|
||||
{
|
||||
if (button.IsOneTimeUse && button.HasBeenUsed)
|
||||
{
|
||||
_interactLabel.Text = "(Used)";
|
||||
}
|
||||
else if (button.IsToggle)
|
||||
{
|
||||
_interactLabel.Text = button.IsPressed ? $"[{interactKey}] Deactivate" : $"[{interactKey}] Activate";
|
||||
}
|
||||
else
|
||||
{
|
||||
_interactLabel.Text = $"[{interactKey}] Press Button";
|
||||
}
|
||||
_interactLabel.Visible = true;
|
||||
} else
|
||||
{
|
||||
_interactLabel.Visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user