Compare commits

..

No commits in common. "84199621602b11fdacb82e97c9d16ab5ff550b32" and "5721986a746c16f5d2b626fe495ecac2cc31767e" have entirely different histories.

23 changed files with 107 additions and 108 deletions

View File

@ -251,7 +251,7 @@ MonoBehaviour:
id: a2bcfde700d74b6397798ea30791316a
actionCategory: 0
canBeDropped: 0
shouldDropFromBeltWhenActivated: 0
shouldDropFromBeltWhenActivated: 1
saveStationModelPrototype: {fileID: 3729166946730868368}
actionLocalization: {fileID: 11400000, guid: 218e1b6f0cf274c8195e312760cf82b0, type: 2}
descriptionLocalization: {fileID: 11400000, guid: 677dd73e7449b408590ce7f89865a8d0, type: 2}

View File

@ -1,8 +1,8 @@
fileFormatVersion: 2
guid: 5fa9aef3ab3364c00927f003e33f4321
NativeFormatImporter:
guid: 88399dcea34e045d089090d6a4dc0143
folderAsset: yes
DefaultImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,15 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4910d586b6414626b9ec5c228904bf46, type: 3}
m_Name: action-belt-manager.sentinel
m_EditorClassIdentifier: Assembly-CSharp::Intrepid.Gameplay.Entities.Sentinel.Tags.ActionBeltManagerTag
code: action-belt-manager.sentinel

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 99848f21b8e934dc1a0f1f50b435799d
guid: 24d31645b4d544dd69b6ada8858ba50e
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000

View File

@ -16,5 +16,3 @@ MonoBehaviour:
shouldBeKeptAlwaysEnabled: 0
onEntry: {fileID: 11400000, guid: b12d41919e089475da15bef8808f80b8, type: 2}
onExit: {fileID: 11400000, guid: 86176d631377e4d5fba70988ef37e9d9, type: 2}
onShow: {fileID: 11400000, guid: 5fa9aef3ab3364c00927f003e33f4321, type: 2}
onHide: {fileID: 11400000, guid: 99848f21b8e934dc1a0f1f50b435799d, type: 2}

View File

@ -1,18 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6f2337b04d5e44dba892ac6b72ae7e44, type: 3}
m_Name: action-belt.window.hide
m_EditorClassIdentifier: Intrepid General Utilities::Intrepid.Window.Data.WindowAnimationData
mode: 3
direction: 1
soundEffect: {fileID: 0}
animationSpeed: 3

View File

@ -1,18 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6f2337b04d5e44dba892ac6b72ae7e44, type: 3}
m_Name: action-belt.window.show
m_EditorClassIdentifier: Intrepid General Utilities::Intrepid.Window.Data.WindowAnimationData
mode: 3
direction: 0
soundEffect: {fileID: 0}
animationSpeed: 3

View File

