first attempt of cadence
This commit is contained in:
parent
c6d028d11a
commit
56baa88bad
1665
Assets/Prefabs/UI/ActionBelt.prefab
Normal file
1665
Assets/Prefabs/UI/ActionBelt.prefab
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/Prefabs/UI/ActionBelt.prefab.meta
Normal file
7
Assets/Prefabs/UI/ActionBelt.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 8ec48b099c8274b8db9460675cf5a6b6
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
BIN
Assets/Resources/Graphics/UI/cadence-progression-bar.png
(Stored with Git LFS)
Normal file
BIN
Assets/Resources/Graphics/UI/cadence-progression-bar.png
(Stored with Git LFS)
Normal file
Binary file not shown.
130
Assets/Resources/Graphics/UI/cadence-progression-bar.png.meta
Normal file
130
Assets/Resources/Graphics/UI/cadence-progression-bar.png.meta
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ebee64db07310481b99e4700a70c9bd5
|
||||||
|
TextureImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 13
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 0
|
||||||
|
sRGBTexture: 1
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
flipGreenChannel: 0
|
||||||
|
isReadable: 0
|
||||||
|
streamingMipmaps: 0
|
||||||
|
streamingMipmapsPriority: 0
|
||||||
|
vTOnly: 0
|
||||||
|
ignoreMipmapLimit: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: 1
|
||||||
|
aniso: 1
|
||||||
|
mipBias: 0
|
||||||
|
wrapU: 1
|
||||||
|
wrapV: 1
|
||||||
|
wrapW: 0
|
||||||
|
nPOTScale: 0
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 1
|
||||||
|
spriteExtrude: 0
|
||||||
|
spriteMeshType: 0
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spritePixelsToUnits: 512
|
||||||
|
spriteBorder: {x: 15, y: 8, z: 15, w: 8}
|
||||||
|
spriteGenerateFallbackPhysicsShape: 0
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 8
|
||||||
|
textureShape: 1
|
||||||
|
singleChannelComponent: 0
|
||||||
|
flipbookRows: 1
|
||||||
|
flipbookColumns: 1
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
ignorePngGamma: 0
|
||||||
|
applyGammaDecoding: 0
|
||||||
|
swizzle: 50462976
|
||||||
|
cookieLightType: 0
|
||||||
|
platformSettings:
|
||||||
|
- serializedVersion: 4
|
||||||
|
buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 64
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
ignorePlatformSupport: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 4
|
||||||
|
buildTarget: Standalone
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
ignorePlatformSupport: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 4
|
||||||
|
buildTarget: WebGL
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
ignorePlatformSupport: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
customData:
|
||||||
|
physicsShape: []
|
||||||
|
bones: []
|
||||||
|
spriteID: 5e97eb03825dee720800000000000000
|
||||||
|
internalID: 1537655665
|
||||||
|
vertices: []
|
||||||
|
indices:
|
||||||
|
edges: []
|
||||||
|
weights: []
|
||||||
|
secondaryTextures: []
|
||||||
|
spriteCustomMetadata:
|
||||||
|
entries: []
|
||||||
|
nameFileIdTable: {}
|
||||||
|
mipmapLimitGroupName:
|
||||||
|
pSDRemoveMatte: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
8
Assets/Resources/Services/Player.meta
Normal file
8
Assets/Resources/Services/Player.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 2af584a3dd3454631b72b1d8cc56c6ad
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
8
Assets/Resources/Services/Player/Sentinel.meta
Normal file
8
Assets/Resources/Services/Player/Sentinel.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 67cd93e0137714ac3a5bc84202bb626c
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -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: fa112b7f5234409ab703371948b584d5, type: 3}
|
||||||
|
m_Name: Cadence Service
|
||||||
|
m_EditorClassIdentifier: Assembly-CSharp::Intrepid.Gameplay.Entities.Player.Sentinel.Cadence.CadenceService
|
||||||
|
currentCadence: 1.002372
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 84f36528c13ab48d6ae2ae41878f2f9f
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -14,3 +14,4 @@ MonoBehaviour:
|
|||||||
m_EditorClassIdentifier: Intrepid General Utilities::Intrepid.Utilities.SingletonScriptableObjectManifest
|
m_EditorClassIdentifier: Intrepid General Utilities::Intrepid.Utilities.SingletonScriptableObjectManifest
|
||||||
singletons:
|
singletons:
|
||||||
- {fileID: 11400000, guid: 9ea72f9e3cacb4fc495eff7431ec5551, type: 2}
|
- {fileID: 11400000, guid: 9ea72f9e3cacb4fc495eff7431ec5551, type: 2}
|
||||||
|
- {fileID: 11400000, guid: 84f36528c13ab48d6ae2ae41878f2f9f, type: 2}
|
||||||
|
|||||||
@ -12,7 +12,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: 6f2337b04d5e44dba892ac6b72ae7e44, type: 3}
|
m_Script: {fileID: 11500000, guid: 6f2337b04d5e44dba892ac6b72ae7e44, type: 3}
|
||||||
m_Name: action-belt.window.enter
|
m_Name: action-belt.window.enter
|
||||||
m_EditorClassIdentifier: Intrepid General Utilities::Intrepid.Window.Data.WindowAnimationData
|
m_EditorClassIdentifier: Intrepid General Utilities::Intrepid.Window.Data.WindowAnimationData
|
||||||
mode: 3
|
mode: 1
|
||||||
direction: 0
|
direction: 0
|
||||||
soundEffect: {fileID: 0}
|
soundEffect: {fileID: 0}
|
||||||
animationSpeed: 5
|
animationSpeed: 5
|
||||||
|
|||||||
@ -12,7 +12,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: 6f2337b04d5e44dba892ac6b72ae7e44, type: 3}
|
m_Script: {fileID: 11500000, guid: 6f2337b04d5e44dba892ac6b72ae7e44, type: 3}
|
||||||
m_Name: action-belt.window.exit
|
m_Name: action-belt.window.exit
|
||||||
m_EditorClassIdentifier: Intrepid General Utilities::Intrepid.Window.Data.WindowAnimationData
|
m_EditorClassIdentifier: Intrepid General Utilities::Intrepid.Window.Data.WindowAnimationData
|
||||||
mode: 3
|
mode: 1
|
||||||
direction: 1
|
direction: 1
|
||||||
soundEffect: {fileID: 0}
|
soundEffect: {fileID: 0}
|
||||||
animationSpeed: 5
|
animationSpeed: 5
|
||||||
|
|||||||
@ -0,0 +1,18 @@
|
|||||||
|
%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: 671522e89c004981804e95c2e4772ba4, type: 3}
|
||||||
|
m_Name: world-overlay.window.data
|
||||||
|
m_EditorClassIdentifier: Intrepid General Utilities::Intrepid.Window.Data.WindowData
|
||||||
|
id: d9f8d3559eb2489cb94739ed883d3360
|
||||||
|
shouldBeKeptAlwaysEnabled: 0
|
||||||
|
onEntry: {fileID: 11400000, guid: 82f061381bd6041e89c7a94e57153999, type: 2}
|
||||||
|
onExit: {fileID: 11400000, guid: 645c3f5b37b664fe2be06cdff30c678a, type: 2}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 99cca803f95d0436295491a3b06560b3
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
%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: world-overlay.window.enter
|
||||||
|
m_EditorClassIdentifier: Intrepid General Utilities::Intrepid.Window.Data.WindowAnimationData
|
||||||
|
mode: 1
|
||||||
|
direction: 0
|
||||||
|
soundEffect: {fileID: 0}
|
||||||
|
animationSpeed: 5
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 82f061381bd6041e89c7a94e57153999
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
%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: world-overlay.window.exit
|
||||||
|
m_EditorClassIdentifier: Intrepid General Utilities::Intrepid.Window.Data.WindowAnimationData
|
||||||
|
mode: 1
|
||||||
|
direction: 1
|
||||||
|
soundEffect: {fileID: 0}
|
||||||
|
animationSpeed: 5
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 645c3f5b37b664fe2be06cdff30c678a
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Intrepid.Core.Tags;
|
using Intrepid.Core.Tags;
|
||||||
using Intrepid.Core.Updatable;
|
|
||||||
using Intrepid.TagSystem;
|
using Intrepid.TagSystem;
|
||||||
using Intrepid.Utilities;
|
using Intrepid.Utilities;
|
||||||
using Intrepid.Utilities.Updatable;
|
using Intrepid.Utilities.Updatable;
|
||||||
@ -20,12 +19,12 @@ namespace Intrepid.Core.Entities
|
|||||||
|
|
||||||
protected void OnEnable()
|
protected void OnEnable()
|
||||||
{
|
{
|
||||||
UpdateManager.Instance.Add(this);
|
UpdatableCollection.Instance.Add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void OnDisable()
|
protected void OnDisable()
|
||||||
{
|
{
|
||||||
UpdateManager.Instance?.Remove(Id);
|
UpdatableCollection.Instance?.Remove(Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using Intrepid.Core.Updatable;
|
|
||||||
using Intrepid.SimpleEvents;
|
using Intrepid.SimpleEvents;
|
||||||
using Intrepid.Utilities;
|
using Intrepid.Utilities;
|
||||||
|
using Intrepid.Utilities.Updatable;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Intrepid.Core.Entities
|
namespace Intrepid.Core.Entities
|
||||||
|
|||||||
29
Assets/Scripts/Intrepid/Core/UI/WorldOverlayMarker.cs
Normal file
29
Assets/Scripts/Intrepid/Core/UI/WorldOverlayMarker.cs
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
using System;
|
||||||
|
using Intrepid.Core.Camera;
|
||||||
|
using Intrepid.Utilities;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Intrepid.Core.UI
|
||||||
|
{
|
||||||
|
[DefaultExecutionOrder(GonConstants.ExecutionOrder.ALAP)]
|
||||||
|
public class WorldOverlayMarker : MonoBehaviour
|
||||||
|
{
|
||||||
|
[GroupConfigurations, SerializeField] private Vector3 screenOffset = Vector3.zero;
|
||||||
|
[GroupInjections, SerializeField] private Transform target;
|
||||||
|
[GroupInjections, SerializeField] private RectTransform rectTransform;
|
||||||
|
|
||||||
|
private void LateUpdate()
|
||||||
|
{
|
||||||
|
if (CameraSystem.Instance.IsNull() || target.IsNull())
|
||||||
|
{
|
||||||
|
gameObject.SetActive(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var cam = CameraSystem.Instance.MainCamera;
|
||||||
|
var screenPosition = cam.WorldToScreenPoint(target.position) + screenOffset;
|
||||||
|
|
||||||
|
rectTransform.position = screenPosition;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6e0a32fb74ee4fd6bae8052f4351cfa3
|
||||||
|
timeCreated: 1781065165
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 3ff4666bbadb4a51b1a7ab69009dd55d
|
||||||
|
timeCreated: 1781074996
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
using System;
|
||||||
|
using Sirenix.OdinInspector;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Intrepid.Gameplay.Entities.Player.Sentinel.Cadence
|
||||||
|
{
|
||||||
|
[Serializable]
|
||||||
|
public class CadenceContext
|
||||||
|
{
|
||||||
|
[SerializeField, Range(0, 5000)] private float warmTimeMS;
|
||||||
|
[SerializeField, Range(0, 5000)] private float activationTimeMS;
|
||||||
|
[MinMaxSlider("warmTimeMS", "TotalTimeMS", true), SerializeField] private Vector2 optimalWindowMS;
|
||||||
|
|
||||||
|
public float OptimalMinTimeMS => optimalWindowMS.x;
|
||||||
|
public float OptimalMaxTimeMS => optimalWindowMS.y;
|
||||||
|
public float TotalTimeMS => warmTimeMS + activationTimeMS;
|
||||||
|
|
||||||
|
public float OptimalMinTime => OptimalMinTimeMS * 0.001f;
|
||||||
|
public float OptimalMaxTime => OptimalMaxTimeMS * 0.001f;
|
||||||
|
public float WarmTime => warmTimeMS * 0.001f;
|
||||||
|
public float ActivationTime => activationTimeMS * 0.001f;
|
||||||
|
public float TotalTime => (warmTimeMS + activationTimeMS) * 0.001f;
|
||||||
|
public float OptimalTime => (OptimalMinTime + OptimalMaxTime) * 0.5f;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: df1d7ef780ec4251bc0c7101c986eeca
|
||||||
|
timeCreated: 1781075513
|
||||||
@ -0,0 +1,61 @@
|
|||||||
|
using System;
|
||||||
|
using Intrepid.Utilities;
|
||||||
|
using Sirenix.OdinInspector;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Intrepid.Gameplay.Entities.Player.Sentinel.Cadence
|
||||||
|
{
|
||||||
|
[Serializable]
|
||||||
|
[CreateAssetMenu(fileName = "Cadence Service", menuName = "GON/Services/Cadence Service")]
|
||||||
|
public class CadenceService : SingletonScriptableObject<CadenceService>
|
||||||
|
{
|
||||||
|
[GroupDebug, SerializeField, ReadOnly] private float currentCadence;
|
||||||
|
|
||||||
|
private Timer CadenceTimer { get; set; } = new();
|
||||||
|
|
||||||
|
public float CurrentCadence
|
||||||
|
{
|
||||||
|
get => currentCadence;
|
||||||
|
private set => currentCadence = value;
|
||||||
|
}
|
||||||
|
public float CadenceElapsedTime => (float)CadenceTimer.ElapsedTime;
|
||||||
|
public bool IsCadenceRunning => CadenceTotalTime > 0f && CadenceTimer.IsRunning;
|
||||||
|
|
||||||
|
private float CadenceTotalTime => CadenceContext is null ? 0f : 0.001f * CadenceContext.TotalTimeMS;
|
||||||
|
private CadenceContext CadenceContext { get; set; }
|
||||||
|
public float WarmCadencePercent => CadenceContext?.WarmTime / CadenceTotalTime ?? 0f;
|
||||||
|
public float OptimalCadenceMinPercent => CadenceContext?.OptimalMinTime / CadenceTotalTime ?? 0f;
|
||||||
|
public float OptimalCadenceMaxPercent => CadenceContext?.OptimalMaxTime / CadenceTotalTime ?? 0f;
|
||||||
|
|
||||||
|
protected override void WhenInstantiate(CadenceService s)
|
||||||
|
{
|
||||||
|
base.WhenInstantiate(s);
|
||||||
|
StopCadence();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StartCadence(CadenceContext ctx)
|
||||||
|
{
|
||||||
|
if (ctx is null || ctx.TotalTimeMS <= 0f) return;
|
||||||
|
CadenceTimer.Start();
|
||||||
|
CadenceContext = ctx;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StopCadence()
|
||||||
|
{
|
||||||
|
CadenceTimer.Stop();
|
||||||
|
CadenceContext = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateCadence()
|
||||||
|
{
|
||||||
|
if (CadenceTimer.IsNotRunning) return;
|
||||||
|
CadenceTimer.Update(Timer.ScaledTime);
|
||||||
|
var totalTime = CadenceTotalTime;
|
||||||
|
CurrentCadence = CadenceElapsedTime / totalTime;
|
||||||
|
if (CadenceTimer.Check(totalTime))
|
||||||
|
{
|
||||||
|
StopCadence();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: fa112b7f5234409ab703371948b584d5
|
||||||
|
timeCreated: 1781075005
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 2739ebcbe4b044cd84ab5375f427a787
|
||||||
|
timeCreated: 1781078260
|
||||||
@ -0,0 +1,89 @@
|
|||||||
|
using Intrepid.Utilities;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
namespace Intrepid.Gameplay.Entities.Player.Sentinel.Cadence.UI
|
||||||
|
{
|
||||||
|
public class UICadence : MonoBehaviour
|
||||||
|
{
|
||||||
|
[GroupInjections, SerializeField] private Slider slider;
|
||||||
|
[GroupInjections, SerializeField] private RectTransform warmLimit;
|
||||||
|
[GroupInjections, SerializeField] private RectTransform optimal;
|
||||||
|
|
||||||
|
private bool IsActive { get; set; }
|
||||||
|
|
||||||
|
private void Update()
|
||||||
|
{
|
||||||
|
if (CadenceService.Instance.IsCadenceRunning)
|
||||||
|
{
|
||||||
|
if (!IsActive)
|
||||||
|
{
|
||||||
|
IsActive = true;
|
||||||
|
|
||||||
|
slider.gameObject.SetActive(true);
|
||||||
|
warmLimit.gameObject.SetActive(true);
|
||||||
|
optimal.gameObject.SetActive(true);
|
||||||
|
|
||||||
|
SetHorizontalRange(
|
||||||
|
optimal,
|
||||||
|
CadenceService.Instance.OptimalCadenceMinPercent,
|
||||||
|
CadenceService.Instance.OptimalCadenceMaxPercent
|
||||||
|
);
|
||||||
|
|
||||||
|
SetVerticalLine(
|
||||||
|
warmLimit,
|
||||||
|
CadenceService.Instance.WarmCadencePercent
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
slider.value = CadenceService.Instance.CurrentCadence;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
IsActive = false;
|
||||||
|
|
||||||
|
slider.value = 0f;
|
||||||
|
slider.gameObject.SetActive(false);
|
||||||
|
warmLimit.gameObject.SetActive(false);
|
||||||
|
optimal.gameObject.SetActive(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void SetHorizontalRange(
|
||||||
|
RectTransform rect,
|
||||||
|
float minPercent,
|
||||||
|
float maxPercent,
|
||||||
|
float height = 10f
|
||||||
|
)
|
||||||
|
{
|
||||||
|
minPercent = Mathf.Clamp01(minPercent);
|
||||||
|
maxPercent = Mathf.Clamp01(maxPercent);
|
||||||
|
|
||||||
|
if (maxPercent < minPercent)
|
||||||
|
{
|
||||||
|
(minPercent, maxPercent) = (maxPercent, minPercent);
|
||||||
|
}
|
||||||
|
|
||||||
|
rect.anchorMin = new Vector2(minPercent, 0.5f);
|
||||||
|
rect.anchorMax = new Vector2(maxPercent, 0.5f);
|
||||||
|
rect.pivot = new Vector2(0.5f, 0.5f);
|
||||||
|
|
||||||
|
rect.offsetMin = new Vector2(0f, -height * 0.5f);
|
||||||
|
rect.offsetMax = new Vector2(0f, height * 0.5f);
|
||||||
|
|
||||||
|
rect.anchoredPosition = Vector2.zero;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void SetVerticalLine(RectTransform rect, float percent)
|
||||||
|
{
|
||||||
|
percent = Mathf.Clamp01(percent);
|
||||||
|
|
||||||
|
rect.anchorMin = new Vector2(percent, 0f);
|
||||||
|
rect.anchorMax = new Vector2(percent, 1f);
|
||||||
|
|
||||||
|
rect.anchoredPosition = Vector2.zero;
|
||||||
|
|
||||||
|
rect.offsetMin = new Vector2(rect.offsetMin.x, 0f);
|
||||||
|
rect.offsetMax = new Vector2(rect.offsetMax.x, 0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9d1662ebbd194ad3b15996cc3853512d
|
||||||
|
timeCreated: 1781078267
|
||||||
@ -2,6 +2,7 @@ using System;
|
|||||||
using Intrepid.Core.Entities;
|
using Intrepid.Core.Entities;
|
||||||
using Intrepid.Core.Entities.Messages;
|
using Intrepid.Core.Entities.Messages;
|
||||||
using Intrepid.Gameplay.Entities.Player.ActionBelt;
|
using Intrepid.Gameplay.Entities.Player.ActionBelt;
|
||||||
|
using Intrepid.Gameplay.Entities.Player.Sentinel.Cadence;
|
||||||
using Intrepid.Gameplay.Entities.Player.Sentinel.StateMachine;
|
using Intrepid.Gameplay.Entities.Player.Sentinel.StateMachine;
|
||||||
using Intrepid.Integration.Input;
|
using Intrepid.Integration.Input;
|
||||||
using Intrepid.Structures;
|
using Intrepid.Structures;
|
||||||
@ -55,6 +56,8 @@ namespace Intrepid.Gameplay.Entities.Player.Sentinel
|
|||||||
|
|
||||||
public override void UpdateFromUpdatable()
|
public override void UpdateFromUpdatable()
|
||||||
{
|
{
|
||||||
|
CadenceService.Instance.UpdateCadence();
|
||||||
|
|
||||||
StateMachine.CurrentImplementation.RunBeforeUpdate();
|
StateMachine.CurrentImplementation.RunBeforeUpdate();
|
||||||
StateMachine.CurrentImplementation.RunOnUpdate();
|
StateMachine.CurrentImplementation.RunOnUpdate();
|
||||||
StateMachine.CurrentImplementation.RunAfterUpdate();
|
StateMachine.CurrentImplementation.RunAfterUpdate();
|
||||||
|
|||||||
@ -1,13 +1,19 @@
|
|||||||
|
using Intrepid.Gameplay.Entities.Player.Sentinel.Cadence;
|
||||||
using Intrepid.Utilities;
|
using Intrepid.Utilities;
|
||||||
|
using Sirenix.OdinInspector;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Intrepid.Gameplay.Entities.Player.Sentinel
|
namespace Intrepid.Gameplay.Entities.Player.Sentinel
|
||||||
{
|
{
|
||||||
public class SentinelControls : MonoBehaviour
|
public class SentinelControls : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
[GroupConfigurations("Dash Context"), SerializeField, HideLabel] private CadenceContext dashContext;
|
||||||
|
|
||||||
[GroupConfigurations, SerializeField, Range(0, 3)] private int dashBreakingThreshold = 2;
|
[GroupConfigurations, SerializeField, Range(0, 3)] private int dashBreakingThreshold = 2;
|
||||||
[GroupDebug, SerializeField] private int dashCounter;
|
[GroupDebug, SerializeField] private int dashCounter;
|
||||||
|
|
||||||
|
public CadenceContext DashContext => dashContext;
|
||||||
|
|
||||||
public int DashCounter => dashCounter;
|
public int DashCounter => dashCounter;
|
||||||
public bool IsDashing => dashCounter > 0;
|
public bool IsDashing => dashCounter > 0;
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
using Intrepid.Gameplay.Entities.Player.Sentinel.Cadence;
|
||||||
using Intrepid.Gameplay.Messages.Events;
|
using Intrepid.Gameplay.Messages.Events;
|
||||||
using Intrepid.Structures;
|
using Intrepid.Structures;
|
||||||
using Intrepid.Utilities;
|
using Intrepid.Utilities;
|
||||||
@ -9,9 +10,9 @@ namespace Intrepid.Gameplay.Entities.Player.Sentinel.StateMachine.States
|
|||||||
{
|
{
|
||||||
[GroupConfigurations, SerializeField] private AnimationClip dash;
|
[GroupConfigurations, SerializeField] private AnimationClip dash;
|
||||||
[GroupConfigurations, SerializeField, Range(0, 100)] private float speed = 35;
|
[GroupConfigurations, SerializeField, Range(0, 100)] private float speed = 35;
|
||||||
[GroupConfigurations, SerializeField, Range(0, 500)] private float targetTimeMS = 100f;
|
// [GroupConfigurations, SerializeField, Range(0, 500)] private float targetTimeMS = 100f;
|
||||||
|
|
||||||
public float TargetTime => targetTimeMS * 0.001f;
|
public float TargetTime => Brain.Controls.DashContext.WarmTime;
|
||||||
|
|
||||||
private Timer Timer { get; } = new();
|
private Timer Timer { get; } = new();
|
||||||
|
|
||||||
@ -35,6 +36,7 @@ namespace Intrepid.Gameplay.Entities.Player.Sentinel.StateMachine.States
|
|||||||
Brain.Entity.RefreshMovementNormal();
|
Brain.Entity.RefreshMovementNormal();
|
||||||
Brain.Entity.ModelAnimation.CrossFade(dash, 0.01f);
|
Brain.Entity.ModelAnimation.CrossFade(dash, 0.01f);
|
||||||
Timer.Start();
|
Timer.Start();
|
||||||
|
CadenceService.Instance.StartCadence(Brain.Controls.DashContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void RunOnExit()
|
protected override void RunOnExit()
|
||||||
|
|||||||
@ -8,11 +8,11 @@ namespace Intrepid.Gameplay.Entities.Player.Sentinel.StateMachine.States
|
|||||||
{
|
{
|
||||||
[GroupConfigurations, SerializeField] private AnimationClip dashWindow;
|
[GroupConfigurations, SerializeField] private AnimationClip dashWindow;
|
||||||
[GroupConfigurations, SerializeField, Range(0, 30)] private float speed = 10;
|
[GroupConfigurations, SerializeField, Range(0, 30)] private float speed = 10;
|
||||||
[GroupConfigurations, SerializeField, Range(0, 500)] private float targetTimeMS = 150f;
|
|
||||||
[GroupConfigurations, SerializeField, Range(15, 90)] private float dashMaxAngleFromForward = 60f;
|
[GroupConfigurations, SerializeField, Range(15, 90)] private float dashMaxAngleFromForward = 60f;
|
||||||
|
// [GroupConfigurations, SerializeField, Range(0, 500)] private float targetTimeMS = 150f;
|
||||||
|
|
||||||
private Timer Timer { get; } = new();
|
private Timer Timer { get; } = new();
|
||||||
private float TargetTime => targetTimeMS * 0.001f;
|
private float TargetTime => Brain.Controls.DashContext.ActivationTime;
|
||||||
|
|
||||||
public override SentinelStateType GetStateKey()
|
public override SentinelStateType GetStateKey()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -7,7 +7,8 @@ namespace Intrepid.Utilities
|
|||||||
|
|
||||||
public static class ExecutionOrder
|
public static class ExecutionOrder
|
||||||
{
|
{
|
||||||
public const int ASAP = -10000;
|
public const int ALAP = 10000; // As Last As Possible
|
||||||
|
public const int ASAP = -ALAP; // As Soon As Possible
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Prototyping
|
public static class Prototyping
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
namespace Intrepid.Core.Updatable
|
namespace Intrepid.Utilities.Updatable
|
||||||
{
|
{
|
||||||
public interface IUpdatable
|
public interface IUpdatable
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,17 +1,13 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Intrepid.Core;
|
|
||||||
using Intrepid.Core.Updatable;
|
|
||||||
using Sirenix.OdinInspector;
|
using Sirenix.OdinInspector;
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace Intrepid.Utilities.Updatable
|
namespace Intrepid.Utilities.Updatable
|
||||||
{
|
{
|
||||||
[DefaultExecutionOrder(GonConstants.ExecutionOrder.ASAP)]
|
public class UpdatableCollection : SingletonMonoBehaviour<UpdatableCollection>
|
||||||
public class UpdateManager : SingletonMonoBehaviour<UpdateManager>
|
|
||||||
{
|
{
|
||||||
private Dictionary<string, IUpdatable> UpdatableMap { get; } = new();
|
private Dictionary<string, IUpdatable> UpdatableMap { get; } = new();
|
||||||
private List<IUpdatable> OrderedUpdatableList { get; } = new();
|
public List<IUpdatable> OrderedUpdatableList { get; } = new();
|
||||||
private List<string> AddedIds { get; } = new();
|
private List<string> AddedIds { get; } = new();
|
||||||
private List<string> RemovedIds { get; } = new();
|
private List<string> RemovedIds { get; } = new();
|
||||||
[GroupDebug, ShowInInspector, ReadOnly] private IReadOnlyList<string> UpdatableIds => UpdatableMap.Keys.ToList();
|
[GroupDebug, ShowInInspector, ReadOnly] private IReadOnlyList<string> UpdatableIds => UpdatableMap.Keys.ToList();
|
||||||
@ -38,34 +34,8 @@ namespace Intrepid.Utilities.Updatable
|
|||||||
UpdatableMap.Remove(id);
|
UpdatableMap.Remove(id);
|
||||||
RemovedIds.Add(id);
|
RemovedIds.Add(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FixedUpdate()
|
|
||||||
{
|
|
||||||
foreach (var updatable in OrderedUpdatableList)
|
|
||||||
{
|
|
||||||
updatable.FixedUpdateFromUpdatable();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Update()
|
public void ListOrderManagement()
|
||||||
{
|
|
||||||
foreach (var updatable in OrderedUpdatableList)
|
|
||||||
{
|
|
||||||
updatable.UpdateFromUpdatable();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LateUpdate()
|
|
||||||
{
|
|
||||||
foreach (var updatable in OrderedUpdatableList)
|
|
||||||
{
|
|
||||||
updatable.LateUpdateFromUpdatable();
|
|
||||||
}
|
|
||||||
|
|
||||||
ListOrderManagement();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ListOrderManagement()
|
|
||||||
{
|
{
|
||||||
var hasAddedIds = AddedIds.Count > 0;
|
var hasAddedIds = AddedIds.Count > 0;
|
||||||
if (hasAddedIds)
|
if (hasAddedIds)
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Intrepid.Utilities.Updatable
|
||||||
|
{
|
||||||
|
[DefaultExecutionOrder(GonConstants.ExecutionOrder.ASAP)]
|
||||||
|
public class UpdatableManager : MonoBehaviour
|
||||||
|
{
|
||||||
|
private void FixedUpdate()
|
||||||
|
{
|
||||||
|
foreach (var updatable in UpdatableCollection.Instance.OrderedUpdatableList)
|
||||||
|
{
|
||||||
|
updatable.FixedUpdateFromUpdatable();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Update()
|
||||||
|
{
|
||||||
|
foreach (var updatable in UpdatableCollection.Instance.OrderedUpdatableList)
|
||||||
|
{
|
||||||
|
updatable.UpdateFromUpdatable();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 4d8df220d814407da92013092964e6fd
|
||||||
|
timeCreated: 1781069681
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Intrepid.Utilities.Updatable
|
||||||
|
{
|
||||||
|
[DefaultExecutionOrder(GonConstants.ExecutionOrder.ALAP)]
|
||||||
|
public class UpdatableManagerLate : MonoBehaviour
|
||||||
|
{
|
||||||
|
private void LateUpdate()
|
||||||
|
{
|
||||||
|
foreach (var updatable in UpdatableCollection.Instance.OrderedUpdatableList)
|
||||||
|
{
|
||||||
|
updatable.LateUpdateFromUpdatable();
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdatableCollection.Instance.ListOrderManagement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1e772df7472b4b0f8fd55061783b8b4d
|
||||||
|
timeCreated: 1781069779
|
||||||
Loading…
x
Reference in New Issue
Block a user