improvements on Journey
This commit is contained in:
parent
a2e287b3c6
commit
1926420695
File diff suppressed because it is too large
Load Diff
202
Assets/# Prototype/Test01/Stages/Stage-2.stage-definition.asset
Normal file
202
Assets/# Prototype/Test01/Stages/Stage-2.stage-definition.asset
Normal file
@ -0,0 +1,202 @@
|
||||
%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: 778f9d79eb2c410482efdc25b248dd46, type: 3}
|
||||
m_Name: Stage-2.stage-definition
|
||||
m_EditorClassIdentifier: Assembly-CSharp-Editor::Editor.GON.StageEditor.StageDefinition
|
||||
id: stage-2.stage-definition
|
||||
cellSize: 1
|
||||
floorHeight: 6
|
||||
activeFloorIndex: 0
|
||||
stageTag: {fileID: 11400000, guid: ed5f85b3145ce4eabae9b1382f675817, type: 2}
|
||||
worldSync:
|
||||
worldLayoutId: 4dac43bfd76a4286a40511c1cce4609b
|
||||
worldStageId: stage_bd361c8ccbe4421cab5ad85cd71d081a
|
||||
worldStageDisplayName: Stage 2
|
||||
worldStageKind: 0
|
||||
worldLayer: 0
|
||||
worldTileSize: 24
|
||||
worldLayerHeight: 24
|
||||
worldTiles:
|
||||
- x: 2
|
||||
y: 0
|
||||
- x: 3
|
||||
y: 0
|
||||
- x: 2
|
||||
y: 1
|
||||
- x: 3
|
||||
y: 1
|
||||
expectedEndpoints:
|
||||
- endpointId: endpoint_bb859113836e4b89860e97fb2589a4be
|
||||
kind: 0
|
||||
worldTile:
|
||||
x: 2
|
||||
y: 1
|
||||
socketFace: 3
|
||||
required: 1
|
||||
connectionId: connection_1099167b7150449491c4cf0d1b4e9b0a
|
||||
connectedEndpointId: endpoint_d6f5daa321f14376a237ac78ecdeb172
|
||||
debugLabel: Socket endpoint_bb859113836e4b89860e97fb2589a4be
|
||||
syncedAt: 2026-06-22T11:40:59.1742480Z
|
||||
contractVersion: 1
|
||||
contractHash: 8794a04598a6a1b48d285f5021f6d3c871ebe8bb2f5819ce65ccdf9cd8f0fae4
|
||||
floors:
|
||||
- floorId: F0
|
||||
FloorHeight: 0
|
||||
cells:
|
||||
- x: 1
|
||||
y: 0
|
||||
structural: 10
|
||||
- x: -5
|
||||
y: 3
|
||||
structural: 10
|
||||
- x: -5
|
||||
y: 1
|
||||
structural: 10
|
||||
- x: -3
|
||||
y: 2
|
||||
structural: 10
|
||||
- x: 1
|
||||
y: 1
|
||||
structural: 10
|
||||
- x: -4
|
||||
y: 5
|
||||
structural: 10
|
||||
- x: -2
|
||||
y: 5
|
||||
structural: 10
|
||||
- x: -2
|
||||
y: -2
|
||||
structural: 10
|
||||
- x: -2
|
||||
y: 2
|
||||
structural: 10
|
||||
- x: 46
|
||||
y: 24
|
||||
structural: 10
|
||||
- x: -1
|
||||
y: -2
|
||||
structural: 10
|
||||
- x: 0
|
||||
y: -2
|
||||
structural: 10
|
||||
- x: 1
|
||||
y: -2
|
||||
structural: 10
|
||||
- x: -2
|
||||
y: -1
|
||||
structural: 10
|
||||
- x: -5
|
||||
y: 5
|
||||
structural: 10
|
||||
- x: -3
|
||||
y: 3
|
||||
structural: 10
|
||||
- x: -3
|
||||
y: 0
|
||||
structural: 10
|
||||
- x: -1
|
||||
y: -1
|
||||
structural: 10
|
||||
- x: 0
|
||||
y: -1
|
||||
structural: 10
|
||||
- x: -1
|
||||
y: 5
|
||||
structural: 10
|
||||
- x: -3
|
||||
y: 1
|
||||
structural: 10
|
||||
- x: -2
|
||||
y: 3
|
||||
structural: 10
|
||||
- x: -4
|
||||
y: 0
|
||||
structural: 10
|
||||
- x: -5
|
||||
y: 2
|
||||
structural: 10
|
||||
- x: -4
|
||||
y: 2
|
||||
structural: 10
|
||||
- x: -3
|
||||
y: 5
|
||||
structural: 10
|
||||
- x: -1
|
||||
y: 1
|
||||
structural: 10
|
||||
- x: -2
|
||||
y: 1
|
||||
structural: 10
|
||||
- x: -5
|
||||
y: 4
|
||||
structural: 10
|
||||
- x: -4
|
||||
y: 4
|
||||
structural: 10
|
||||
- x: -3
|
||||
y: 4
|
||||
structural: 10
|
||||
- x: -2
|
||||
y: 4
|
||||
structural: 10
|
||||
- x: 0
|
||||
y: 0
|
||||
structural: 10
|
||||
- x: 1
|
||||
y: -1
|
||||
structural: 10
|
||||
- x: -1
|
||||
y: 3
|
||||
structural: 10
|
||||
- x: -4
|
||||
y: 1
|
||||
structural: 10
|
||||
- x: 0
|
||||
y: 1
|
||||
structural: 10
|
||||
- x: -1
|
||||
y: 2
|
||||
structural: 10
|
||||
- x: -4
|
||||
y: 3
|
||||
structural: 10
|
||||
- x: -2
|
||||
y: 0
|
||||
structural: 10
|
||||
- x: -1
|
||||
y: 0
|
||||
structural: 10
|
||||
- x: -1
|
||||
y: 4
|
||||
structural: 10
|
||||
- x: -5
|
||||
y: 0
|
||||
structural: 10
|
||||
- x: -6
|
||||
y: 0
|
||||
structural: 10
|
||||
- x: -6
|
||||
y: 1
|
||||
structural: 10
|
||||
- x: -6
|
||||
y: 2
|
||||
structural: 10
|
||||
- x: -6
|
||||
y: 3
|
||||
structural: 10
|
||||
- x: -6
|
||||
y: 4
|
||||
structural: 10
|
||||
- x: -6
|
||||
y: 5
|
||||
structural: 10
|
||||
objects: []
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 34e040e87b50c47b08f720ae05cd6be3
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -33,5 +33,40 @@ MonoBehaviour:
|
||||
y: 1
|
||||
- x: 0
|
||||
y: 1
|
||||
endpoints: []
|
||||
connections: []
|
||||
- id: stage_bd361c8ccbe4421cab5ad85cd71d081a
|
||||
displayName: Stage 2
|
||||
stageKind: 0
|
||||
worldLayer: 0
|
||||
color: {r: 0.3231449, g: 0.679588, b: 0.7256679, a: 0.77055603}
|
||||
stageDefinition: {fileID: 11400000, guid: 34e040e87b50c47b08f720ae05cd6be3, type: 2}
|
||||
occupiedTiles:
|
||||
- x: 2
|
||||
y: 0
|
||||
- x: 3
|
||||
y: 0
|
||||
- x: 2
|
||||
y: 1
|
||||
- x: 3
|
||||
y: 1
|
||||
endpoints:
|
||||
- id: endpoint_bb859113836e4b89860e97fb2589a4be
|
||||
stageId: stage_bd361c8ccbe4421cab5ad85cd71d081a
|
||||
worldTile:
|
||||
x: 2
|
||||
y: 1
|
||||
kind: 0
|
||||
required: 1
|
||||
socketFace: 3
|
||||
- id: endpoint_d6f5daa321f14376a237ac78ecdeb172
|
||||
stageId: stage_7f2050e54c664f349472c788bb702cce
|
||||
worldTile:
|
||||
x: 1
|
||||
y: 1
|
||||
kind: 0
|
||||
required: 1
|
||||
socketFace: 2
|
||||
connections:
|
||||
- id: connection_1099167b7150449491c4cf0d1b4e9b0a
|
||||
endpointAId: endpoint_bb859113836e4b89860e97fb2589a4be
|
||||
endpointBId: endpoint_d6f5daa321f14376a237ac78ecdeb172
|
||||
directionality: 0
|
||||
|
||||
@ -932,11 +932,17 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 86cfe3aa96e541c8998ae79b435d04e5, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
defaultCurtainType: {fileID: 0}
|
||||
starState: 2
|
||||
defaultCurtainType: {fileID: 11400000, guid: d91043b858654867aaa66b20d678191d, type: 2}
|
||||
starState: 4
|
||||
containers:
|
||||
keyData: []
|
||||
valueData: []
|
||||
keyData:
|
||||
- {fileID: 11400000, guid: 75f7ecfc567748fc911a909ed8e68a3e, type: 2}
|
||||
- {fileID: 11400000, guid: d91043b858654867aaa66b20d678191d, type: 2}
|
||||
- {fileID: 11400000, guid: bc9a28f3d7c64606a8b88c91b94e8805, type: 2}
|
||||
valueData:
|
||||
- {fileID: 6142202296111551056}
|
||||
- {fileID: 6746747995563563764}
|
||||
- {fileID: 7748973705469028213}
|
||||
--- !u!114 &4829059598325025422
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@ -45,7 +45,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::Intrepid.Core.InputManager
|
||||
subscriptionId: 8f4fe12e750947b8a90870d352933eda
|
||||
startInputSchema: 10
|
||||
startInputSchema: 0
|
||||
--- !u!1 &6646150497353767022
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -243,42 +243,6 @@ PrefabInstance:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 6646150498868371415}
|
||||
m_Modifications:
|
||||
- target: {fileID: 112904297142897738, guid: 60638fc6c55d48d9aa9b3889058b8af8, type: 3}
|
||||
propertyPath: defaultCurtainType
|
||||
value:
|
||||
objectReference: {fileID: 11400000, guid: 75f7ecfc567748fc911a909ed8e68a3e, type: 2}
|
||||
- target: {fileID: 112904297142897738, guid: 60638fc6c55d48d9aa9b3889058b8af8, type: 3}
|
||||
propertyPath: containers.keyData.Array.size
|
||||
value: 3
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 112904297142897738, guid: 60638fc6c55d48d9aa9b3889058b8af8, type: 3}
|
||||
propertyPath: containers.valueData.Array.size
|
||||
value: 3
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 112904297142897738, guid: 60638fc6c55d48d9aa9b3889058b8af8, type: 3}
|
||||
propertyPath: 'containers.keyData.Array.data[0]'
|
||||
value:
|
||||
objectReference: {fileID: 11400000, guid: 75f7ecfc567748fc911a909ed8e68a3e, type: 2}
|
||||
- target: {fileID: 112904297142897738, guid: 60638fc6c55d48d9aa9b3889058b8af8, type: 3}
|
||||
propertyPath: 'containers.keyData.Array.data[1]'
|
||||
value:
|
||||
objectReference: {fileID: 11400000, guid: d91043b858654867aaa66b20d678191d, type: 2}
|
||||
- target: {fileID: 112904297142897738, guid: 60638fc6c55d48d9aa9b3889058b8af8, type: 3}
|
||||
propertyPath: 'containers.keyData.Array.data[2]'
|
||||
value:
|
||||
objectReference: {fileID: 11400000, guid: bc9a28f3d7c64606a8b88c91b94e8805, type: 2}
|
||||
- target: {fileID: 112904297142897738, guid: 60638fc6c55d48d9aa9b3889058b8af8, type: 3}
|
||||
propertyPath: 'containers.valueData.Array.data[0]'
|
||||
value:
|
||||
objectReference: {fileID: 1955084864098744517}
|
||||
- target: {fileID: 112904297142897738, guid: 60638fc6c55d48d9aa9b3889058b8af8, type: 3}
|
||||
propertyPath: 'containers.valueData.Array.data[1]'
|
||||
value:
|
||||
objectReference: {fileID: 1422544498137591905}
|
||||
- target: {fileID: 112904297142897738, guid: 60638fc6c55d48d9aa9b3889058b8af8, type: 3}
|
||||
propertyPath: 'containers.valueData.Array.data[2]'
|
||||
value:
|
||||
objectReference: {fileID: 2708147333427269088}
|
||||
- target: {fileID: 3242557338744252078, guid: 60638fc6c55d48d9aa9b3889058b8af8, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
@ -328,39 +292,6 @@ PrefabInstance:
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 60638fc6c55d48d9aa9b3889058b8af8, type: 3}
|
||||
--- !u!114 &1422544498137591905 stripped
|
||||
MonoBehaviour:
|
||||
m_CorrespondingSourceObject: {fileID: 6746747995563563764, guid: 60638fc6c55d48d9aa9b3889058b8af8, type: 3}
|
||||
m_PrefabInstance: {fileID: 5628557395556330133}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 3be4a1babf654196ac8c01e8df059a13, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!114 &1955084864098744517 stripped
|
||||
MonoBehaviour:
|
||||
m_CorrespondingSourceObject: {fileID: 6142202296111551056, guid: 60638fc6c55d48d9aa9b3889058b8af8, type: 3}
|
||||
m_PrefabInstance: {fileID: 5628557395556330133}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 3be4a1babf654196ac8c01e8df059a13, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!114 &2708147333427269088 stripped
|
||||
MonoBehaviour:
|
||||
m_CorrespondingSourceObject: {fileID: 7748973705469028213, guid: 60638fc6c55d48d9aa9b3889058b8af8, type: 3}
|
||||
m_PrefabInstance: {fileID: 5628557395556330133}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 3be4a1babf654196ac8c01e8df059a13, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!114 &5732443498328172255 stripped
|
||||
MonoBehaviour:
|
||||
m_CorrespondingSourceObject: {fileID: 112904297142897738, guid: 60638fc6c55d48d9aa9b3889058b8af8, type: 3}
|
||||
|
||||
@ -1,5 +1,36 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &119630160975831446
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2270435121348859238}
|
||||
m_Layer: 0
|
||||
m_Name: LandingStart
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &2270435121348859238
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 119630160975831446}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 2378040738592165545}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &7631802331149991959
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -29,7 +60,8 @@ Transform:
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Children:
|
||||
- {fileID: 2270435121348859238}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &7503967939848988478
|
||||
@ -45,8 +77,9 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::Intrepid.Gameplay.Journey.JourneyManager
|
||||
subscriptionId: 5df34d67e6e44f3999042072ea652750
|
||||
curtainType: {fileID: 11400000, guid: 75f7ecfc567748fc911a909ed8e68a3e, type: 2}
|
||||
curtainType: {fileID: 11400000, guid: bc9a28f3d7c64606a8b88c91b94e8805, type: 2}
|
||||
journeyService: {fileID: 11400000, guid: 53f1211059b4847a49bde1be4b8d166c, type: 2}
|
||||
backStageService: {fileID: 11400000, guid: c58e40006278948db8d8b1f3477f83ea, type: 2}
|
||||
isRunningTest: 0
|
||||
stageToTest: {fileID: 0}
|
||||
landingStart: {fileID: 2270435121348859238}
|
||||
|
||||
@ -12,10 +12,56 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: fcb661d795ed4088af4ae73e4253f98b, type: 3}
|
||||
m_Name: JGraph-Test01
|
||||
m_EditorClassIdentifier: Assembly-CSharp::Intrepid.Gameplay.Journey.JGraphSO
|
||||
sourceWorldLayoutId:
|
||||
publishedAt:
|
||||
sourceWorldLayoutId: 4dac43bfd76a4286a40511c1cce4609b
|
||||
publishedAt: 2026-06-22T11:40:47.6512990Z
|
||||
schemaVersion: 1
|
||||
contentHash:
|
||||
stages: []
|
||||
endpoints: []
|
||||
connections: []
|
||||
contentHash: 6224a08985c67c0cf4d2fa4c9e88bf65f4b7137966b8432ed665f62c7c99778d
|
||||
stages:
|
||||
- id: stage_7f2050e54c664f349472c788bb702cce
|
||||
displayName: Stage 1
|
||||
worldLayer: 0
|
||||
occupiedTiles:
|
||||
- x: 0
|
||||
y: 0
|
||||
- x: 1
|
||||
y: 0
|
||||
- x: 1
|
||||
y: 1
|
||||
- x: 0
|
||||
y: 1
|
||||
tags: []
|
||||
- id: stage_bd361c8ccbe4421cab5ad85cd71d081a
|
||||
displayName: Stage 2
|
||||
worldLayer: 0
|
||||
occupiedTiles:
|
||||
- x: 2
|
||||
y: 0
|
||||
- x: 3
|
||||
y: 0
|
||||
- x: 2
|
||||
y: 1
|
||||
- x: 3
|
||||
y: 1
|
||||
tags: []
|
||||
endpoints:
|
||||
- id: endpoint_bb859113836e4b89860e97fb2589a4be
|
||||
stageId: stage_bd361c8ccbe4421cab5ad85cd71d081a
|
||||
worldTile:
|
||||
x: 2
|
||||
y: 1
|
||||
kind: 0
|
||||
required: 1
|
||||
socketFace: 3
|
||||
- id: endpoint_d6f5daa321f14376a237ac78ecdeb172
|
||||
stageId: stage_7f2050e54c664f349472c788bb702cce
|
||||
worldTile:
|
||||
x: 1
|
||||
y: 1
|
||||
kind: 0
|
||||
required: 1
|
||||
socketFace: 2
|
||||
connections:
|
||||
- id: connection_1099167b7150449491c4cf0d1b4e9b0a
|
||||
endpointAId: endpoint_bb859113836e4b89860e97fb2589a4be
|
||||
endpointBId: endpoint_d6f5daa321f14376a237ac78ecdeb172
|
||||
directionality: 0
|
||||
|
||||
@ -15,3 +15,4 @@ MonoBehaviour:
|
||||
journeyGraph: {fileID: 11400000, guid: 992c85dbd199649f48a532195af83aec, type: 2}
|
||||
stagesTags:
|
||||
- {fileID: 11400000, guid: b0fc23a68ad024c30a531fc69243b2a2, type: 2}
|
||||
- {fileID: 11400000, guid: ed5f85b3145ce4eabae9b1382f675817, type: 2}
|
||||
|
||||
@ -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: ab2e7a683f584962a36a133a6ac88b4a, type: 3}
|
||||
m_Name: behaviour.can-change-stage
|
||||
m_EditorClassIdentifier: Assembly-CSharp::Intrepid.Core.Tags.BehaviourTag
|
||||
code: behaviour.can-change-stage
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 37e6114b7cfc84a13ab29173bdcd4ccf
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because one or more lines are too long
@ -119,67 +119,6 @@ NavMeshSettings:
|
||||
debug:
|
||||
m_Flags: 0
|
||||
m_NavMeshData: {fileID: 0}
|
||||
--- !u!1001 &1609485360
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 1110237080051008694, guid: 774b83ee4bf84c4c9b531c2a6350b8a5, type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6646150498868371415, guid: 774b83ee4bf84c4c9b531c2a6350b8a5, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6646150498868371415, guid: 774b83ee4bf84c4c9b531c2a6350b8a5, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6646150498868371415, guid: 774b83ee4bf84c4c9b531c2a6350b8a5, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6646150498868371415, guid: 774b83ee4bf84c4c9b531c2a6350b8a5, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6646150498868371415, guid: 774b83ee4bf84c4c9b531c2a6350b8a5, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6646150498868371415, guid: 774b83ee4bf84c4c9b531c2a6350b8a5, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6646150498868371415, guid: 774b83ee4bf84c4c9b531c2a6350b8a5, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6646150498868371415, guid: 774b83ee4bf84c4c9b531c2a6350b8a5, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6646150498868371415, guid: 774b83ee4bf84c4c9b531c2a6350b8a5, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6646150498868371415, guid: 774b83ee4bf84c4c9b531c2a6350b8a5, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6646150498868371416, guid: 774b83ee4bf84c4c9b531c2a6350b8a5, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: GameManager
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 774b83ee4bf84c4c9b531c2a6350b8a5, type: 3}
|
||||
--- !u!1001 &7036882172617140290
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -188,6 +127,14 @@ PrefabInstance:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 2270435121348859238, guid: 8cee629b6bf44433f98c6e28031d8f6b, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2270435121348859238, guid: 8cee629b6bf44433f98c6e28031d8f6b, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2378040738592165545, guid: 8cee629b6bf44433f98c6e28031d8f6b, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
@ -228,6 +175,10 @@ PrefabInstance:
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7503967939848988478, guid: 8cee629b6bf44433f98c6e28031d8f6b, type: 3}
|
||||
propertyPath: isRunningTest
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7631802331149991959, guid: 8cee629b6bf44433f98c6e28031d8f6b, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: JourneyManager
|
||||
@ -241,5 +192,4 @@ PrefabInstance:
|
||||
SceneRoots:
|
||||
m_ObjectHideFlags: 0
|
||||
m_Roots:
|
||||
- {fileID: 1609485360}
|
||||
- {fileID: 7036882172617140290}
|
||||
|
||||
@ -13,5 +13,5 @@ MonoBehaviour:
|
||||
m_Name: Stage 1
|
||||
m_EditorClassIdentifier: Assembly-CSharp::Intrepid.Gameplay.Journey.StageTag
|
||||
code: Stage 1
|
||||
stageId:
|
||||
stageId: stage_7f2050e54c664f349472c788bb702cce
|
||||
localization: {fileID: 0}
|
||||
|
||||
File diff suppressed because one or more lines are too long
17
Assets/Scenes/6. Stages/Test01/Stage 2.asset
Normal file
17
Assets/Scenes/6. Stages/Test01/Stage 2.asset
Normal file
@ -0,0 +1,17 @@
|
||||
%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: 05ed6f9811ad495c85269adab82741b3, type: 3}
|
||||
m_Name: Stage 2
|
||||
m_EditorClassIdentifier: Assembly-CSharp::Intrepid.Gameplay.Journey.StageTag
|
||||
code: Stage 2
|
||||
stageId: stage_bd361c8ccbe4421cab5ad85cd71d081a
|
||||
localization: {fileID: 0}
|
||||
8
Assets/Scenes/6. Stages/Test01/Stage 2.asset.meta
Normal file
8
Assets/Scenes/6. Stages/Test01/Stage 2.asset.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ed5f85b3145ce4eabae9b1382f675817
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
2244
Assets/Scenes/6. Stages/Test01/Stage 2.unity
Normal file
2244
Assets/Scenes/6. Stages/Test01/Stage 2.unity
Normal file
File diff suppressed because one or more lines are too long
7
Assets/Scenes/6. Stages/Test01/Stage 2.unity.meta
Normal file
7
Assets/Scenes/6. Stages/Test01/Stage 2.unity.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 10ec588ad628146c7937abc5d4a4e656
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -15,15 +15,14 @@ namespace Editor.GON.StageEditor.Baker
|
||||
|
||||
public static GameObject Bake(StageDefinition stage, PrefabTable prefabTable)
|
||||
{
|
||||
if (stage.IsNull())
|
||||
{
|
||||
DLogger.LogWarn("Cannot bake: no StageDefinition selected.");
|
||||
return null;
|
||||
}
|
||||
|
||||
stage.EnsureDefaults();
|
||||
|
||||
var scene = SceneManager.GetActiveScene();
|
||||
var scene = SceneManager.GetSceneByName(stage.stageTag.SceneName);
|
||||
var isSceneLoaded = scene.isLoaded;
|
||||
if (!isSceneLoaded)
|
||||
{
|
||||
scene = EditorSceneManager.OpenScene(scene.path, OpenSceneMode.Additive);
|
||||
}
|
||||
var generatedRoot = EnsureGeneratedRoot(scene);
|
||||
Undo.RegisterCreatedObjectUndo(generatedRoot, "Create Generated Root");
|
||||
var stageRoot = EnsureStageRoot(stage, generatedRoot);
|
||||
@ -36,7 +35,16 @@ namespace Editor.GON.StageEditor.Baker
|
||||
Undo.RegisterCreatedObjectUndo(stageRoot, "Create Stage Root");
|
||||
|
||||
EditorSceneManager.MarkSceneDirty(scene);
|
||||
if (isSceneLoaded)
|
||||
{
|
||||
Selection.activeGameObject = stageRoot;
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorSceneManager.SaveScene(scene);
|
||||
EditorSceneManager.CloseScene(scene, false);
|
||||
}
|
||||
|
||||
DLogger.LogDebug($"Bake started for stage '{stage.Id}'. State root is ready.");
|
||||
|
||||
return stageRoot;
|
||||
|
||||
@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Intrepid.Diagnostics;
|
||||
using Intrepid.Gameplay.Flooring;
|
||||
using Intrepid.Gameplay.Prototyping;
|
||||
using Temporary;
|
||||
using UnityEditor;
|
||||
|
||||
@ -56,6 +56,7 @@ namespace Editor.GON.StageEditor
|
||||
public float cellSize = 1f;
|
||||
public float floorHeight = 6f;
|
||||
public int activeFloorIndex;
|
||||
public StageTag stageTag;
|
||||
|
||||
public StageWorldSyncData worldSync = new();
|
||||
|
||||
|
||||
@ -378,6 +378,17 @@ namespace Editor.GON.StageEditor
|
||||
return;
|
||||
}
|
||||
|
||||
if (stage.stageTag.IsNull())
|
||||
{
|
||||
EditorUtility.DisplayDialog(
|
||||
"Bake Stage",
|
||||
"Select StageTag to the stage before baking.",
|
||||
"OK"
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (prefabTable is null)
|
||||
{
|
||||
EditorUtility.DisplayDialog(
|
||||
|
||||
@ -19,7 +19,9 @@ namespace Intrepid.Core.Camera
|
||||
public float NormalAngle => mainCamera.transform.rotation.eulerAngles.z;
|
||||
public UnityEngine.Camera MainCamera => mainCamera;
|
||||
public CameraBoundaryManager CameraBoundaryManager => cameraBoundaryManager;
|
||||
public Vector3 CameraTargetPosition => CurrentCameraStreamStack?.TopCameraStream?.VCamera.Follow.position ?? Vector3.zero;
|
||||
|
||||
public Vector3 CameraTargetPosition =>
|
||||
CurrentCameraStreamStack?.TopCameraStream?.VCamera.Follow.position ?? Vector3.zero;
|
||||
|
||||
protected override void InitializeVariables()
|
||||
{
|
||||
@ -50,13 +52,13 @@ namespace Intrepid.Core.Camera
|
||||
CurrentCameraStreamStack?.TopCameraStream?.CameraUpdate(CurrentCameraStreamStack?.TopCameraStream);
|
||||
}
|
||||
|
||||
public void ForceFocusOn(Vector2 position)
|
||||
public void ForceFocusOn(Vector3 position)
|
||||
{
|
||||
if (IsBlendClearing) return;
|
||||
StartCoroutine(StraightMoveCameraPosition(position));
|
||||
}
|
||||
|
||||
private IEnumerator StraightMoveCameraPosition(Vector2 position)
|
||||
private IEnumerator StraightMoveCameraPosition(Vector3 position)
|
||||
{
|
||||
IsBlendClearing = true;
|
||||
|
||||
@ -67,13 +69,14 @@ namespace Intrepid.Core.Camera
|
||||
|
||||
yield return null;
|
||||
|
||||
mainCamera.transform.position = AdaptCameraPosition(position, mainCamera.transform.position);
|
||||
cinemachineBrain.transform.position = AdaptCameraPosition(position, mainCamera.transform.position);
|
||||
mainCamera.transform.position = position;
|
||||
cinemachineBrain.transform.position = position;
|
||||
|
||||
if (CurrentCameraStreamStack is not null)
|
||||
{
|
||||
CurrentCameraStreamStack.TopCameraStream.VCamera.transform.position = AdaptCameraPosition(position, CurrentCameraStreamStack.TopCameraStream.VCamera.transform.position);
|
||||
CurrentCameraStreamStack.TopCameraStream.VCamera.transform.position = position;
|
||||
}
|
||||
|
||||
CurrentCameraStreamStack?.TopCameraStream.VCamera.gameObject.SetActive(true);
|
||||
cinemachineBrain.enabled = true;
|
||||
|
||||
@ -82,11 +85,6 @@ namespace Intrepid.Core.Camera
|
||||
IsBlendClearing = false;
|
||||
}
|
||||
|
||||
private static Vector3 AdaptCameraPosition(Vector2 position, Vector3 oldPosition)
|
||||
{
|
||||
return new Vector3(position.x, position.y, oldPosition.z);
|
||||
}
|
||||
|
||||
public Vector2 ScreenToWorldPoint(Vector2 screenPoint)
|
||||
{
|
||||
return mainCamera.ScreenToWorldPoint(screenPoint);
|
||||
|
||||
@ -9,7 +9,6 @@ namespace Intrepid.Core.Camera
|
||||
{
|
||||
public sealed class CameraZoomManager : EventListener
|
||||
{
|
||||
[GroupConfigurations, SerializeField] private float startOrthographicSize = 12f;
|
||||
[GroupConfigurations, SerializeField] private float startZoomSmoothTime = 1f;
|
||||
|
||||
[GroupConfigurations, SerializeField] private float defaultOrthographicSize = 7f;
|
||||
@ -30,23 +29,14 @@ namespace Intrepid.Core.Camera
|
||||
|
||||
protected override void OnBootstrap()
|
||||
{
|
||||
// var stack = CameraSystem.Instance.CurrentCameraStreamStack;
|
||||
// if (stack.IsNotNull())
|
||||
// {
|
||||
// var lens = stack.TopCameraStream.VCamera.Lens;
|
||||
// lens.OrthographicSize = startOrthographicSize;
|
||||
// stack.TopCameraStream.VCamera.Lens = lens;
|
||||
// }
|
||||
}
|
||||
|
||||
protected override void Subscriptions()
|
||||
{
|
||||
Subscribe<CameraZoomEvent>(OnCameraZoomEvent);
|
||||
}
|
||||
|
||||
private void OnCameraZoomEvent(CameraZoomEvent e)
|
||||
Subscribe<CameraZoomEvent>(e =>
|
||||
{
|
||||
SetZoomLevel(e.ZoomLevel, e.ZoomVelocity);
|
||||
});
|
||||
}
|
||||
|
||||
[GroupDebug, Button(ButtonSizes.Medium, ButtonStyle.FoldoutButton)]
|
||||
|
||||
@ -69,7 +69,7 @@ namespace Intrepid.Core.Entities
|
||||
return !ShouldBeTriggered(entities, physicsTags);
|
||||
}
|
||||
|
||||
public abstract void DeployEntity(Vector2 position);
|
||||
public abstract void DeployEntity(Vector3 position);
|
||||
public abstract void RetreatEntity();
|
||||
}
|
||||
}
|
||||
@ -25,30 +25,15 @@ namespace Intrepid.Core.Entities
|
||||
private float fadeDuration;
|
||||
private float fadeElapsed;
|
||||
|
||||
public bool IsCurrent(AnimationClip clip)
|
||||
{
|
||||
return clip.IsNotNull()
|
||||
&& CurrentClip == clip
|
||||
&& currentPlayable.IsValid();
|
||||
}
|
||||
|
||||
public bool IsFadingTo(AnimationClip clip)
|
||||
{
|
||||
return clip.IsNotNull()
|
||||
&& IsFading
|
||||
&& nextClip == clip
|
||||
&& nextPlayable.IsValid();
|
||||
}
|
||||
|
||||
public bool IsPlaying(AnimationClip clip)
|
||||
{
|
||||
return IsCurrent(clip) || IsFadingTo(clip);
|
||||
}
|
||||
private float currentSpeed = 1f;
|
||||
private float nextSpeed = 1f;
|
||||
|
||||
public AnimationClip CurrentClip { get; private set; }
|
||||
|
||||
public bool IsFading { get; private set; }
|
||||
|
||||
public bool IsPaused { get; private set; }
|
||||
|
||||
public bool IsValid => currentPlayable.IsValid();
|
||||
|
||||
public float Time
|
||||
@ -92,7 +77,7 @@ namespace Intrepid.Core.Entities
|
||||
}
|
||||
}
|
||||
|
||||
// Take consideration Looping
|
||||
// Takes looping into consideration.
|
||||
public bool IsFinished
|
||||
{
|
||||
get
|
||||
@ -127,66 +112,17 @@ namespace Intrepid.Core.Entities
|
||||
graph.Play();
|
||||
}
|
||||
|
||||
public void Play(AnimationClip clip, float speed = 1f)
|
||||
{
|
||||
if (clip is null) return;
|
||||
|
||||
ClearInput(0);
|
||||
ClearInput(1);
|
||||
|
||||
currentInput = 0;
|
||||
nextInput = 1;
|
||||
|
||||
CurrentClip = clip;
|
||||
nextClip = null;
|
||||
|
||||
currentPlayable = AnimationClipPlayable.Create(graph, clip);
|
||||
currentPlayable.SetTime(0);
|
||||
currentPlayable.SetSpeed(speed);
|
||||
|
||||
graph.Connect(currentPlayable, 0, mixer, currentInput);
|
||||
|
||||
mixer.SetInputWeight(currentInput, 1f);
|
||||
mixer.SetInputWeight(nextInput, 0f);
|
||||
|
||||
IsFading = false;
|
||||
}
|
||||
|
||||
public void CrossFade(AnimationClip clip, float fadeDuration, float speed = 1f)
|
||||
{
|
||||
if (clip is null) return;
|
||||
|
||||
if (!currentPlayable.IsValid() || CurrentClip is null || fadeDuration <= 0f)
|
||||
{
|
||||
Play(clip, speed);
|
||||
return;
|
||||
}
|
||||
|
||||
if (CurrentClip == clip && !IsFading)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ClearInput(nextInput);
|
||||
|
||||
nextClip = clip;
|
||||
|
||||
nextPlayable = AnimationClipPlayable.Create(graph, clip);
|
||||
nextPlayable.SetTime(0);
|
||||
nextPlayable.SetSpeed(speed);
|
||||
|
||||
graph.Connect(nextPlayable, 0, mixer, nextInput);
|
||||
|
||||
mixer.SetInputWeight(nextInput, 0f);
|
||||
|
||||
this.fadeDuration = Mathf.Max(0.0001f, fadeDuration);
|
||||
fadeElapsed = 0f;
|
||||
IsFading = true;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (!IsFading) return;
|
||||
if (IsPaused)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IsFading)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
fadeElapsed += UnityEngine.Time.deltaTime;
|
||||
|
||||
@ -201,22 +137,147 @@ namespace Intrepid.Core.Entities
|
||||
}
|
||||
}
|
||||
|
||||
private void CompleteFade()
|
||||
public bool IsCurrent(AnimationClip clip)
|
||||
{
|
||||
ClearInput(currentInput);
|
||||
return clip.IsNotNull()
|
||||
&& CurrentClip == clip
|
||||
&& currentPlayable.IsValid();
|
||||
}
|
||||
|
||||
currentPlayable = nextPlayable;
|
||||
CurrentClip = nextClip;
|
||||
public bool IsFadingTo(AnimationClip clip)
|
||||
{
|
||||
return clip.IsNotNull()
|
||||
&& IsFading
|
||||
&& nextClip == clip
|
||||
&& nextPlayable.IsValid();
|
||||
}
|
||||
|
||||
nextPlayable = default;
|
||||
public bool IsPlaying(AnimationClip clip)
|
||||
{
|
||||
return IsCurrent(clip) || IsFadingTo(clip);
|
||||
}
|
||||
|
||||
public void Play(AnimationClip clip, float speed = 1f)
|
||||
{
|
||||
if (clip is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IsPaused = false;
|
||||
|
||||
ClearInput(0);
|
||||
ClearInput(1);
|
||||
|
||||
currentInput = 0;
|
||||
nextInput = 1;
|
||||
|
||||
CurrentClip = clip;
|
||||
nextClip = null;
|
||||
|
||||
mixer.SetInputWeight(currentInput, 0f);
|
||||
mixer.SetInputWeight(nextInput, 1f);
|
||||
currentSpeed = speed;
|
||||
nextSpeed = 1f;
|
||||
|
||||
(currentInput, nextInput) = (nextInput, currentInput);
|
||||
currentPlayable = AnimationClipPlayable.Create(graph, clip);
|
||||
currentPlayable.SetTime(0);
|
||||
currentPlayable.SetSpeed(currentSpeed);
|
||||
|
||||
graph.Connect(currentPlayable, 0, mixer, currentInput);
|
||||
|
||||
mixer.SetInputWeight(currentInput, 1f);
|
||||
mixer.SetInputWeight(nextInput, 0f);
|
||||
|
||||
IsFading = false;
|
||||
fadeElapsed = 0f;
|
||||
}
|
||||
|
||||
public void CrossFade(AnimationClip clip, float fadeDuration, float speed = 1f)
|
||||
{
|
||||
if (clip is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!currentPlayable.IsValid() || CurrentClip is null || fadeDuration <= 0f)
|
||||
{
|
||||
Play(clip, speed);
|
||||
return;
|
||||
}
|
||||
|
||||
if (CurrentClip == clip && !IsFading)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IsPaused = false;
|
||||
|
||||
if (currentPlayable.IsValid())
|
||||
{
|
||||
currentPlayable.SetSpeed(currentSpeed);
|
||||
}
|
||||
|
||||
if (nextPlayable.IsValid())
|
||||
{
|
||||
nextPlayable.SetSpeed(nextSpeed);
|
||||
}
|
||||
|
||||
ClearInput(nextInput);
|
||||
|
||||
nextClip = clip;
|
||||
nextSpeed = speed;
|
||||
|
||||
nextPlayable = AnimationClipPlayable.Create(graph, clip);
|
||||
nextPlayable.SetTime(0);
|
||||
nextPlayable.SetSpeed(nextSpeed);
|
||||
|
||||
graph.Connect(nextPlayable, 0, mixer, nextInput);
|
||||
|
||||
mixer.SetInputWeight(nextInput, 0f);
|
||||
|
||||
this.fadeDuration = Mathf.Max(0.0001f, fadeDuration);
|
||||
fadeElapsed = 0f;
|
||||
|
||||
IsFading = true;
|
||||
}
|
||||
|
||||
public void Pause()
|
||||
{
|
||||
if (IsPaused)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IsPaused = true;
|
||||
|
||||
if (currentPlayable.IsValid())
|
||||
{
|
||||
currentPlayable.SetSpeed(0f);
|
||||
}
|
||||
|
||||
if (nextPlayable.IsValid())
|
||||
{
|
||||
nextPlayable.SetSpeed(0f);
|
||||
}
|
||||
}
|
||||
|
||||
public void Unpause()
|
||||
{
|
||||
if (!IsPaused)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IsPaused = false;
|
||||
|
||||
if (currentPlayable.IsValid())
|
||||
{
|
||||
currentPlayable.SetSpeed(currentSpeed);
|
||||
}
|
||||
|
||||
if (nextPlayable.IsValid())
|
||||
{
|
||||
nextPlayable.SetSpeed(nextSpeed);
|
||||
}
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
@ -230,11 +291,47 @@ namespace Intrepid.Core.Entities
|
||||
CurrentClip = null;
|
||||
nextClip = null;
|
||||
|
||||
currentInput = 0;
|
||||
nextInput = 1;
|
||||
|
||||
currentSpeed = 1f;
|
||||
nextSpeed = 1f;
|
||||
|
||||
fadeDuration = 0f;
|
||||
fadeElapsed = 0f;
|
||||
|
||||
IsFading = false;
|
||||
IsPaused = false;
|
||||
}
|
||||
|
||||
private void CompleteFade()
|
||||
{
|
||||
ClearInput(currentInput);
|
||||
|
||||
currentPlayable = nextPlayable;
|
||||
CurrentClip = nextClip;
|
||||
currentSpeed = nextSpeed;
|
||||
|
||||
nextPlayable = default;
|
||||
nextClip = null;
|
||||
nextSpeed = 1f;
|
||||
|
||||
mixer.SetInputWeight(currentInput, 0f);
|
||||
mixer.SetInputWeight(nextInput, 1f);
|
||||
|
||||
(currentInput, nextInput) = (nextInput, currentInput);
|
||||
|
||||
fadeElapsed = 0f;
|
||||
IsFading = false;
|
||||
}
|
||||
|
||||
private void ClearInput(int input)
|
||||
{
|
||||
if (!mixer.IsValid())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var playable = mixer.GetInput(input);
|
||||
|
||||
if (playable.IsValid())
|
||||
|
||||
@ -1,11 +1,15 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Intrepid.Core.Camera;
|
||||
using Intrepid.Core.Entities;
|
||||
using Intrepid.Core.Entities.Messages;
|
||||
using Intrepid.Core.TimeControl;
|
||||
using Intrepid.GameManagers;
|
||||
using Intrepid.Gameplay.Entities.Player.ActionBelt;
|
||||
using Intrepid.Gameplay.Entities.Player.Sentinel.Cadence;
|
||||
using Intrepid.Gameplay.Entities.Player.Sentinel.StateMachine;
|
||||
using Intrepid.Gameplay.Flooring.Events;
|
||||
using Intrepid.Gameplay.Journey.Messages.Events;
|
||||
using Intrepid.Structures;
|
||||
using Intrepid.Utilities;
|
||||
using UnityEngine;
|
||||
@ -31,6 +35,7 @@ namespace Intrepid.Gameplay.Entities.Player.Sentinel
|
||||
public ActionBeltManager ActionBeltManager => actionBeltManager;
|
||||
public Cadences Cadences => cadences;
|
||||
public static bool IsCoreStable => !CoreStabilityService.Instance.IsCollapsed;
|
||||
public bool IsEnabled { get; private set; }
|
||||
|
||||
protected override void InitializeVariables()
|
||||
{
|
||||
@ -44,7 +49,7 @@ namespace Intrepid.Gameplay.Entities.Player.Sentinel
|
||||
protected override void OnBootstrap()
|
||||
{
|
||||
StateMachine.StartMachine();
|
||||
ResetBrain();
|
||||
IsEnabled = false;
|
||||
}
|
||||
|
||||
protected override void Subscriptions()
|
||||
@ -60,14 +65,29 @@ namespace Intrepid.Gameplay.Entities.Player.Sentinel
|
||||
if (CurrentState == SentinelStateType.Fall) return;
|
||||
StateMachine.ChangeState(SentinelStateType.Fall);
|
||||
});
|
||||
}
|
||||
|
||||
public void ResetBrain()
|
||||
Subscribe<ChangeStageStartEvent>(e =>
|
||||
{
|
||||
Entity.RetreatEntity();
|
||||
IsEnabled = false;
|
||||
ChangeState(SentinelStateType.Nop);
|
||||
});
|
||||
Subscribe<StageDispatchDeploymentPointEvent>(e =>
|
||||
{
|
||||
Entity.DeployEntity(e.DeploymentPoint);
|
||||
CameraSystem.Instance.ForceFocusOn(e.DeploymentPoint);
|
||||
IsEnabled = true;
|
||||
Proxy.Instance.EventBus.Raise(new EmitFloorDetectionEvent
|
||||
{
|
||||
FloorDetection = Entity.FloorDetection
|
||||
});
|
||||
ChangeState(SentinelStateType.Idle);
|
||||
});
|
||||
}
|
||||
|
||||
public override void UpdateFromUpdatable()
|
||||
{
|
||||
if (!IsEnabled) return;
|
||||
|
||||
StateMachine.UpdateStateMachine();
|
||||
|
||||
InputResolver.Sentinel.CaptureAndPrune(TimeSimulation.Instance.ScaledElapsedTime);
|
||||
@ -94,11 +114,15 @@ namespace Intrepid.Gameplay.Entities.Player.Sentinel
|
||||
|
||||
public override void LateUpdateFromUpdatable()
|
||||
{
|
||||
if (!IsEnabled) return;
|
||||
|
||||
StateMachine.CurrentImplementation.RunOnLateUpdate();
|
||||
}
|
||||
|
||||
public override void FixedUpdateFromUpdatable()
|
||||
{
|
||||
if (!IsEnabled) return;
|
||||
|
||||
StateMachine.CurrentImplementation.RunOnFixedUpdate();
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
using Intrepid.Core.Entities;
|
||||
using Intrepid.Core.Grounding;
|
||||
using Intrepid.GameManagers;
|
||||
using Intrepid.Gameplay.Flooring;
|
||||
using Intrepid.Gameplay.Messages.Events;
|
||||
using Intrepid.Utilities;
|
||||
using UnityEngine;
|
||||
@ -10,8 +11,10 @@ namespace Intrepid.Gameplay.Entities.Player.Sentinel
|
||||
public class SentinelEntity : Entity
|
||||
{
|
||||
[GroupInjections, SerializeField] private Rigidbody unityRigidbody;
|
||||
[GroupInjections, SerializeField] private CapsuleCollider capsuleCollider;
|
||||
[GroupInjections, SerializeField] private Transform modelTransform;
|
||||
[GroupInjections, SerializeField] private EntityModelAnimation modelAnimation;
|
||||
[GroupInjections, SerializeField] private FloorDetection floorDetection;
|
||||
[GroupInjections, SerializeField] private EntityMotorSmoothRotation motorSmoothRotation;
|
||||
[GroupInjections, SerializeField] private EntityMotorPhysicsContact motorPhysicsContact;
|
||||
[GroupInjections, SerializeField] private EntityMotorTopDown motorTopDown;
|
||||
@ -21,6 +24,7 @@ namespace Intrepid.Gameplay.Entities.Player.Sentinel
|
||||
|
||||
protected SentinelBrain Brain => EntityBrain as SentinelBrain;
|
||||
private Rigidbody UnityRigidbody => unityRigidbody;
|
||||
private CapsuleCollider CapsuleCollider => capsuleCollider;
|
||||
// private EntityMotorSmoothRotation MotorSmoothRotation => motorSmoothRotation;
|
||||
private EntityMotorPhysicsContact MotorPhysicsContact => motorPhysicsContact;
|
||||
private EntityMotorTopDown MotorTopDown => motorTopDown;
|
||||
@ -32,15 +36,26 @@ namespace Intrepid.Gameplay.Entities.Player.Sentinel
|
||||
public Vector2 Forward => new Vector2(_desiredForward.x, _desiredForward.z).normalized;
|
||||
public bool IsGrounded => MotorTopDown.IsGrounded;
|
||||
public GroundProfiles CurrentGroundProfiles => MotorTopDown.CurrentGroundProfiles;
|
||||
public FloorDetection FloorDetection => floorDetection;
|
||||
|
||||
public override void DeployEntity(Vector2 position)
|
||||
public override void DeployEntity(Vector3 position)
|
||||
{
|
||||
Brain.ResetBrain();
|
||||
UnityRigidbody.position = position;
|
||||
|
||||
UnityRigidbody.isKinematic = false;
|
||||
CapsuleCollider.enabled = true;
|
||||
MotorTopDown.enabled = true;
|
||||
MotorPhysicsContact.enabled = true;
|
||||
|
||||
RefreshMovementNormal();
|
||||
}
|
||||
|
||||
public override void RetreatEntity()
|
||||
{
|
||||
UnityRigidbody.isKinematic = true;
|
||||
CapsuleCollider.enabled = false;
|
||||
MotorTopDown.enabled = false;
|
||||
MotorPhysicsContact.enabled = false;
|
||||
}
|
||||
|
||||
public void ChangeOrientation(Vector2 direction)
|
||||
@ -58,6 +73,8 @@ namespace Intrepid.Gameplay.Entities.Player.Sentinel
|
||||
|
||||
public override void UpdateFromUpdatable()
|
||||
{
|
||||
if (!Brain.IsEnabled) return;
|
||||
|
||||
modelTransform.rotation = Quaternion.LookRotation(_desiredForward, Vector3.up);
|
||||
//MotorSmoothRotation.TurnModel(modelTransform, _desiredForward);
|
||||
base.UpdateFromUpdatable();
|
||||
@ -65,6 +82,8 @@ namespace Intrepid.Gameplay.Entities.Player.Sentinel
|
||||
|
||||
public override void FixedUpdateFromUpdatable()
|
||||
{
|
||||
if (!Brain.IsEnabled) return;
|
||||
|
||||
base.FixedUpdateFromUpdatable();
|
||||
_intendedDesiredVelocity = new Vector3(DesiredVelocity.x, 0, DesiredVelocity.y);
|
||||
LinearVelocity = MotorPhysicsContact.AdjustVelocityByContacts(DesiredVelocity);
|
||||
@ -77,12 +96,16 @@ namespace Intrepid.Gameplay.Entities.Player.Sentinel
|
||||
|
||||
private void OnCollisionEnter(Collision collision)
|
||||
{
|
||||
if (!Brain.IsEnabled) return;
|
||||
|
||||
MotorPhysicsContact.RegisterCollisionContacts(collision, MotorTopDown.MaxSlopeAngle);
|
||||
TryRaiseImpact(LinearVelocity);
|
||||
}
|
||||
|
||||
private void OnCollisionStay(Collision collision)
|
||||
{
|
||||
if (!Brain.IsEnabled) return;
|
||||
|
||||
MotorPhysicsContact.RegisterCollisionContacts(collision, MotorTopDown.MaxSlopeAngle);
|
||||
TryRaiseImpact(_intendedDesiredVelocity);
|
||||
}
|
||||
|
||||
@ -2,7 +2,8 @@ namespace Intrepid.Gameplay.Entities.Player.Sentinel
|
||||
{
|
||||
public enum SentinelStateType
|
||||
{
|
||||
None = 0,
|
||||
Nop = 0,
|
||||
|
||||
PDA = 1,
|
||||
|
||||
Idle = 10,
|
||||
|
||||
@ -0,0 +1,31 @@
|
||||
using Intrepid.Structures;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Intrepid.Gameplay.Entities.Player.Sentinel.StateMachine.States
|
||||
{
|
||||
public class SentinelStateNop : SentinelState
|
||||
{
|
||||
public override SentinelStateType GetStateKey()
|
||||
{
|
||||
return SentinelStateType.Nop;
|
||||
}
|
||||
|
||||
protected override void Subscriptions()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void RunOnEnter(ParameterStore ps)
|
||||
{
|
||||
Brain.Entity.ModelAnimation.Pause();
|
||||
Brain.Entity.DesiredVelocity = Vector2.zero;
|
||||
}
|
||||
|
||||
protected override void RunOnExit()
|
||||
{
|
||||
}
|
||||
|
||||
public override void RunOnUpdate()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f244623cb1824165863f6e8188bf6256
|
||||
timeCreated: 1782145081
|
||||
3
Assets/Scripts/Intrepid/Gameplay/Flooring.meta
Normal file
3
Assets/Scripts/Intrepid/Gameplay/Flooring.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 01c2d3509e324acda2c81bfd5e02a51c
|
||||
timeCreated: 1782138594
|
||||
3
Assets/Scripts/Intrepid/Gameplay/Flooring/Events.meta
Normal file
3
Assets/Scripts/Intrepid/Gameplay/Flooring/Events.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fe589b126c0b4221855565880d361022
|
||||
timeCreated: 1782138616
|
||||
@ -0,0 +1,9 @@
|
||||
using Intrepid.SimpleEvents;
|
||||
|
||||
namespace Intrepid.Gameplay.Flooring.Events
|
||||
{
|
||||
public class EmitFloorDetectionEvent : IEventBase
|
||||
{
|
||||
public FloorDetection FloorDetection { get; set; }
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a46794442c784ad383b0df8760873039
|
||||
timeCreated: 1782138639
|
||||
@ -2,7 +2,7 @@ using Intrepid.Utilities;
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Temporary
|
||||
namespace Intrepid.Gameplay.Flooring
|
||||
{
|
||||
public class FloorDetection : MonoBehaviour
|
||||
{
|
||||
@ -1,12 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Intrepid.Gameplay.Flooring.Events;
|
||||
using Intrepid.SimpleEvents;
|
||||
using Intrepid.Utilities;
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Temporary
|
||||
namespace Intrepid.Gameplay.Flooring
|
||||
{
|
||||
public class FloorManager : SingletonMonoBehaviour<FloorManager>
|
||||
public class FloorManager : EventListener
|
||||
{
|
||||
private const float DisabledUpperThreshold = 1_000_000f;
|
||||
private const float DisabledUpperMax = 1_000_001f;
|
||||
@ -14,31 +16,36 @@ namespace Temporary
|
||||
private const float DisabledLowerThreshold = -1_000_000f;
|
||||
private const float DisabledLowerMin = -1_000_001f;
|
||||
|
||||
[GroupInjections, SerializeField] private FloorDetection floorDetection;
|
||||
[GroupDebug, SerializeField, ReadOnly] private FloorDetection floorDetection;
|
||||
|
||||
[GroupConfigurations("Upper Fade"), SerializeField] private float upperMax = 5.75f;
|
||||
[GroupConfigurations("Upper Fade"), SerializeField] private float upperThreshold = 3f;
|
||||
[GroupConfigurations("Upper Fade"), SerializeField] private float upperMax = 5.5f;
|
||||
[GroupConfigurations("Upper Fade"), SerializeField] private float upperThreshold = 5.2f;
|
||||
|
||||
[GroupConfigurations("Lower Tint"), SerializeField] private float lowerThreshold = -3f;
|
||||
[GroupConfigurations("Lower Tint"), SerializeField] private float lowerMin = -6f;
|
||||
[GroupConfigurations("Lower Tint"), SerializeField] private float lowerThreshold = -1.5f;
|
||||
[GroupConfigurations("Lower Tint"), SerializeField] private float lowerMin = -9f;
|
||||
|
||||
[GroupConfigurations("Lower Tint"), SerializeField] private Color lowerTintColor = new(0.35f, 0.35f, 0.35f, 1f);
|
||||
|
||||
private List<FloorVisualGroup> FloorVisualGroups { get; } = new();
|
||||
|
||||
private void Awake()
|
||||
protected override void InitializeVariables()
|
||||
{
|
||||
SingletonInstantiation(false, manager =>
|
||||
{
|
||||
manager.DetectFloorVisualGroups();
|
||||
});
|
||||
DetectFloorVisualGroups();
|
||||
}
|
||||
|
||||
private void Start()
|
||||
protected override void OnBootstrap()
|
||||
{
|
||||
ApplyVisibility();
|
||||
}
|
||||
|
||||
protected override void Subscriptions()
|
||||
{
|
||||
Subscribe<EmitFloorDetectionEvent>(e =>
|
||||
{
|
||||
floorDetection = e.FloorDetection;
|
||||
});
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
ApplyVisibility();
|
||||
@ -4,7 +4,7 @@ using Intrepid.Utilities;
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Temporary
|
||||
namespace Intrepid.Gameplay.Flooring
|
||||
{
|
||||
public struct VisibilityRequest
|
||||
{
|
||||
@ -1,7 +1,11 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using Intrepid.Core.Camera;
|
||||
using Intrepid.Diagnostics;
|
||||
using Intrepid.GameManagers;
|
||||
using Intrepid.Gameplay.Journey.Messages;
|
||||
using Intrepid.Gameplay.Journey.Messages.Events;
|
||||
using Intrepid.Integration.Input;
|
||||
using Intrepid.SimpleEvents;
|
||||
using Intrepid.Theatre.BackStage;
|
||||
using Intrepid.Theatre.Curtain;
|
||||
@ -11,29 +15,39 @@ using UnityEngine;
|
||||
|
||||
namespace Intrepid.Gameplay.Journey
|
||||
{
|
||||
public class JourneyManager : SingletonEventListener<JourneyManager>
|
||||
public class JourneyManager : SingletonEventListener<JourneyManager>, IBackStageProcessor
|
||||
{
|
||||
private const string Id = "JourneyManager";
|
||||
|
||||
[GroupConfigurations, SerializeField] private CurtainTypeTag curtainType;
|
||||
[GroupInjections, SerializeField] private JourneyService journeyService;
|
||||
[GroupInjections, SerializeField] private BackStageService backStageService;
|
||||
#if UNITY_EDITOR
|
||||
[GroupDebug, SerializeField, ToggleLeft] private bool isRunningTest;
|
||||
[GroupDebug, SerializeField, ShowIf("IsRunningTest")] private StageTag stageToTest;
|
||||
[GroupDebug, SerializeField, ShowIf("IsRunningTest")] private Transform landingStart;
|
||||
#endif
|
||||
|
||||
private StageStateMachine StageStateMachine { get; } = new();
|
||||
private CurtainTypeTag CurtainType => curtainType;
|
||||
private BackStageService BackStageService => backStageService;
|
||||
private JourneyService JourneyService => journeyService;
|
||||
#if UNITY_EDITOR
|
||||
private bool IsRunningTest => isRunningTest;
|
||||
#endif
|
||||
private JourneyService JourneyService => journeyService;
|
||||
private StageStateMachine StageStateMachine { get; } = new();
|
||||
private StageTag StageToStartJourney { get; set; }
|
||||
private StageTag StageToChange { get; set; }
|
||||
private IBackStageWindowExecution CallbackProcessors { get; set; }
|
||||
private string DestinyEndpoint { get; set; }
|
||||
private InputSchema LastInputSchema { get; set; } = InputSchema.None;
|
||||
|
||||
public bool IsProcessFinished => StageStateMachine.IsLoadingFinished && !CameraSystem.Instance.IsCameraBlending;
|
||||
|
||||
protected override void InitializeVariables()
|
||||
{
|
||||
SingletonInstantiation(false, manager =>
|
||||
{
|
||||
var stageTags = manager.JourneyService.Initialize();
|
||||
manager.StageStateMachine.LoadMachine(stageTags, curtainType, backStageService);
|
||||
manager.StageStateMachine.LoadMachine(stageTags);
|
||||
});
|
||||
}
|
||||
|
||||
@ -42,14 +56,8 @@ namespace Intrepid.Gameplay.Journey
|
||||
#if UNITY_EDITOR
|
||||
if (IsRunningTest && stageToTest.IsNotNull())
|
||||
{
|
||||
JourneyStartForTesting(stageToTest);
|
||||
LoadJourneyForTesting(stageToTest, landingStart);
|
||||
}
|
||||
else
|
||||
{
|
||||
JourneyStart();
|
||||
}
|
||||
#else
|
||||
JourneyStart();
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -59,7 +67,7 @@ namespace Intrepid.Gameplay.Journey
|
||||
|
||||
private void Update()
|
||||
{
|
||||
StageStateMachine.UpdateCurtains();
|
||||
BackStageService.UpdateCurtains();
|
||||
}
|
||||
|
||||
protected override void OnTearDown()
|
||||
@ -67,43 +75,53 @@ namespace Intrepid.Gameplay.Journey
|
||||
StageStateMachine.TearDown();
|
||||
}
|
||||
|
||||
public void LoadStageToStart(StageTag stage) // we are going to add more data here
|
||||
private void LoadJourney(LoadJourneyRequest request)
|
||||
{
|
||||
if (stage.IsNull())
|
||||
if (request is null)
|
||||
{
|
||||
throw new NullReferenceException("we should initialize a stage to start journey first!");
|
||||
DLogger.LogError("load journey request should not be null");
|
||||
return;
|
||||
}
|
||||
if (request.StageTag.IsNull() || string.IsNullOrWhiteSpace(request.StageTag.Code))
|
||||
{
|
||||
DLogger.LogError("stage tag/code should not be null or empty");
|
||||
return;
|
||||
}
|
||||
|
||||
StageToStartJourney = stage;
|
||||
}
|
||||
|
||||
public void JourneyStart(StageTag stage = null)
|
||||
{
|
||||
if (stage is not null)
|
||||
{
|
||||
StageToStartJourney = stage;
|
||||
}
|
||||
if (StageToStartJourney is null)
|
||||
{
|
||||
throw new NullReferenceException("we should initialize a stage to start journey first!");
|
||||
}
|
||||
StageStateMachine.InitMachine(StageToStartJourney);
|
||||
StageStateMachine.InitMachine(request.StageTag);
|
||||
}
|
||||
|
||||
[GroupDebug, Button(ButtonSizes.Large, ButtonStyle.FoldoutButton)]
|
||||
private void JourneyStartForTesting(StageTag stage)
|
||||
private void LoadJourneyForTesting(StageTag stage, Transform landing)
|
||||
{
|
||||
JourneyStart(stage);
|
||||
StartCoroutine(OpenAfter2Secs());
|
||||
LoadJourney(new LoadJourneyRequest
|
||||
{
|
||||
StageTag = stage
|
||||
});
|
||||
StartCoroutine(OpenAfterNSecs(landing));
|
||||
}
|
||||
|
||||
private static IEnumerator OpenAfter2Secs()
|
||||
private IEnumerator OpenAfterNSecs(Transform landing, float nSecs = 1f)
|
||||
{
|
||||
yield return new WaitForSeconds(2f);
|
||||
yield return new WaitForSeconds(nSecs);
|
||||
Proxy.Instance.EventBus.Raise(new StageDispatchDeploymentPointEvent
|
||||
{
|
||||
DeploymentPoint = landing.position,
|
||||
});
|
||||
Proxy.Instance.CurtainStateMachine.RaiseCommand(CurtainCommandType.Open);
|
||||
InputService.Instance.ChangeInputSchema(InputSchema.Sentinel);
|
||||
}
|
||||
|
||||
public void ChangeStageTo(StageTag stage, IBackStageWindowExecution callbacks = null)
|
||||
[GroupDebug, Button(ButtonSizes.Large, ButtonStyle.FoldoutButton)]
|
||||
private void ChangeStageForTesting(StageTag stageTag, string destinyEndpoint)
|
||||
{
|
||||
ChangeStageTo(stageTag, destinyEndpoint);
|
||||
}
|
||||
|
||||
public void ChangeStageTo(
|
||||
StageTag stageTag,
|
||||
string destinyEndpoint,
|
||||
IBackStageWindowExecution callbacks = null)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
if (IsRunningTest)
|
||||
@ -112,7 +130,49 @@ namespace Intrepid.Gameplay.Journey
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
StageStateMachine.ChangeTo(stage, callbacks);
|
||||
if (stageTag.IsNull() || string.IsNullOrEmpty(stageTag.Code))
|
||||
{
|
||||
throw new ArgumentException("stage tag cannot be null or empty");
|
||||
}
|
||||
if (StageStateMachine.CurrentStageTag == stageTag) return;
|
||||
DestinyEndpoint = destinyEndpoint;
|
||||
if (BackStageService.KickProcess(CurtainType, Id, this))
|
||||
{
|
||||
StageToChange = stageTag;
|
||||
}
|
||||
CallbackProcessors = callbacks;
|
||||
}
|
||||
|
||||
public void AfterOpened()
|
||||
{
|
||||
DestinyEndpoint = null;
|
||||
CallbackProcessors?.AfterOpened();
|
||||
Proxy.Instance.EventBus.Raise(new ChangeStageEndEvent());
|
||||
InputService.Instance.ChangeInputSchema(LastInputSchema);
|
||||
LastInputSchema = InputSchema.None;
|
||||
}
|
||||
|
||||
public void BeforeOpening()
|
||||
{
|
||||
CallbackProcessors?.BeforeOpening();
|
||||
Proxy.Instance.EventBus.Raise(new ChangeStageLandingOnStageStepEvent
|
||||
{
|
||||
DestinyEndpoint = DestinyEndpoint
|
||||
});
|
||||
}
|
||||
|
||||
public void AfterClosed()
|
||||
{
|
||||
Proxy.Instance.EventBus.Raise(new ChangeStageStartEvent());
|
||||
StageStateMachine.ChangeState(StageToChange);
|
||||
CallbackProcessors?.AfterClosed();
|
||||
}
|
||||
|
||||
public void BeforeClosing()
|
||||
{
|
||||
LastInputSchema = InputService.Instance.CurrentInputSchema;
|
||||
InputService.Instance.ChangeInputSchema(InputSchema.None);
|
||||
CallbackProcessors?.BeforeClosing();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Intrepid.Diagnostics;
|
||||
using Intrepid.Utilities;
|
||||
using Sirenix.OdinInspector;
|
||||
@ -15,25 +14,43 @@ namespace Intrepid.Gameplay.Journey
|
||||
[CreateAssetMenu(fileName = "Journey Service", menuName = "GON/Services/Journey Service")]
|
||||
public class JourneyService : ScriptableObject
|
||||
{
|
||||
[GroupInjections, SerializeField] private JGraphSO journeyGraph;
|
||||
[GroupInjections, SerializeField]
|
||||
private JGraphSO journeyGraph;
|
||||
|
||||
[GroupInjections, SerializeField, ReadOnly, ListDrawerSettings(ShowFoldout = false)]
|
||||
private List<StageTag> stagesTags;
|
||||
private List<StageTag> stagesTags = new();
|
||||
|
||||
private Dictionary<StageTag, JStage> StageMap { get; } = new();
|
||||
|
||||
private Dictionary<string, StageTag> StageTagMap { get; } = new();
|
||||
|
||||
private Dictionary<string, JEndpoint> EndpointMap { get; } = new();
|
||||
|
||||
private Dictionary<string, StageTag> EndpointStageTagMap { get; } = new();
|
||||
|
||||
private Dictionary<string, Dictionary<string, List<JConnection>>> StageConnections { get; } = new();
|
||||
|
||||
#if UNITY_EDITOR
|
||||
[PropertyOrder(-10)]
|
||||
[GroupInjections, Button(ButtonSizes.Large), GUIColor(0.35f, 0.8f, .35f)]
|
||||
protected void FindAllStageTags()
|
||||
{
|
||||
stagesTags ??= new();
|
||||
stagesTags.Clear();
|
||||
var guids = AssetDatabase.FindAssets($"t:StageTag");
|
||||
|
||||
var guids = AssetDatabase.FindAssets("t:StageTag");
|
||||
|
||||
foreach (var guid in guids)
|
||||
{
|
||||
var path = AssetDatabase.GUIDToAssetPath(guid);
|
||||
var stage = AssetDatabase.LoadAssetAtPath<StageTag>(path);
|
||||
stagesTags.Add(stage);
|
||||
var stageTag = AssetDatabase.LoadAssetAtPath<StageTag>(path);
|
||||
|
||||
if (stageTag.IsNull())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
stagesTags.Add(stageTag);
|
||||
}
|
||||
|
||||
EditorUtility.SetDirty(this);
|
||||
@ -55,15 +72,16 @@ namespace Intrepid.Gameplay.Journey
|
||||
return;
|
||||
}
|
||||
|
||||
// check if every stage in the graph has a stage tag associated.
|
||||
var map = stagesTags.ToDictionary(stageTag => stageTag.StageId);
|
||||
var stageTagMap = BuildStageTagMap();
|
||||
|
||||
foreach (var jStage in journeyGraph.stages)
|
||||
{
|
||||
if (!map.TryGetValue(jStage.id, out var tag))
|
||||
if (!stageTagMap.TryGetValue(jStage.id, out var tag))
|
||||
{
|
||||
DLogger.LogDebug($"Stage {jStage.id} is not found in the stage tag list");
|
||||
continue;
|
||||
}
|
||||
|
||||
tag.TestIfExists();
|
||||
}
|
||||
}
|
||||
@ -75,20 +93,186 @@ namespace Intrepid.Gameplay.Journey
|
||||
throw new NullReferenceException($"{nameof(journeyGraph)} should not be null or empty");
|
||||
}
|
||||
|
||||
var map = stagesTags.ToDictionary(stageTag => stageTag.StageId);
|
||||
ClearRuntimeCache();
|
||||
|
||||
BuildStageTagCache();
|
||||
BuildEndpointCache();
|
||||
BuildStageConnectionCache();
|
||||
BuildStageMapCache();
|
||||
|
||||
return StageTagMap.Values;
|
||||
}
|
||||
|
||||
private void ClearRuntimeCache()
|
||||
{
|
||||
StageMap.Clear();
|
||||
StageTagMap.Clear();
|
||||
EndpointMap.Clear();
|
||||
EndpointStageTagMap.Clear();
|
||||
StageConnections.Clear();
|
||||
}
|
||||
|
||||
private Dictionary<string, StageTag> BuildStageTagMap()
|
||||
{
|
||||
var map = new Dictionary<string, StageTag>();
|
||||
|
||||
if (stagesTags.IsNull())
|
||||
{
|
||||
return map;
|
||||
}
|
||||
|
||||
foreach (var stageTag in stagesTags)
|
||||
{
|
||||
if (stageTag.IsNull())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(stageTag.StageId))
|
||||
{
|
||||
DLogger.LogWarn($"StageTag {stageTag.name} has null or empty StageId");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!map.TryAdd(stageTag.StageId, stageTag))
|
||||
{
|
||||
DLogger.LogWarn($"Duplicated StageTag for StageId {stageTag.StageId}");
|
||||
}
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
private void BuildStageTagCache()
|
||||
{
|
||||
var map = BuildStageTagMap();
|
||||
|
||||
foreach (var pair in map)
|
||||
{
|
||||
StageTagMap.Add(pair.Key, pair.Value);
|
||||
}
|
||||
}
|
||||
|
||||
private void BuildEndpointCache()
|
||||
{
|
||||
foreach (var endpoint in journeyGraph.endpoints)
|
||||
{
|
||||
if (endpoint.IsNull())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(endpoint.id))
|
||||
{
|
||||
DLogger.LogWarn("Endpoint with null or empty id found");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!EndpointMap.TryAdd(endpoint.id, endpoint))
|
||||
{
|
||||
DLogger.LogWarn($"Duplicated endpoint id {endpoint.id}");
|
||||
continue;
|
||||
}
|
||||
|
||||
EnsureStageConnectionBucket(endpoint.stageId, endpoint.id);
|
||||
|
||||
if (StageTagMap.TryGetValue(endpoint.stageId, out var stageTag))
|
||||
{
|
||||
EndpointStageTagMap.TryAdd(endpoint.id, stageTag);
|
||||
}
|
||||
else
|
||||
{
|
||||
DLogger.LogWarn($"Endpoint {endpoint.id} references stage {endpoint.stageId}, but no StageTag was found");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void BuildStageConnectionCache()
|
||||
{
|
||||
foreach (var connection in journeyGraph.connections)
|
||||
{
|
||||
if (connection.IsNull())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!EndpointMap.TryGetValue(connection.endpointAId, out var endpointA))
|
||||
{
|
||||
DLogger.LogWarn($"Connection {connection.id} has invalid endpoint A: {connection.endpointAId}");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!EndpointMap.TryGetValue(connection.endpointBId, out var endpointB))
|
||||
{
|
||||
DLogger.LogWarn($"Connection {connection.id} has invalid endpoint B: {connection.endpointBId}");
|
||||
continue;
|
||||
}
|
||||
|
||||
StageConnections[endpointA.stageId][endpointA.id].Add(connection);
|
||||
StageConnections[endpointB.stageId][endpointB.id].Add(connection);
|
||||
}
|
||||
}
|
||||
|
||||
private void BuildStageMapCache()
|
||||
{
|
||||
foreach (var jStage in journeyGraph.stages)
|
||||
{
|
||||
if (map.TryGetValue(jStage.id, out var tag))
|
||||
if (jStage.IsNull())
|
||||
{
|
||||
StageMap.Add(tag, jStage);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (StageTagMap.TryGetValue(jStage.id, out var tag))
|
||||
{
|
||||
StageMap.TryAdd(tag, jStage);
|
||||
}
|
||||
else
|
||||
{
|
||||
DLogger.LogWarn($"Stage {jStage.id} is not found in the stage tag list");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return map.Values;
|
||||
private void EnsureStageConnectionBucket(string stageId, string endpointId)
|
||||
{
|
||||
if (!StageConnections.TryGetValue(stageId, out var stageConnections))
|
||||
{
|
||||
stageConnections = new Dictionary<string, List<JConnection>>();
|
||||
StageConnections[stageId] = stageConnections;
|
||||
}
|
||||
|
||||
stageConnections.TryAdd(endpointId, new List<JConnection>());
|
||||
}
|
||||
|
||||
public bool TryGetJConnections(
|
||||
string stageId,
|
||||
string endpointId,
|
||||
out IReadOnlyList<JConnection> jConnections)
|
||||
{
|
||||
if (StageConnections.TryGetValue(stageId, out var stageConnections) &&
|
||||
stageConnections.TryGetValue(endpointId, out var connections))
|
||||
{
|
||||
jConnections = connections;
|
||||
return true;
|
||||
}
|
||||
|
||||
jConnections = Array.Empty<JConnection>();
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool TryGetStageTagFromEndpoint(string endpointId, out StageTag stageTag)
|
||||
{
|
||||
return EndpointStageTagMap.TryGetValue(endpointId, out stageTag);
|
||||
}
|
||||
|
||||
public bool TryGetEndpoint(string endpointId, out JEndpoint endpoint)
|
||||
{
|
||||
return EndpointMap.TryGetValue(endpointId, out endpoint);
|
||||
}
|
||||
|
||||
public bool TryGetJStage(StageTag stageTag, out JStage jStage)
|
||||
{
|
||||
return StageMap.TryGetValue(stageTag, out jStage);
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Intrepid/Gameplay/Journey/Messages.meta
Normal file
3
Assets/Scripts/Intrepid/Gameplay/Journey/Messages.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d0b00b38e81042458fedcd6bca42c1da
|
||||
timeCreated: 1782140838
|
||||
@ -0,0 +1,9 @@
|
||||
using Intrepid.SimpleEvents;
|
||||
|
||||
namespace Intrepid.Gameplay.Journey.Messages.Events
|
||||
{
|
||||
public class ChangeStageEndEvent : IEventBase
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 497764573be84dfa892dfc6531b6a750
|
||||
timeCreated: 1782139580
|
||||
@ -0,0 +1,9 @@
|
||||
using Intrepid.SimpleEvents;
|
||||
|
||||
namespace Intrepid.Gameplay.Journey.Messages.Events
|
||||
{
|
||||
public class ChangeStageLandingOnStageStepEvent : IEventBase
|
||||
{
|
||||
public string DestinyEndpoint { get; set; }
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0654d29958154e3ba3e3469281fc1861
|
||||
timeCreated: 1782139865
|
||||
@ -1,6 +1,6 @@
|
||||
using Intrepid.SimpleEvents;
|
||||
|
||||
namespace Intrepid.Gameplay.Journey.Events
|
||||
namespace Intrepid.Gameplay.Journey.Messages.Events
|
||||
{
|
||||
public class ChangeStageStartEvent : IEventBase
|
||||
{
|
||||
@ -0,0 +1,10 @@
|
||||
using Intrepid.SimpleEvents;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Intrepid.Gameplay.Journey.Messages.Events
|
||||
{
|
||||
public class StageDispatchDeploymentPointEvent : IEventBase
|
||||
{
|
||||
public Vector3 DeploymentPoint { get; set; }
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8cabff0925674eca97250dff0539083b
|
||||
timeCreated: 1782153948
|
||||
@ -0,0 +1,7 @@
|
||||
namespace Intrepid.Gameplay.Journey.Messages
|
||||
{
|
||||
public class LoadJourneyRequest
|
||||
{
|
||||
public StageTag StageTag { get; set; }
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: baa828e6c92c41dcb89539145a4ffd17
|
||||
timeCreated: 1782140854
|
||||
@ -1,40 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Intrepid.Core.Camera;
|
||||
using Intrepid.Diagnostics;
|
||||
using Intrepid.FSM;
|
||||
using Intrepid.GameManagers;
|
||||
using Intrepid.Gameplay.Journey.Events;
|
||||
using Intrepid.Integration.Input;
|
||||
using Intrepid.Theatre.BackStage;
|
||||
using Intrepid.Theatre.Curtain;
|
||||
|
||||
namespace Intrepid.Gameplay.Journey
|
||||
{
|
||||
public class StageStateMachine : IBackStageProcessor
|
||||
public sealed class StageStateMachine
|
||||
{
|
||||
private FStateMachine<StageTag, StageLoadingService> StateMachine { get; } = new();
|
||||
private StageTag StageToChange { get; set; }
|
||||
private CurtainTypeTag CurtainType { get; set; }
|
||||
private BackStageService BackStageService { get; set; }
|
||||
private IBackStageWindowExecution BackStageProcessor { get; set; }
|
||||
private IState<StageTag, StageLoadingService> CurrentState => StateMachine.GetCurrentState();
|
||||
|
||||
public string Id { get; set; }
|
||||
public StageTag CurrentStageTag => CurrentState.GetStateKey();
|
||||
public bool IsLoadingFinished => CurrentState.Implementation().IsLoadingFinished;
|
||||
public bool IsRunning => StateMachine.IsRunning;
|
||||
|
||||
public StageTag CurrentStage => StateMachine.GetCurrentState().GetStateKey();
|
||||
|
||||
public void LoadMachine(
|
||||
IEnumerable<StageTag> stageTags,
|
||||
CurtainTypeTag curtainType,
|
||||
BackStageService backStageService)
|
||||
public void LoadMachine(IEnumerable<StageTag> stageTags)
|
||||
{
|
||||
if (StateMachine.IsRunning)
|
||||
{
|
||||
DLogger.LogError("stage state machine is already running (are we changing state outside JourneyManager?");
|
||||
return;
|
||||
}
|
||||
CurtainType = curtainType;
|
||||
BackStageService = backStageService;
|
||||
foreach (var stageTag in stageTags)
|
||||
{
|
||||
StateMachine.AddState(new StageLoadingService(stageTag));
|
||||
@ -48,26 +33,9 @@ namespace Intrepid.Gameplay.Journey
|
||||
StateMachine.Start();
|
||||
}
|
||||
|
||||
public void UpdateCurtains()
|
||||
public void ChangeState(StageTag stageTag)
|
||||
{
|
||||
BackStageService.UpdateCurtains();
|
||||
}
|
||||
|
||||
public void ChangeTo(
|
||||
StageTag stageTag,
|
||||
IBackStageWindowExecution backStageProcessor = null)
|
||||
{
|
||||
// if (landingPortal.IsNull() || string.IsNullOrEmpty(landingPortal.Code))
|
||||
// {
|
||||
// throw new ArgumentException("landing portal cannot be null or empty");
|
||||
// }
|
||||
if (StateMachine.GetCurrentState().GetStateKey() == stageTag) return;
|
||||
|
||||
if (BackStageService.KickProcess(CurtainType, Id, this))
|
||||
{
|
||||
StageToChange = stageTag;
|
||||
}
|
||||
BackStageProcessor = backStageProcessor;
|
||||
StateMachine.ChangeState(stageTag);
|
||||
}
|
||||
|
||||
public void TearDown()
|
||||
@ -75,37 +43,5 @@ namespace Intrepid.Gameplay.Journey
|
||||
if (!StateMachine.IsRunning) return;
|
||||
StateMachine.GetCurrentState().OnExitState();
|
||||
}
|
||||
|
||||
public bool IsProcessFinished => StateMachine.GetCurrentState().Implementation().IsLoadingFinished
|
||||
&& !CameraSystem.Instance.IsCameraBlending;
|
||||
|
||||
public void AfterOpened()
|
||||
{
|
||||
BackStageProcessor?.AfterOpened();
|
||||
InputService.Instance.ChangeInputSchema(InputSchema.Sentinel);
|
||||
}
|
||||
|
||||
public void BeforeOpening()
|
||||
{
|
||||
// Proxy.Instance.EventBus.Raise(new ChangeStageLandingOnStageStepEvent
|
||||
// {
|
||||
// LandingPortalCode = LastLandingPortalCode,
|
||||
// });
|
||||
// LastLandingPortalCode = null;
|
||||
BackStageProcessor?.BeforeOpening();
|
||||
}
|
||||
|
||||
public void AfterClosed()
|
||||
{
|
||||
Proxy.Instance.EventBus.Raise(new ChangeStageStartEvent());
|
||||
StateMachine.ChangeState(StageToChange);
|
||||
BackStageProcessor?.AfterClosed();
|
||||
}
|
||||
|
||||
public void BeforeClosing()
|
||||
{
|
||||
InputService.Instance.ChangeInputSchema(InputSchema.None);
|
||||
BackStageProcessor?.BeforeClosing();
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Intrepid/Gameplay/Journey/Stages.meta
Normal file
3
Assets/Scripts/Intrepid/Gameplay/Journey/Stages.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1f530d09e5cb49ceb525a4ea0b540014
|
||||
timeCreated: 1782147645
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cbd3083bdb524dd3ab68cefba525e3c9
|
||||
timeCreated: 1782152485
|
||||
@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using Intrepid.Utilities;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Intrepid.Gameplay.Journey.Stages.Sockets
|
||||
{
|
||||
public class StageSocket : MonoBehaviour
|
||||
{
|
||||
[GroupInjections, SerializeField] private Transform deploymentPoint;
|
||||
[GroupInjections, SerializeField] private StageSocketChangeTrigger changeTrigger;
|
||||
[GroupConfigurations, SerializeField] private string endpointId;
|
||||
|
||||
public string StageId
|
||||
{
|
||||
get => changeTrigger.StageId;
|
||||
set => changeTrigger.StageId = value;
|
||||
}
|
||||
public string EndpointId
|
||||
{
|
||||
get => endpointId;
|
||||
set => endpointId = value;
|
||||
}
|
||||
public Vector3 DeploymentPoint => deploymentPoint.position;
|
||||
|
||||
private void OnValidate()
|
||||
{
|
||||
if (changeTrigger.IsNull()) return;
|
||||
changeTrigger.EndpointId = endpointId;
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
OnValidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 06e19c5ea6de4ba2ba26ba0d99942d16
|
||||
timeCreated: 1782152501
|
||||
@ -0,0 +1,77 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Intrepid.Core.Entities;
|
||||
using Intrepid.Core.Tags;
|
||||
using Intrepid.Diagnostics;
|
||||
using Intrepid.Utilities;
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Intrepid.Gameplay.Journey.Stages.Sockets
|
||||
{
|
||||
public class StageSocketChangeTrigger : EntityTrigger
|
||||
{
|
||||
[GroupInjections, SerializeField] private JourneyService journeyService;
|
||||
[GroupDebug, SerializeField, ReadOnly] private string stageId;
|
||||
[GroupDebug, SerializeField, ReadOnly] private string endpointId;
|
||||
|
||||
private BoxCollider BoxCollider => MainCollider as BoxCollider;
|
||||
|
||||
public string StageId
|
||||
{
|
||||
get => stageId;
|
||||
set => stageId = value;
|
||||
}
|
||||
public string EndpointId
|
||||
{
|
||||
get => endpointId;
|
||||
set => endpointId = value;
|
||||
}
|
||||
|
||||
protected override void WhenRaiseEnterEvent(Collider other, EntitySensor entitySensor, List<BehaviourTag> behaviourTags)
|
||||
{
|
||||
if (!journeyService.TryGetJConnections(stageId, endpointId, out var jConnections))
|
||||
{
|
||||
DLogger.LogWarn($"Stage {stageId} has invalid endpoint: {endpointId}");
|
||||
return;
|
||||
}
|
||||
if (jConnections.Count > 1)
|
||||
{
|
||||
DLogger.LogWarn($"Stage {stageId} has multiple connections from endpoint: {endpointId}");
|
||||
return;
|
||||
}
|
||||
var destinyEndpoint = GrabDestinyEndpoint(jConnections.First());
|
||||
if (!journeyService.TryGetStageTagFromEndpoint(destinyEndpoint, out var stageTag))
|
||||
{
|
||||
DLogger.LogWarn($"Stage {stageId} has invalid endpoint: {endpointId}");
|
||||
return;
|
||||
}
|
||||
JourneyManager.Instance.ChangeStageTo(stageTag, destinyEndpoint);
|
||||
DLogger.LogDebug("stage change");
|
||||
}
|
||||
|
||||
private string GrabDestinyEndpoint(JConnection jConnection)
|
||||
{
|
||||
return endpointId.Equals(jConnection.endpointAId, StringComparison.Ordinal)
|
||||
? jConnection.endpointBId
|
||||
: jConnection.endpointAId;
|
||||
}
|
||||
|
||||
protected override void WhenRaiseExitEvent(Collider other, EntitySensor entitySensor)
|
||||
{
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
private void OnDrawGizmos()
|
||||
{
|
||||
if (BoxCollider is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Gizmos.color = Color.red;
|
||||
Gizmos.DrawWireCube(BoxCollider.bounds.center, BoxCollider.bounds.size);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3c11245659b8459cbfa73b4a882f63f8
|
||||
timeCreated: 1782147660
|
||||
@ -0,0 +1,58 @@
|
||||
using System.Collections.Generic;
|
||||
using Intrepid.Diagnostics;
|
||||
using Intrepid.GameManagers;
|
||||
using Intrepid.Gameplay.Journey.Messages.Events;
|
||||
using Intrepid.Gameplay.Journey.Stages.Sockets;
|
||||
using Intrepid.SimpleEvents;
|
||||
using Intrepid.Utilities;
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Intrepid.Gameplay.Journey.Stages
|
||||
{
|
||||
public class StageManager : EventListener
|
||||
{
|
||||
[GroupConfigurations, SerializeField] private string stageId;
|
||||
[GroupDebug, SerializeField] private List<StageSocket> sockets;
|
||||
|
||||
private Dictionary<string, StageSocket> SocketMap { get; } = new();
|
||||
|
||||
protected override void InitializeVariables()
|
||||
{
|
||||
Refresh();
|
||||
}
|
||||
|
||||
protected override void OnBootstrap()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Subscriptions()
|
||||
{
|
||||
Subscribe<ChangeStageLandingOnStageStepEvent>(e =>
|
||||
{
|
||||
if (SocketMap.TryGetValue(e.DestinyEndpoint, out var stageSocket))
|
||||
{
|
||||
Proxy.Instance.EventBus.Raise(new StageDispatchDeploymentPointEvent
|
||||
{
|
||||
DeploymentPoint = stageSocket.DeploymentPoint,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
DLogger.LogError($"No stage socket found for endpoint {e.DestinyEndpoint}");
|
||||
});
|
||||
}
|
||||
|
||||
[GroupDebug, Button(ButtonSizes.Medium)]
|
||||
private void Refresh()
|
||||
{
|
||||
sockets.Clear();
|
||||
foreach (var stageSocket in GetComponentsInChildren<StageSocket>())
|
||||
{
|
||||
stageSocket.StageId = stageId;
|
||||
sockets.Add(stageSocket);
|
||||
SocketMap.Add(stageSocket.EndpointId, stageSocket);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d328f8f221d44d379a466647b7b12719
|
||||
timeCreated: 1782153254
|
||||
Loading…
x
Reference in New Issue
Block a user