@ -1,5 +1,6 @@
using Intrepid.GameManagers;
using Intrepid.Gameplay.Entities.Player.ActionBelt.Events;
using Intrepid.Gameplay.Entities.Player.Tags;
using Intrepid.SimpleEvents;
using Intrepid.Utilities;
using Sirenix.OdinInspector;
@ -9,6 +10,7 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt
{
public class ActionBeltManager : EventListener
{
[GroupConfigurations, SerializeField] private ActionBeltManagerTag actionBeltManagerTag;
[GroupConfigurations, SerializeField] private bool nextRight = true;
[Title("Action Belt")]
@ -17,6 +19,7 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt
[GroupDebug, ShowInInspector, ReadOnly, ToggleLeft, PropertyOrder(-1)] public bool IsOperational { get; private set; }
public bool IsEmpty => ActionBelt.IsEmpty;
public bool IsNotEmpty => !IsEmpty;
public ActionBeltManagerTag ActionBeltManagerTag => actionBeltManagerTag;
public ActionEnvelope Focus => ActionBelt.Focus;
public ActionEnvelope PeekRight => ActionBelt.PeekRight;
public ActionEnvelope PeekLeft => ActionBelt.PeekLeft;
@ -49,6 +52,7 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt
private void WhenActionBeltDrop(ActionBeltDropEvent e)
{
if (!actionBeltManagerTag.Equals(e.ActionBeltManger)) return;
if (ActionBelt.IsEmpty) return;
if (!ActionBelt.Focus.CanBeDropped) return;
if (!ActionBelt.RemoveById(ActionBelt.Focus.ActionIdentifier.Id, nextRight)) return;
@ -58,25 +62,35 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt
private void WhenActionBeltEnable(ActionBeltEnableEvent e)
{
if (!actionBeltManagerTag.Equals(e.ActionBeltManger)) return;
IsOperational = true;
if (IsEmpty) return;
OpenUI();
}
private void WhenActionBeltDisable(ActionBeltDisableEvent e)
{
if (!actionBeltManagerTag.Equals(e.ActionBeltManger)) return;
IsOperational = false;
Proxy.Instance.EventBus.Raise(new ActionBeltUICloseEvent());
}
private void WhenActionBeltRefresh(ActionBeltRefreshEvent e)
{
if (!actionBeltManagerTag.Equals(e.ActionBeltManger)) return;
Proxy.Instance.EventBus.Raise(new ActionBeltUICloseEvent());
ActionBelt.ResetIndex();
Proxy.Instance.EventBus.Raise(new ActionBeltEnableEvent());
// we should affect others managers as well...
Proxy.Instance.EventBus.Raise(new ActionBeltEnableEvent
{
ActionBeltManger = e.ActionBeltManger,
});
}
private void WhenAddActionOnTheBelt(ActionBeltAddEvent e)
{
if (!actionBeltManagerTag.Equals(e.ActionBeltManger)) return;
ActionBelt.Push(e.ActionEnvelope);
if (!IsOperational) return;
OpenUI();
@ -84,42 +98,48 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt
private void WhenActionBeltRemoveById(ActionBeltRemoveByIdEvent e)
{
if (!actionBeltManagerTag.Equals(e.ActionBeltManger)) return;
if (!ActionBelt.RemoveById(e.ActionId, nextRight)) return;
CirculateUI();
}
private void WhenActionBeltRemoveByType(ActionBeltRemoveByTypeEvent e)
{
if (!actionBeltManagerTag.Equals(e.ActionBeltManger)) return;
if (!ActionBelt.RemoveByType(e.ActionCategory, nextRight)) return;
CirculateUI();
}
private void WhenActionBeltRemoveByIdAndType(ActionBeltRemoveByIdAndTypeEvent e)
{
if (!actionBeltManagerTag.Equals(e.ActionBeltManger)) return;
if (!ActionBelt.RemoveByIdAndType(e.ActionId, e.ActionCategory, nextRight)) return;
CirculateUI();
}
private void WhenCleanActionBelt(ActionBeltClearEvent e)
{
if (!actionBeltManagerTag.Equals(e.ActionBeltManger)) return;
ActionBelt.Clear();
}
private void WhenActionBeltTakeAction(ActionBeltTakeActionEvent e)
{
if (!actionBeltManagerTag.Equals(e.ActionBeltManger)) return;
TakeAction();
if (!IsOperational) return;
Proxy.Instance.EventBus.Raise(new ActionBeltUITakeActionEvent());
}
private void WhenActionBeltNextRight(ActionBeltNextRightEvent e)
{
if (!actionBeltManagerTag.Equals(e.ActionBeltManger)) return;
ActionBelt.NextRight();
CirculateUI();
}
private void WhenActionBeltNextLeft(ActionBeltNextLeftEvent e)
{
if (!actionBeltManagerTag.Equals(e.ActionBeltManger)) return;
ActionBelt.NextLeft();
CirculateUI();
}
@ -134,20 +154,18 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt
private void OpenUI()
{
if (!IsOperational) return;
if (IsEmpty) return;
Proxy.Instance.EventBus.Raise(new ActionBeltUIOpenEvent
{
ActionBelt = ActionBelt,
// GetFocusActionEnvelope = () => ActionBelt.Focus,
// SneakPeekRightActionEnvelope = () => ActionBelt.PeekRight,
// SneakPeekLeftActionEnvelope = () => ActionBelt.PeekLeft,
// GetSize = () => ActionBelt.Count,
});
}
private void CirculateUI()
{
if (!IsOperational) return;
if (IsEmpty) return;
if (nextRight)
{
Proxy.Instance.EventBus.Raise(new ActionBeltUIToRightEvent());

View File

@ -20,7 +20,7 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt
protected override void WhenRaiseEnterEvent(Collider other, EntitySensor entitySensor, List<BehaviourTag> behaviourTags)
{
if (entitySensor.EntityTag is PlayerTag)
if (entitySensor.EntityTag is PlayerTag playerTag)
{
foreach (var callable in callables)
{
@ -28,6 +28,7 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt
if (callable.IsNotEnabled) continue;
Proxy.Instance.EventBus.Raise(new ActionBeltAddEvent
{
ActionBeltManger = playerTag.ActionBeltManger,
ActionEnvelope = callable.BuildEnvelope(),
});
}
@ -36,12 +37,13 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt
protected override void WhenRaiseExitEvent(Collider other, EntitySensor entitySensor)
{
if (entitySensor.EntityTag is PlayerTag)
if (entitySensor.EntityTag is PlayerTag playerTag)
{
foreach (var callable in callables)
{
Proxy.Instance.EventBus.Raise(new ActionBeltRemoveByIdEvent
{
ActionBeltManger = playerTag.ActionBeltManger,
ActionId = callable.Id,
});
}

View File

@ -1,8 +1,10 @@
using Intrepid.Gameplay.Entities.Player.Tags;
using Intrepid.SimpleEvents;
namespace Intrepid.Gameplay.Entities.Player.ActionBelt.Events
{
public abstract class ActionBeltBaseEvent : IEventBase
{
public ActionBeltManagerTag ActionBeltManger { get; set; }
}
}

View File

@ -1,8 +0,0 @@
using Intrepid.SimpleEvents;
namespace Intrepid.Gameplay.Entities.Player.ActionBelt.Events
{
public class ActionBeltHideEvent : IEventBase
{
}
}

View File

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: d82e173549834f8ebb63570df81ef64f
timeCreated: 1782975954

View File

@ -1,8 +0,0 @@
using Intrepid.SimpleEvents;
namespace Intrepid.Gameplay.Entities.Player.ActionBelt.Events
{
public class ActionBeltShowEvent : IEventBase
{
}
}

View File

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: d84bdcd9e99048e08e3d3ad428b60fd0
timeCreated: 1782975971

View File

@ -62,9 +62,6 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt.UI
protected override void Subscriptions()
{
Subscribe<ActionBeltShowEvent>(_ => ManagedWindow.Show());
Subscribe<ActionBeltHideEvent>(_ => ManagedWindow.Hide());
Subscribe<ActionBeltUIToRightEvent>(WhenActionBeltNextRight);
Subscribe<ActionBeltUIToLeftEvent>(WhenActionBeltNextLeft);
@ -74,8 +71,6 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt.UI
private void WhenActionBeltUIDrop(ActionBeltUIDropEvent e)
{
if (!actionBeltManager.IsOperational) return;
center.BlinkBorderDropped();
if (local.gameObject.activeSelf) local.BlinkBorderDropped();
}
@ -94,7 +89,6 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt.UI
private void WhenActionBeltNextRight(ActionBeltUIToRightEvent e)
{
if (!actionBeltManager.IsOperational) return;
if (!IsOptionActive) return;
SwitchRight();
contentIconAnimation.SpriteAnimation.Reset();
@ -103,7 +97,6 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt.UI
private void WhenActionBeltNextLeft(ActionBeltUIToLeftEvent e)
{
if (!actionBeltManager.IsOperational) return;
if (!IsOptionActive) return;
SwitchLeft();
contentIconAnimation.SpriteAnimation.Reset();
@ -112,8 +105,6 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt.UI
private void WhenActionBeltUITakeAction(ActionBeltUITakeActionEvent e)
{
if (!actionBeltManager.IsOperational) return;
center.BlinkBorderActionTaken();
if (local.gameObject.activeSelf) local.BlinkBorderActionTaken();
}
@ -138,13 +129,6 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt.UI
private void Update()
{
UpdateTheme();
if (!actionBeltManager.IsOperational)
{
Proxy.Instance.EventBus.Raise(new ActionBeltUICloseEvent());
return;
}
switch (GetNumberOfActionsInBelt())
{
case 0:

View File

@ -46,7 +46,10 @@ namespace Intrepid.Gameplay.Entities.Player.Sentinel.StateMachine
if (Brain.ActionBeltManager.IsEmpty) return;
if (Brain.InputResolver.Sentinel.Interact())
{
Proxy.Instance.EventBus.Raise(new ActionBeltTakeActionEvent());
Proxy.Instance.EventBus.Raise(new ActionBeltTakeActionEvent
{
ActionBeltManger = Brain.ActionBeltManager.ActionBeltManagerTag,
});
return;
}
@ -56,11 +59,17 @@ namespace Intrepid.Gameplay.Entities.Player.Sentinel.StateMachine
if (left && right) return;
if (left)
{
Proxy.Instance.EventBus.Raise(new ActionBeltNextLeftEvent());
Proxy.Instance.EventBus.Raise(new ActionBeltNextLeftEvent
{
ActionBeltManger = Brain.ActionBeltManager.ActionBeltManagerTag,
});
}
if (right)
{
Proxy.Instance.EventBus.Raise(new ActionBeltNextRightEvent());
Proxy.Instance.EventBus.Raise(new ActionBeltNextRightEvent
{
ActionBeltManger = Brain.ActionBeltManager.ActionBeltManagerTag,
});
}
}
@ -102,7 +111,7 @@ namespace Intrepid.Gameplay.Entities.Player.Sentinel.StateMachine
protected bool TryConsumeDash()
{
if (Brain.InputResolver.Sentinel.TryConsumeDash(out var dashTimeAt)) // dash with no ground: this could be a feature to be unlocked
//if (Brain.Entity.IsGrounded && Brain.InputResolver.TryConsumeDash(out var dashTimeAt))
//if (Brain.Entity.IsGrounded && Brain.InputResolver.TryConsumeDash(out var dashTimeAt))
{
var targetTime = Brain.Config.DashImpulse.Duration + Brain.Config.DashRecovery.Duration;
KeepCadenceWithInputAt(Brain.Cadences.DashProfile, targetTime, dashTimeAt);

View File

@ -1,7 +1,5 @@
using Intrepid.Core;
using Intrepid.Diagnostics;
using Intrepid.GameManagers;
using Intrepid.Gameplay.Entities.Player.ActionBelt.Events;
using Intrepid.Integration.Input;
using Intrepid.Integration.Persistence.Events;
using Intrepid.Structures;
@ -24,13 +22,13 @@ namespace Intrepid.Gameplay.Entities.Player.Sentinel.StateMachine.States
protected override void Subscriptions()
{
Subscribe<SavingGameDataBeginEvent>(_ =>
Subscribe<SavingGameDataBeginEvent>(e =>
{
DLogger.LogDebug("Saving started");
DLogger.LogDebug($"Saving started");
});
Subscribe<SavingGameDataEndEvent>(_ =>
Subscribe<SavingGameDataEndEvent>(e =>
{
DLogger.LogDebug("Saving ended");
DLogger.LogDebug($"Saving ended");
Timer.Start();
});
}
@ -55,7 +53,6 @@ namespace Intrepid.Gameplay.Entities.Player.Sentinel.StateMachine.States
protected override void RunOnExit()
{
Timer.Stop();
Proxy.Instance.EventBus.Raise(new ActionBeltShowEvent());
}
public override void RunOnUpdate()

View File

@ -0,0 +1,12 @@
using System;
using Intrepid.TagSystem;
using UnityEngine;
namespace Intrepid.Gameplay.Entities.Player.Tags
{
[Serializable]
[CreateAssetMenu(fileName = "New Action Belt Manager Tag", menuName = "GON/Tags/Action Belt Manager Tag")]
public class ActionBeltManagerTag : Tag
{
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 4910d586b6414626b9ec5c228904bf46
timeCreated: 1780993733

View File

@ -1,5 +1,6 @@
using System;
using Intrepid.Core.Tags;
using Intrepid.Utilities;
using UnityEngine;
namespace Intrepid.Gameplay.Entities.Player.Tags
@ -8,5 +9,8 @@ namespace Intrepid.Gameplay.Entities.Player.Tags
[CreateAssetMenu(fileName = "New Player Tag", menuName = "GON/Tags/Player Tag")]
public class PlayerTag : EntityTag
{
[GroupConfigurations, SerializeField] private ActionBeltManagerTag actionBeltManager;
public ActionBeltManagerTag ActionBeltManger => actionBeltManager;
}
}

View File

@ -2,14 +2,18 @@ using Intrepid.Diagnostics;
using Intrepid.GameManagers;
using Intrepid.Gameplay.Entities.Player.ActionBelt.Events;
using Intrepid.Gameplay.Entities.Player.Events;
using Intrepid.Gameplay.Entities.Player.Tags;
using Intrepid.Gameplay.Journey.Runtime.Messages;
using Intrepid.Integration.Input;
using Intrepid.Utilities;
using UnityEngine;
namespace Intrepid.Gameplay.Journey.Runtime.Gameplay
{
public sealed class JourneyGameplayGate : MonoBehaviour
{
[GroupInjections, SerializeField] private ActionBeltManagerTag actionBeltManagerTag;
public JourneyGameplayGateState State { get; private set; } = JourneyGameplayGateState.Open;
public bool IsLocked => State == JourneyGameplayGateState.Locked;
@ -26,7 +30,10 @@ namespace Intrepid.Gameplay.Journey.Runtime.Gameplay
InputService.Instance.ChangeInputSchema(InputSchema.None);
Proxy.Instance.EventBus.Raise(new ActionBeltDisableEvent());
Proxy.Instance.EventBus.Raise(new ActionBeltDisableEvent
{
ActionBeltManger = actionBeltManagerTag,
});
Proxy.Instance.EventBus.Raise(new PlayerCommandRevokedEvent());
@ -59,7 +66,11 @@ namespace Intrepid.Gameplay.Journey.Runtime.Gameplay
RestoreInput(schemaToRestore);
}
Proxy.Instance.EventBus.Raise(new ActionBeltEnableEvent());
Proxy.Instance.EventBus.Raise(new ActionBeltEnableEvent
{
ActionBeltManger = actionBeltManagerTag,
});
Proxy.Instance.EventBus.Raise(new PlayerCommandGrantedEvent());
State = JourneyGameplayGateState.Open;
@ -71,7 +82,11 @@ namespace Intrepid.Gameplay.Journey.Runtime.Gameplay
{
InputService.Instance.ChangeInputSchema(InputSchema.Sentinel);
Proxy.Instance.EventBus.Raise(new ActionBeltEnableEvent());
Proxy.Instance.EventBus.Raise(new ActionBeltEnableEvent
{
ActionBeltManger = actionBeltManagerTag,
});
Proxy.Instance.EventBus.Raise(new PlayerCommandGrantedEvent());
State = JourneyGameplayGateState.Open;

View File

@ -1,6 +1,5 @@
using Intrepid.GameManagers;
using Intrepid.Gameplay.Entities.Player.ActionBelt;
using Intrepid.Gameplay.Entities.Player.ActionBelt.Events;
using Intrepid.Gameplay.Entities.Player.Sentinel.Events;
using Intrepid.Localization;
using Intrepid.Utilities;
@ -24,7 +23,6 @@ namespace Intrepid.Gameplay.Prototyping.SaveStations
StageTag = saveStationModelPrototype.StageTag,
DeploymentPoint = saveStationModelPrototype.DeploymentPoint
});
Proxy.Instance.EventBus.Raise(new ActionBeltHideEvent());
}
}
}

View File

@ -5,7 +5,7 @@
"depth": 0,
"source": "git",
"dependencies": {},
"hash": "6f1ee5036dced65524bd7cc8af9f244d52f15491"
"hash": "8b705cd47233eb0aaa29b302894b4cf1e256b919"
},
"com.unity.2d.animation": {
"version": "13.0.5",