Compare commits

..

2 Commits

Author SHA1 Message Date
Nilton Constantino
1926420695
improvements on Journey 2026-06-23 09:20:04 +01:00
Nilton Constantino
a2e287b3c6
scene adjustments 2026-06-22 11:16:19 +01:00
72 changed files with 18388 additions and 22817 deletions

File diff suppressed because it is too large Load Diff

View 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: []

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 34e040e87b50c47b08f720ae05cd6be3
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -33,5 +33,40 @@ MonoBehaviour:
y: 1 y: 1
- x: 0 - x: 0
y: 1 y: 1
endpoints: [] - id: stage_bd361c8ccbe4421cab5ad85cd71d081a
connections: [] 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

View File

@ -932,11 +932,17 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 86cfe3aa96e541c8998ae79b435d04e5, type: 3} m_Script: {fileID: 11500000, guid: 86cfe3aa96e541c8998ae79b435d04e5, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
defaultCurtainType: {fileID: 0} defaultCurtainType: {fileID: 11400000, guid: d91043b858654867aaa66b20d678191d, type: 2}
starState: 2 starState: 4
containers: containers:
keyData: [] keyData:
valueData: [] - {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 --- !u!114 &4829059598325025422
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -45,6 +45,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: Assembly-CSharp::Intrepid.Core.InputManager m_EditorClassIdentifier: Assembly-CSharp::Intrepid.Core.InputManager
subscriptionId: 8f4fe12e750947b8a90870d352933eda subscriptionId: 8f4fe12e750947b8a90870d352933eda
startInputSchema: 0
--- !u!1 &6646150497353767022 --- !u!1 &6646150497353767022
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -201,7 +202,7 @@ MonoBehaviour:
manifest: {fileID: 11400000, guid: d2ff85c9d4e364f50aa65158f0b6daa2, type: 2} manifest: {fileID: 11400000, guid: d2ff85c9d4e364f50aa65158f0b6daa2, type: 2}
inputManager: {fileID: 2567165502544804230} inputManager: {fileID: 2567165502544804230}
configurationPersistenceService: {fileID: 11400000, guid: fd9dae561c8d640df9c516df6a7d3b37, type: 2} configurationPersistenceService: {fileID: 11400000, guid: fd9dae561c8d640df9c516df6a7d3b37, type: 2}
gameDataPersistenceService: {fileID: 0} gameDataPersistenceService: {fileID: 11400000, guid: 4715554a8f2cb477bbf691096f0903f9, type: 2}
gameStateMachine: {fileID: 0} gameStateMachine: {fileID: 0}
--- !u!1 &6646150498879786644 --- !u!1 &6646150498879786644
GameObject: GameObject:
@ -242,42 +243,6 @@ PrefabInstance:
serializedVersion: 3 serializedVersion: 3
m_TransformParent: {fileID: 6646150498868371415} m_TransformParent: {fileID: 6646150498868371415}
m_Modifications: 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} - target: {fileID: 3242557338744252078, guid: 60638fc6c55d48d9aa9b3889058b8af8, type: 3}
propertyPath: m_LocalPosition.x propertyPath: m_LocalPosition.x
value: 0 value: 0
@ -327,39 +292,6 @@ PrefabInstance:
m_AddedGameObjects: [] m_AddedGameObjects: []
m_AddedComponents: [] m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 60638fc6c55d48d9aa9b3889058b8af8, type: 3} 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 --- !u!114 &5732443498328172255 stripped
MonoBehaviour: MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 112904297142897738, guid: 60638fc6c55d48d9aa9b3889058b8af8, type: 3} m_CorrespondingSourceObject: {fileID: 112904297142897738, guid: 60638fc6c55d48d9aa9b3889058b8af8, type: 3}

View File

@ -0,0 +1,85 @@
%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
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2378040738592165545}
- component: {fileID: 7503967939848988478}
m_Layer: 0
m_Name: JourneyManager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2378040738592165545
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7631802331149991959}
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:
- {fileID: 2270435121348859238}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &7503967939848988478
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7631802331149991959}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: cdf542c2073144c5a39418e08512ca58, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::Intrepid.Gameplay.Journey.JourneyManager
subscriptionId: 5df34d67e6e44f3999042072ea652750
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}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 8cee629b6bf44433f98c6e28031d8f6b
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -12,10 +12,56 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: fcb661d795ed4088af4ae73e4253f98b, type: 3} m_Script: {fileID: 11500000, guid: fcb661d795ed4088af4ae73e4253f98b, type: 3}
m_Name: JGraph-Test01 m_Name: JGraph-Test01
m_EditorClassIdentifier: Assembly-CSharp::Intrepid.Gameplay.Journey.JGraphSO m_EditorClassIdentifier: Assembly-CSharp::Intrepid.Gameplay.Journey.JGraphSO
sourceWorldLayoutId: sourceWorldLayoutId: 4dac43bfd76a4286a40511c1cce4609b
publishedAt: publishedAt: 2026-06-22T11:40:47.6512990Z
schemaVersion: 1 schemaVersion: 1
contentHash: contentHash: 6224a08985c67c0cf4d2fa4c9e88bf65f4b7137966b8432ed665f62c7c99778d
stages: [] stages:
endpoints: [] - id: stage_7f2050e54c664f349472c788bb702cce
connections: [] 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

View File

@ -15,3 +15,4 @@ MonoBehaviour:
journeyGraph: {fileID: 11400000, guid: 992c85dbd199649f48a532195af83aec, type: 2} journeyGraph: {fileID: 11400000, guid: 992c85dbd199649f48a532195af83aec, type: 2}
stagesTags: stagesTags:
- {fileID: 11400000, guid: b0fc23a68ad024c30a531fc69243b2a2, type: 2} - {fileID: 11400000, guid: b0fc23a68ad024c30a531fc69243b2a2, type: 2}
- {fileID: 11400000, guid: ed5f85b3145ce4eabae9b1382f675817, type: 2}

View File

@ -0,0 +1,22 @@
%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: 6dffc02d596841ba8bb1b992c4899a5f, type: 3}
m_Name: Persistence Game Data
m_EditorClassIdentifier: Assembly-CSharp::Intrepid.Integration.Persistence.GameDataPersistenceService
extraWaiting: 1
fileHandler: {fileID: 11400000, guid: 1deed874fc4f94a079572799b9b16936, type: 2}
configurationPersistenceService: {fileID: 11400000, guid: fd9dae561c8d640df9c516df6a7d3b37, type: 2}
currentGameDataSaveFile:
fileId:
savedAt:
data:
seed:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4715554a8f2cb477bbf691096f0903f9
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,15 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ab2e7a683f584962a36a133a6ac88b4a, type: 3}
m_Name: behaviour.can-change-stage
m_EditorClassIdentifier: Assembly-CSharp::Intrepid.Core.Tags.BehaviourTag
code: behaviour.can-change-stage

View File

@ -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

View File

@ -119,7 +119,7 @@ NavMeshSettings:
debug: debug:
m_Flags: 0 m_Flags: 0
m_NavMeshData: {fileID: 0} m_NavMeshData: {fileID: 0}
--- !u!1001 &1609485360 --- !u!1001 &7036882172617140290
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
serializedVersion: 2 serializedVersion: 2
@ -127,112 +127,69 @@ PrefabInstance:
serializedVersion: 3 serializedVersion: 3
m_TransformParent: {fileID: 0} m_TransformParent: {fileID: 0}
m_Modifications: m_Modifications:
- target: {fileID: 1110237080051008694, guid: 774b83ee4bf84c4c9b531c2a6350b8a5, type: 3} - target: {fileID: 2270435121348859238, guid: 8cee629b6bf44433f98c6e28031d8f6b, type: 3}
propertyPath: m_IsActive propertyPath: m_LocalPosition.x
value: 1 value: 1
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 6646150498868371415, guid: 774b83ee4bf84c4c9b531c2a6350b8a5, type: 3} - 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 propertyPath: m_LocalPosition.x
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 6646150498868371415, guid: 774b83ee4bf84c4c9b531c2a6350b8a5, type: 3} - target: {fileID: 2378040738592165545, guid: 8cee629b6bf44433f98c6e28031d8f6b, type: 3}
propertyPath: m_LocalPosition.y propertyPath: m_LocalPosition.y
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 6646150498868371415, guid: 774b83ee4bf84c4c9b531c2a6350b8a5, type: 3} - target: {fileID: 2378040738592165545, guid: 8cee629b6bf44433f98c6e28031d8f6b, type: 3}
propertyPath: m_LocalPosition.z propertyPath: m_LocalPosition.z
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 6646150498868371415, guid: 774b83ee4bf84c4c9b531c2a6350b8a5, type: 3} - target: {fileID: 2378040738592165545, guid: 8cee629b6bf44433f98c6e28031d8f6b, type: 3}
propertyPath: m_LocalRotation.w propertyPath: m_LocalRotation.w
value: 1 value: 1
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 6646150498868371415, guid: 774b83ee4bf84c4c9b531c2a6350b8a5, type: 3} - target: {fileID: 2378040738592165545, guid: 8cee629b6bf44433f98c6e28031d8f6b, type: 3}
propertyPath: m_LocalRotation.x propertyPath: m_LocalRotation.x
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 6646150498868371415, guid: 774b83ee4bf84c4c9b531c2a6350b8a5, type: 3} - target: {fileID: 2378040738592165545, guid: 8cee629b6bf44433f98c6e28031d8f6b, type: 3}
propertyPath: m_LocalRotation.y propertyPath: m_LocalRotation.y
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 6646150498868371415, guid: 774b83ee4bf84c4c9b531c2a6350b8a5, type: 3} - target: {fileID: 2378040738592165545, guid: 8cee629b6bf44433f98c6e28031d8f6b, type: 3}
propertyPath: m_LocalRotation.z propertyPath: m_LocalRotation.z
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 6646150498868371415, guid: 774b83ee4bf84c4c9b531c2a6350b8a5, type: 3} - target: {fileID: 2378040738592165545, guid: 8cee629b6bf44433f98c6e28031d8f6b, type: 3}
propertyPath: m_LocalEulerAnglesHint.x propertyPath: m_LocalEulerAnglesHint.x
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 6646150498868371415, guid: 774b83ee4bf84c4c9b531c2a6350b8a5, type: 3} - target: {fileID: 2378040738592165545, guid: 8cee629b6bf44433f98c6e28031d8f6b, type: 3}
propertyPath: m_LocalEulerAnglesHint.y propertyPath: m_LocalEulerAnglesHint.y
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 6646150498868371415, guid: 774b83ee4bf84c4c9b531c2a6350b8a5, type: 3} - target: {fileID: 2378040738592165545, guid: 8cee629b6bf44433f98c6e28031d8f6b, type: 3}
propertyPath: m_LocalEulerAnglesHint.z propertyPath: m_LocalEulerAnglesHint.z
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 6646150498868371416, guid: 774b83ee4bf84c4c9b531c2a6350b8a5, type: 3} - target: {fileID: 7503967939848988478, guid: 8cee629b6bf44433f98c6e28031d8f6b, type: 3}
propertyPath: isRunningTest
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7631802331149991959, guid: 8cee629b6bf44433f98c6e28031d8f6b, type: 3}
propertyPath: m_Name propertyPath: m_Name
value: GameManager value: JourneyManager
objectReference: {fileID: 0} objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_RemovedGameObjects: [] m_RemovedGameObjects: []
m_AddedGameObjects: [] m_AddedGameObjects: []
m_AddedComponents: [] m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 774b83ee4bf84c4c9b531c2a6350b8a5, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 8cee629b6bf44433f98c6e28031d8f6b, type: 3}
--- !u!1 &1859111548
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1859111550}
- component: {fileID: 1859111549}
m_Layer: 0
m_Name: JourneyManager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1859111549
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1859111548}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: cdf542c2073144c5a39418e08512ca58, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::Intrepid.Gameplay.Journey.JourneyManager
subscriptionId: 5df34d67e6e44f3999042072ea652750
curtainType: {fileID: 11400000, guid: 75f7ecfc567748fc911a909ed8e68a3e, type: 2}
journeyService: {fileID: 11400000, guid: 53f1211059b4847a49bde1be4b8d166c, type: 2}
backStageService: {fileID: 11400000, guid: c58e40006278948db8d8b1f3477f83ea, type: 2}
isRunningTest: 1
stageToTest: {fileID: 11400000, guid: b0fc23a68ad024c30a531fc69243b2a2, type: 2}
--- !u!4 &1859111550
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1859111548}
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: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1660057539 &9223372036854775807 --- !u!1660057539 &9223372036854775807
SceneRoots: SceneRoots:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_Roots: m_Roots:
- {fileID: 1609485360} - {fileID: 7036882172617140290}
- {fileID: 1859111550}

View File

@ -0,0 +1,183 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 10
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 0
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 13
m_BakeOnSceneLoad: 0
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 0
m_LightmapEditorSettings:
serializedVersion: 12
m_Resolution: 2
m_BakeResolution: 40
m_AtlasSize: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_ExtractAmbientOcclusion: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 2
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 512
m_PVRBounces: 2
m_PVREnvironmentSampleCount: 256
m_PVREnvironmentReferencePointCount: 2048
m_PVRFilteringMode: 1
m_PVRDenoiserTypeDirect: 1
m_PVRDenoiserTypeIndirect: 1
m_PVRDenoiserTypeAO: 1
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVREnvironmentMIS: 1
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 1
m_PVRFilteringGaussRadiusAO: 1
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 20201, guid: 0000000000000000f000000000000000, type: 0}
m_LightingSettings: {fileID: 0}
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 3
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
buildHeightMesh: 0
maxJobWorkers: 0
preserveTilesOutsideBounds: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1001 &1755564594
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 2378040738592165545, guid: 8cee629b6bf44433f98c6e28031d8f6b, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2378040738592165545, guid: 8cee629b6bf44433f98c6e28031d8f6b, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2378040738592165545, guid: 8cee629b6bf44433f98c6e28031d8f6b, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2378040738592165545, guid: 8cee629b6bf44433f98c6e28031d8f6b, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2378040738592165545, guid: 8cee629b6bf44433f98c6e28031d8f6b, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2378040738592165545, guid: 8cee629b6bf44433f98c6e28031d8f6b, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2378040738592165545, guid: 8cee629b6bf44433f98c6e28031d8f6b, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2378040738592165545, guid: 8cee629b6bf44433f98c6e28031d8f6b, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2378040738592165545, guid: 8cee629b6bf44433f98c6e28031d8f6b, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2378040738592165545, guid: 8cee629b6bf44433f98c6e28031d8f6b, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7631802331149991959, guid: 8cee629b6bf44433f98c6e28031d8f6b, type: 3}
propertyPath: m_Name
value: JourneyManager
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 8cee629b6bf44433f98c6e28031d8f6b, type: 3}
--- !u!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0
m_Roots:
- {fileID: 1755564594}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: dad7814484f1f4cf092e25da270e6d7b
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -13,5 +13,5 @@ MonoBehaviour:
m_Name: Stage 1 m_Name: Stage 1
m_EditorClassIdentifier: Assembly-CSharp::Intrepid.Gameplay.Journey.StageTag m_EditorClassIdentifier: Assembly-CSharp::Intrepid.Gameplay.Journey.StageTag
code: Stage 1 code: Stage 1
stageId: stageId: stage_7f2050e54c664f349472c788bb702cce
localization: {fileID: 0} localization: {fileID: 0}

File diff suppressed because one or more lines are too long

View 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}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ed5f85b3145ce4eabae9b1382f675817
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 10ec588ad628146c7937abc5d4a4e656
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -15,15 +15,14 @@ namespace Editor.GON.StageEditor.Baker
public static GameObject Bake(StageDefinition stage, PrefabTable prefabTable) public static GameObject Bake(StageDefinition stage, PrefabTable prefabTable)
{ {
if (stage.IsNull())
{
DLogger.LogWarn("Cannot bake: no StageDefinition selected.");
return null;
}
stage.EnsureDefaults(); 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); var generatedRoot = EnsureGeneratedRoot(scene);
Undo.RegisterCreatedObjectUndo(generatedRoot, "Create Generated Root"); Undo.RegisterCreatedObjectUndo(generatedRoot, "Create Generated Root");
var stageRoot = EnsureStageRoot(stage, generatedRoot); var stageRoot = EnsureStageRoot(stage, generatedRoot);
@ -36,7 +35,16 @@ namespace Editor.GON.StageEditor.Baker
Undo.RegisterCreatedObjectUndo(stageRoot, "Create Stage Root"); Undo.RegisterCreatedObjectUndo(stageRoot, "Create Stage Root");
EditorSceneManager.MarkSceneDirty(scene); EditorSceneManager.MarkSceneDirty(scene);
Selection.activeGameObject = stageRoot; 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."); DLogger.LogDebug($"Bake started for stage '{stage.Id}'. State root is ready.");
return stageRoot; return stageRoot;

View File

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Intrepid.Diagnostics; using Intrepid.Diagnostics;
using Intrepid.Gameplay.Flooring;
using Intrepid.Gameplay.Prototyping; using Intrepid.Gameplay.Prototyping;
using Temporary; using Temporary;
using UnityEditor; using UnityEditor;

View File

@ -56,6 +56,7 @@ namespace Editor.GON.StageEditor
public float cellSize = 1f; public float cellSize = 1f;
public float floorHeight = 6f; public float floorHeight = 6f;
public int activeFloorIndex; public int activeFloorIndex;
public StageTag stageTag;
public StageWorldSyncData worldSync = new(); public StageWorldSyncData worldSync = new();

View File

@ -378,6 +378,17 @@ namespace Editor.GON.StageEditor
return; return;
} }
if (stage.stageTag.IsNull())
{
EditorUtility.DisplayDialog(
"Bake Stage",
"Select StageTag to the stage before baking.",
"OK"
);
return;
}
if (prefabTable is null) if (prefabTable is null)
{ {
EditorUtility.DisplayDialog( EditorUtility.DisplayDialog(

View File

@ -19,7 +19,9 @@ namespace Intrepid.Core.Camera
public float NormalAngle => mainCamera.transform.rotation.eulerAngles.z; public float NormalAngle => mainCamera.transform.rotation.eulerAngles.z;
public UnityEngine.Camera MainCamera => mainCamera; public UnityEngine.Camera MainCamera => mainCamera;
public CameraBoundaryManager CameraBoundaryManager => cameraBoundaryManager; 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() protected override void InitializeVariables()
{ {
@ -50,13 +52,13 @@ namespace Intrepid.Core.Camera
CurrentCameraStreamStack?.TopCameraStream?.CameraUpdate(CurrentCameraStreamStack?.TopCameraStream); CurrentCameraStreamStack?.TopCameraStream?.CameraUpdate(CurrentCameraStreamStack?.TopCameraStream);
} }
public void ForceFocusOn(Vector2 position) public void ForceFocusOn(Vector3 position)
{ {
if (IsBlendClearing) return; if (IsBlendClearing) return;
StartCoroutine(StraightMoveCameraPosition(position)); StartCoroutine(StraightMoveCameraPosition(position));
} }
private IEnumerator StraightMoveCameraPosition(Vector2 position) private IEnumerator StraightMoveCameraPosition(Vector3 position)
{ {
IsBlendClearing = true; IsBlendClearing = true;
@ -67,13 +69,14 @@ namespace Intrepid.Core.Camera
yield return null; yield return null;
mainCamera.transform.position = AdaptCameraPosition(position, mainCamera.transform.position); mainCamera.transform.position = position;
cinemachineBrain.transform.position = AdaptCameraPosition(position, mainCamera.transform.position); cinemachineBrain.transform.position = position;
if (CurrentCameraStreamStack is not null) 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); CurrentCameraStreamStack?.TopCameraStream.VCamera.gameObject.SetActive(true);
cinemachineBrain.enabled = true; cinemachineBrain.enabled = true;
@ -82,11 +85,6 @@ namespace Intrepid.Core.Camera
IsBlendClearing = false; IsBlendClearing = false;
} }
private static Vector3 AdaptCameraPosition(Vector2 position, Vector3 oldPosition)
{
return new Vector3(position.x, position.y, oldPosition.z);
}
public Vector2 ScreenToWorldPoint(Vector2 screenPoint) public Vector2 ScreenToWorldPoint(Vector2 screenPoint)
{ {
return mainCamera.ScreenToWorldPoint(screenPoint); return mainCamera.ScreenToWorldPoint(screenPoint);

View File

@ -9,7 +9,6 @@ namespace Intrepid.Core.Camera
{ {
public sealed class CameraZoomManager : EventListener public sealed class CameraZoomManager : EventListener
{ {
[GroupConfigurations, SerializeField] private float startOrthographicSize = 12f;
[GroupConfigurations, SerializeField] private float startZoomSmoothTime = 1f; [GroupConfigurations, SerializeField] private float startZoomSmoothTime = 1f;
[GroupConfigurations, SerializeField] private float defaultOrthographicSize = 7f; [GroupConfigurations, SerializeField] private float defaultOrthographicSize = 7f;
@ -30,23 +29,14 @@ namespace Intrepid.Core.Camera
protected override void OnBootstrap() 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() protected override void Subscriptions()
{ {
Subscribe<CameraZoomEvent>(OnCameraZoomEvent); Subscribe<CameraZoomEvent>(e =>
} {
SetZoomLevel(e.ZoomLevel, e.ZoomVelocity);
private void OnCameraZoomEvent(CameraZoomEvent e) });
{
SetZoomLevel(e.ZoomLevel, e.ZoomVelocity);
} }
[GroupDebug, Button(ButtonSizes.Medium, ButtonStyle.FoldoutButton)] [GroupDebug, Button(ButtonSizes.Medium, ButtonStyle.FoldoutButton)]

View File

@ -69,7 +69,7 @@ namespace Intrepid.Core.Entities
return !ShouldBeTriggered(entities, physicsTags); return !ShouldBeTriggered(entities, physicsTags);
} }
public abstract void DeployEntity(Vector2 position); public abstract void DeployEntity(Vector3 position);
public abstract void RetreatEntity(); public abstract void RetreatEntity();
} }
} }

View File

@ -25,30 +25,15 @@ namespace Intrepid.Core.Entities
private float fadeDuration; private float fadeDuration;
private float fadeElapsed; private float fadeElapsed;
public bool IsCurrent(AnimationClip clip) private float currentSpeed = 1f;
{ private float nextSpeed = 1f;
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);
}
public AnimationClip CurrentClip { get; private set; } public AnimationClip CurrentClip { get; private set; }
public bool IsFading { get; private set; } public bool IsFading { get; private set; }
public bool IsPaused { get; private set; }
public bool IsValid => currentPlayable.IsValid(); public bool IsValid => currentPlayable.IsValid();
public float Time public float Time
@ -92,7 +77,7 @@ namespace Intrepid.Core.Entities
} }
} }
// Take consideration Looping // Takes looping into consideration.
public bool IsFinished public bool IsFinished
{ {
get get
@ -127,66 +112,17 @@ namespace Intrepid.Core.Entities
graph.Play(); 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() private void Update()
{ {
if (!IsFading) return; if (IsPaused)
{
return;
}
if (!IsFading)
{
return;
}
fadeElapsed += UnityEngine.Time.deltaTime; 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; public bool IsFadingTo(AnimationClip clip)
CurrentClip = nextClip; {
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; nextClip = null;
mixer.SetInputWeight(currentInput, 0f); currentSpeed = speed;
mixer.SetInputWeight(nextInput, 1f); 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; 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() public void Stop()
@ -230,11 +291,47 @@ namespace Intrepid.Core.Entities
CurrentClip = null; CurrentClip = null;
nextClip = 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; IsFading = false;
} }
private void ClearInput(int input) private void ClearInput(int input)
{ {
if (!mixer.IsValid())
{
return;
}
var playable = mixer.GetInput(input); var playable = mixer.GetInput(input);
if (playable.IsValid()) if (playable.IsValid())

View File

@ -1,11 +1,15 @@
using System; using System;
using System.Linq; using System.Linq;
using Intrepid.Core.Camera;
using Intrepid.Core.Entities; using Intrepid.Core.Entities;
using Intrepid.Core.Entities.Messages; using Intrepid.Core.Entities.Messages;
using Intrepid.Core.TimeControl; using Intrepid.Core.TimeControl;
using Intrepid.GameManagers;
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.Cadence;
using Intrepid.Gameplay.Entities.Player.Sentinel.StateMachine; using Intrepid.Gameplay.Entities.Player.Sentinel.StateMachine;
using Intrepid.Gameplay.Flooring.Events;
using Intrepid.Gameplay.Journey.Messages.Events;
using Intrepid.Structures; using Intrepid.Structures;
using Intrepid.Utilities; using Intrepid.Utilities;
using UnityEngine; using UnityEngine;
@ -31,6 +35,7 @@ namespace Intrepid.Gameplay.Entities.Player.Sentinel
public ActionBeltManager ActionBeltManager => actionBeltManager; public ActionBeltManager ActionBeltManager => actionBeltManager;
public Cadences Cadences => cadences; public Cadences Cadences => cadences;
public static bool IsCoreStable => !CoreStabilityService.Instance.IsCollapsed; public static bool IsCoreStable => !CoreStabilityService.Instance.IsCollapsed;
public bool IsEnabled { get; private set; }
protected override void InitializeVariables() protected override void InitializeVariables()
{ {
@ -44,7 +49,7 @@ namespace Intrepid.Gameplay.Entities.Player.Sentinel
protected override void OnBootstrap() protected override void OnBootstrap()
{ {
StateMachine.StartMachine(); StateMachine.StartMachine();
ResetBrain(); IsEnabled = false;
} }
protected override void Subscriptions() protected override void Subscriptions()
@ -60,14 +65,29 @@ namespace Intrepid.Gameplay.Entities.Player.Sentinel
if (CurrentState == SentinelStateType.Fall) return; if (CurrentState == SentinelStateType.Fall) return;
StateMachine.ChangeState(SentinelStateType.Fall); StateMachine.ChangeState(SentinelStateType.Fall);
}); });
} Subscribe<ChangeStageStartEvent>(e =>
{
public void ResetBrain() 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() public override void UpdateFromUpdatable()
{ {
if (!IsEnabled) return;
StateMachine.UpdateStateMachine(); StateMachine.UpdateStateMachine();
InputResolver.Sentinel.CaptureAndPrune(TimeSimulation.Instance.ScaledElapsedTime); InputResolver.Sentinel.CaptureAndPrune(TimeSimulation.Instance.ScaledElapsedTime);
@ -94,11 +114,15 @@ namespace Intrepid.Gameplay.Entities.Player.Sentinel
public override void LateUpdateFromUpdatable() public override void LateUpdateFromUpdatable()
{ {
if (!IsEnabled) return;
StateMachine.CurrentImplementation.RunOnLateUpdate(); StateMachine.CurrentImplementation.RunOnLateUpdate();
} }
public override void FixedUpdateFromUpdatable() public override void FixedUpdateFromUpdatable()
{ {
if (!IsEnabled) return;
StateMachine.CurrentImplementation.RunOnFixedUpdate(); StateMachine.CurrentImplementation.RunOnFixedUpdate();
} }

View File

@ -1,6 +1,7 @@
using Intrepid.Core.Entities; using Intrepid.Core.Entities;
using Intrepid.Core.Grounding; using Intrepid.Core.Grounding;
using Intrepid.GameManagers; using Intrepid.GameManagers;
using Intrepid.Gameplay.Flooring;
using Intrepid.Gameplay.Messages.Events; using Intrepid.Gameplay.Messages.Events;
using Intrepid.Utilities; using Intrepid.Utilities;
using UnityEngine; using UnityEngine;
@ -10,8 +11,10 @@ namespace Intrepid.Gameplay.Entities.Player.Sentinel
public class SentinelEntity : Entity public class SentinelEntity : Entity
{ {
[GroupInjections, SerializeField] private Rigidbody unityRigidbody; [GroupInjections, SerializeField] private Rigidbody unityRigidbody;
[GroupInjections, SerializeField] private CapsuleCollider capsuleCollider;
[GroupInjections, SerializeField] private Transform modelTransform; [GroupInjections, SerializeField] private Transform modelTransform;
[GroupInjections, SerializeField] private EntityModelAnimation modelAnimation; [GroupInjections, SerializeField] private EntityModelAnimation modelAnimation;
[GroupInjections, SerializeField] private FloorDetection floorDetection;
[GroupInjections, SerializeField] private EntityMotorSmoothRotation motorSmoothRotation; [GroupInjections, SerializeField] private EntityMotorSmoothRotation motorSmoothRotation;
[GroupInjections, SerializeField] private EntityMotorPhysicsContact motorPhysicsContact; [GroupInjections, SerializeField] private EntityMotorPhysicsContact motorPhysicsContact;
[GroupInjections, SerializeField] private EntityMotorTopDown motorTopDown; [GroupInjections, SerializeField] private EntityMotorTopDown motorTopDown;
@ -21,6 +24,7 @@ namespace Intrepid.Gameplay.Entities.Player.Sentinel
protected SentinelBrain Brain => EntityBrain as SentinelBrain; protected SentinelBrain Brain => EntityBrain as SentinelBrain;
private Rigidbody UnityRigidbody => unityRigidbody; private Rigidbody UnityRigidbody => unityRigidbody;
private CapsuleCollider CapsuleCollider => capsuleCollider;
// private EntityMotorSmoothRotation MotorSmoothRotation => motorSmoothRotation; // private EntityMotorSmoothRotation MotorSmoothRotation => motorSmoothRotation;
private EntityMotorPhysicsContact MotorPhysicsContact => motorPhysicsContact; private EntityMotorPhysicsContact MotorPhysicsContact => motorPhysicsContact;
private EntityMotorTopDown MotorTopDown => motorTopDown; 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 Vector2 Forward => new Vector2(_desiredForward.x, _desiredForward.z).normalized;
public bool IsGrounded => MotorTopDown.IsGrounded; public bool IsGrounded => MotorTopDown.IsGrounded;
public GroundProfiles CurrentGroundProfiles => MotorTopDown.CurrentGroundProfiles; 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(); RefreshMovementNormal();
} }
public override void RetreatEntity() public override void RetreatEntity()
{ {
UnityRigidbody.isKinematic = true;
CapsuleCollider.enabled = false;
MotorTopDown.enabled = false;
MotorPhysicsContact.enabled = false;
} }
public void ChangeOrientation(Vector2 direction) public void ChangeOrientation(Vector2 direction)
@ -58,6 +73,8 @@ namespace Intrepid.Gameplay.Entities.Player.Sentinel
public override void UpdateFromUpdatable() public override void UpdateFromUpdatable()
{ {
if (!Brain.IsEnabled) return;
modelTransform.rotation = Quaternion.LookRotation(_desiredForward, Vector3.up); modelTransform.rotation = Quaternion.LookRotation(_desiredForward, Vector3.up);
//MotorSmoothRotation.TurnModel(modelTransform, _desiredForward); //MotorSmoothRotation.TurnModel(modelTransform, _desiredForward);
base.UpdateFromUpdatable(); base.UpdateFromUpdatable();
@ -65,6 +82,8 @@ namespace Intrepid.Gameplay.Entities.Player.Sentinel
public override void FixedUpdateFromUpdatable() public override void FixedUpdateFromUpdatable()
{ {
if (!Brain.IsEnabled) return;
base.FixedUpdateFromUpdatable(); base.FixedUpdateFromUpdatable();
_intendedDesiredVelocity = new Vector3(DesiredVelocity.x, 0, DesiredVelocity.y); _intendedDesiredVelocity = new Vector3(DesiredVelocity.x, 0, DesiredVelocity.y);
LinearVelocity = MotorPhysicsContact.AdjustVelocityByContacts(DesiredVelocity); LinearVelocity = MotorPhysicsContact.AdjustVelocityByContacts(DesiredVelocity);
@ -77,12 +96,16 @@ namespace Intrepid.Gameplay.Entities.Player.Sentinel
private void OnCollisionEnter(Collision collision) private void OnCollisionEnter(Collision collision)
{ {
if (!Brain.IsEnabled) return;
MotorPhysicsContact.RegisterCollisionContacts(collision, MotorTopDown.MaxSlopeAngle); MotorPhysicsContact.RegisterCollisionContacts(collision, MotorTopDown.MaxSlopeAngle);
TryRaiseImpact(LinearVelocity); TryRaiseImpact(LinearVelocity);
} }
private void OnCollisionStay(Collision collision) private void OnCollisionStay(Collision collision)
{ {
if (!Brain.IsEnabled) return;
MotorPhysicsContact.RegisterCollisionContacts(collision, MotorTopDown.MaxSlopeAngle); MotorPhysicsContact.RegisterCollisionContacts(collision, MotorTopDown.MaxSlopeAngle);
TryRaiseImpact(_intendedDesiredVelocity); TryRaiseImpact(_intendedDesiredVelocity);
} }

View File

@ -2,7 +2,8 @@ namespace Intrepid.Gameplay.Entities.Player.Sentinel
{ {
public enum SentinelStateType public enum SentinelStateType
{ {
None = 0, Nop = 0,
PDA = 1, PDA = 1,
Idle = 10, Idle = 10,

View File

@ -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()
{
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: f244623cb1824165863f6e8188bf6256
timeCreated: 1782145081

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 01c2d3509e324acda2c81bfd5e02a51c
timeCreated: 1782138594

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: fe589b126c0b4221855565880d361022
timeCreated: 1782138616

View File

@ -0,0 +1,9 @@
using Intrepid.SimpleEvents;
namespace Intrepid.Gameplay.Flooring.Events
{
public class EmitFloorDetectionEvent : IEventBase
{
public FloorDetection FloorDetection { get; set; }
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: a46794442c784ad383b0df8760873039
timeCreated: 1782138639

View File

@ -2,7 +2,7 @@ using Intrepid.Utilities;
using Sirenix.OdinInspector; using Sirenix.OdinInspector;
using UnityEngine; using UnityEngine;
namespace Temporary namespace Intrepid.Gameplay.Flooring
{ {
public class FloorDetection : MonoBehaviour public class FloorDetection : MonoBehaviour
{ {

View File

@ -1,12 +1,14 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Intrepid.Gameplay.Flooring.Events;
using Intrepid.SimpleEvents;
using Intrepid.Utilities; using Intrepid.Utilities;
using Sirenix.OdinInspector; using Sirenix.OdinInspector;
using UnityEngine; 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 DisabledUpperThreshold = 1_000_000f;
private const float DisabledUpperMax = 1_000_001f; private const float DisabledUpperMax = 1_000_001f;
@ -14,31 +16,36 @@ namespace Temporary
private const float DisabledLowerThreshold = -1_000_000f; private const float DisabledLowerThreshold = -1_000_000f;
private const float DisabledLowerMin = -1_000_001f; 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 upperMax = 5.5f;
[GroupConfigurations("Upper Fade"), SerializeField] private float upperThreshold = 3f; [GroupConfigurations("Upper Fade"), SerializeField] private float upperThreshold = 5.2f;
[GroupConfigurations("Lower Tint"), SerializeField] private float lowerThreshold = -3f; [GroupConfigurations("Lower Tint"), SerializeField] private float lowerThreshold = -1.5f;
[GroupConfigurations("Lower Tint"), SerializeField] private float lowerMin = -6f; [GroupConfigurations("Lower Tint"), SerializeField] private float lowerMin = -9f;
[GroupConfigurations("Lower Tint"), SerializeField] private Color lowerTintColor = new(0.35f, 0.35f, 0.35f, 1f); [GroupConfigurations("Lower Tint"), SerializeField] private Color lowerTintColor = new(0.35f, 0.35f, 0.35f, 1f);
private List<FloorVisualGroup> FloorVisualGroups { get; } = new(); private List<FloorVisualGroup> FloorVisualGroups { get; } = new();
private void Awake() protected override void InitializeVariables()
{ {
SingletonInstantiation(false, manager => DetectFloorVisualGroups();
{
manager.DetectFloorVisualGroups();
});
} }
private void Start() protected override void OnBootstrap()
{ {
ApplyVisibility(); ApplyVisibility();
} }
protected override void Subscriptions()
{
Subscribe<EmitFloorDetectionEvent>(e =>
{
floorDetection = e.FloorDetection;
});
}
private void Update() private void Update()
{ {
ApplyVisibility(); ApplyVisibility();

View File

@ -4,7 +4,7 @@ using Intrepid.Utilities;
using Sirenix.OdinInspector; using Sirenix.OdinInspector;
using UnityEngine; using UnityEngine;
namespace Temporary namespace Intrepid.Gameplay.Flooring
{ {
public struct VisibilityRequest public struct VisibilityRequest
{ {

View File

@ -1,7 +1,11 @@
using System; using System;
using System.Collections; using System.Collections;
using Intrepid.Core.Camera;
using Intrepid.Diagnostics; using Intrepid.Diagnostics;
using Intrepid.GameManagers; using Intrepid.GameManagers;
using Intrepid.Gameplay.Journey.Messages;
using Intrepid.Gameplay.Journey.Messages.Events;
using Intrepid.Integration.Input;
using Intrepid.SimpleEvents; using Intrepid.SimpleEvents;
using Intrepid.Theatre.BackStage; using Intrepid.Theatre.BackStage;
using Intrepid.Theatre.Curtain; using Intrepid.Theatre.Curtain;
@ -11,29 +15,39 @@ using UnityEngine;
namespace Intrepid.Gameplay.Journey 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; [GroupConfigurations, SerializeField] private CurtainTypeTag curtainType;
[GroupInjections, SerializeField] private JourneyService journeyService; [GroupInjections, SerializeField] private JourneyService journeyService;
[GroupInjections, SerializeField] private BackStageService backStageService; [GroupInjections, SerializeField] private BackStageService backStageService;
#if UNITY_EDITOR #if UNITY_EDITOR
[GroupDebug, SerializeField, ToggleLeft] private bool isRunningTest; [GroupDebug, SerializeField, ToggleLeft] private bool isRunningTest;
[GroupDebug, SerializeField, ShowIf("IsRunningTest")] private StageTag stageToTest; [GroupDebug, SerializeField, ShowIf("IsRunningTest")] private StageTag stageToTest;
[GroupDebug, SerializeField, ShowIf("IsRunningTest")] private Transform landingStart;
#endif #endif
private StageStateMachine StageStateMachine { get; } = new();
private CurtainTypeTag CurtainType => curtainType;
private BackStageService BackStageService => backStageService;
private JourneyService JourneyService => journeyService;
#if UNITY_EDITOR #if UNITY_EDITOR
private bool IsRunningTest => isRunningTest; private bool IsRunningTest => isRunningTest;
#endif #endif
private JourneyService JourneyService => journeyService; private StageTag StageToChange { get; set; }
private StageStateMachine StageStateMachine { get; } = new(); private IBackStageWindowExecution CallbackProcessors { get; set; }
private StageTag StageToStartJourney { 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() protected override void InitializeVariables()
{ {
SingletonInstantiation(false, manager => SingletonInstantiation(false, manager =>
{ {
var stageTags = manager.JourneyService.Initialize(); 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 UNITY_EDITOR
if (IsRunningTest && stageToTest.IsNotNull()) if (IsRunningTest && stageToTest.IsNotNull())
{ {
JourneyStartForTesting(stageToTest); LoadJourneyForTesting(stageToTest, landingStart);
} }
else
{
JourneyStart();
}
#else
JourneyStart();
#endif #endif
} }
@ -59,7 +67,7 @@ namespace Intrepid.Gameplay.Journey
private void Update() private void Update()
{ {
StageStateMachine.UpdateCurtains(); BackStageService.UpdateCurtains();
} }
protected override void OnTearDown() protected override void OnTearDown()
@ -67,43 +75,53 @@ namespace Intrepid.Gameplay.Journey
StageStateMachine.TearDown(); 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; StageStateMachine.InitMachine(request.StageTag);
}
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);
} }
[GroupDebug, Button(ButtonSizes.Large, ButtonStyle.FoldoutButton)] [GroupDebug, Button(ButtonSizes.Large, ButtonStyle.FoldoutButton)]
private void JourneyStartForTesting(StageTag stage) private void LoadJourneyForTesting(StageTag stage, Transform landing)
{ {
JourneyStart(stage); LoadJourney(new LoadJourneyRequest
StartCoroutine(OpenAfter2Secs()); {
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); 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 UNITY_EDITOR
if (IsRunningTest) if (IsRunningTest)
@ -112,7 +130,49 @@ namespace Intrepid.Gameplay.Journey
return; return;
} }
#endif #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();
} }
} }
} }

View File

@ -1,6 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using Intrepid.Diagnostics; using Intrepid.Diagnostics;
using Intrepid.Utilities; using Intrepid.Utilities;
using Sirenix.OdinInspector; using Sirenix.OdinInspector;
@ -15,25 +14,43 @@ namespace Intrepid.Gameplay.Journey
[CreateAssetMenu(fileName = "Journey Service", menuName = "GON/Services/Journey Service")] [CreateAssetMenu(fileName = "Journey Service", menuName = "GON/Services/Journey Service")]
public class JourneyService : ScriptableObject public class JourneyService : ScriptableObject
{ {
[GroupInjections, SerializeField] private JGraphSO journeyGraph; [GroupInjections, SerializeField]
private JGraphSO journeyGraph;
[GroupInjections, SerializeField, ReadOnly, ListDrawerSettings(ShowFoldout = false)] [GroupInjections, SerializeField, ReadOnly, ListDrawerSettings(ShowFoldout = false)]
private List<StageTag> stagesTags; private List<StageTag> stagesTags = new();
private Dictionary<StageTag, JStage> StageMap { get; } = 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 #if UNITY_EDITOR
[PropertyOrder(-10)] [PropertyOrder(-10)]
[GroupInjections, Button(ButtonSizes.Large), GUIColor(0.35f, 0.8f, .35f)] [GroupInjections, Button(ButtonSizes.Large), GUIColor(0.35f, 0.8f, .35f)]
protected void FindAllStageTags() protected void FindAllStageTags()
{ {
stagesTags ??= new();
stagesTags.Clear(); stagesTags.Clear();
var guids = AssetDatabase.FindAssets($"t:StageTag");
var guids = AssetDatabase.FindAssets("t:StageTag");
foreach (var guid in guids) foreach (var guid in guids)
{ {
var path = AssetDatabase.GUIDToAssetPath(guid); var path = AssetDatabase.GUIDToAssetPath(guid);
var stage = AssetDatabase.LoadAssetAtPath<StageTag>(path); var stageTag = AssetDatabase.LoadAssetAtPath<StageTag>(path);
stagesTags.Add(stage);
if (stageTag.IsNull())
{
continue;
}
stagesTags.Add(stageTag);
} }
EditorUtility.SetDirty(this); EditorUtility.SetDirty(this);
@ -55,15 +72,16 @@ namespace Intrepid.Gameplay.Journey
return; return;
} }
// check if every stage in the graph has a stage tag associated. var stageTagMap = BuildStageTagMap();
var map = stagesTags.ToDictionary(stageTag => stageTag.StageId);
foreach (var jStage in journeyGraph.stages) 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"); DLogger.LogDebug($"Stage {jStage.id} is not found in the stage tag list");
continue; continue;
} }
tag.TestIfExists(); tag.TestIfExists();
} }
} }
@ -75,20 +93,186 @@ namespace Intrepid.Gameplay.Journey
throw new NullReferenceException($"{nameof(journeyGraph)} should not be null or empty"); 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) 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 else
{ {
DLogger.LogWarn($"Stage {jStage.id} is not found in the stage tag list"); 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);
} }
} }
} }

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: d0b00b38e81042458fedcd6bca42c1da
timeCreated: 1782140838

View File

@ -0,0 +1,9 @@
using Intrepid.SimpleEvents;
namespace Intrepid.Gameplay.Journey.Messages.Events
{
public class ChangeStageEndEvent : IEventBase
{
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 497764573be84dfa892dfc6531b6a750
timeCreated: 1782139580

View File

@ -0,0 +1,9 @@
using Intrepid.SimpleEvents;
namespace Intrepid.Gameplay.Journey.Messages.Events
{
public class ChangeStageLandingOnStageStepEvent : IEventBase
{
public string DestinyEndpoint { get; set; }
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 0654d29958154e3ba3e3469281fc1861
timeCreated: 1782139865

View File

@ -1,6 +1,6 @@
using Intrepid.SimpleEvents; using Intrepid.SimpleEvents;
namespace Intrepid.Gameplay.Journey.Events namespace Intrepid.Gameplay.Journey.Messages.Events
{ {
public class ChangeStageStartEvent : IEventBase public class ChangeStageStartEvent : IEventBase
{ {

View File

@ -0,0 +1,10 @@
using Intrepid.SimpleEvents;
using UnityEngine;
namespace Intrepid.Gameplay.Journey.Messages.Events
{
public class StageDispatchDeploymentPointEvent : IEventBase
{
public Vector3 DeploymentPoint { get; set; }
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 8cabff0925674eca97250dff0539083b
timeCreated: 1782153948

View File

@ -0,0 +1,7 @@
namespace Intrepid.Gameplay.Journey.Messages
{
public class LoadJourneyRequest
{
public StageTag StageTag { get; set; }
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: baa828e6c92c41dcb89539145a4ffd17
timeCreated: 1782140854

View File

@ -1,40 +1,25 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using Intrepid.Core.Camera;
using Intrepid.Diagnostics; using Intrepid.Diagnostics;
using Intrepid.FSM; 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 namespace Intrepid.Gameplay.Journey
{ {
public class StageStateMachine : IBackStageProcessor public sealed class StageStateMachine
{ {
private FStateMachine<StageTag, StageLoadingService> StateMachine { get; } = new(); private FStateMachine<StageTag, StageLoadingService> StateMachine { get; } = new();
private StageTag StageToChange { get; set; } private IState<StageTag, StageLoadingService> CurrentState => StateMachine.GetCurrentState();
private CurtainTypeTag CurtainType { get; set; }
private BackStageService BackStageService { get; set; }
private IBackStageWindowExecution BackStageProcessor { get; set; }
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)
public void LoadMachine(
IEnumerable<StageTag> stageTags,
CurtainTypeTag curtainType,
BackStageService backStageService)
{ {
if (StateMachine.IsRunning) if (StateMachine.IsRunning)
{ {
DLogger.LogError("stage state machine is already running (are we changing state outside JourneyManager?"); DLogger.LogError("stage state machine is already running (are we changing state outside JourneyManager?");
return; return;
} }
CurtainType = curtainType;
BackStageService = backStageService;
foreach (var stageTag in stageTags) foreach (var stageTag in stageTags)
{ {
StateMachine.AddState(new StageLoadingService(stageTag)); StateMachine.AddState(new StageLoadingService(stageTag));
@ -48,26 +33,9 @@ namespace Intrepid.Gameplay.Journey
StateMachine.Start(); StateMachine.Start();
} }
public void UpdateCurtains() public void ChangeState(StageTag stageTag)
{ {
BackStageService.UpdateCurtains(); StateMachine.ChangeState(stageTag);
}
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;
} }
public void TearDown() public void TearDown()
@ -75,37 +43,5 @@ namespace Intrepid.Gameplay.Journey
if (!StateMachine.IsRunning) return; if (!StateMachine.IsRunning) return;
StateMachine.GetCurrentState().OnExitState(); 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();
}
} }
} }

View File

@ -7,7 +7,7 @@ using UnityEngine;
namespace Intrepid.Gameplay.Journey namespace Intrepid.Gameplay.Journey
{ {
[Serializable] [Serializable]
[CreateAssetMenu(fileName = "Stage Tag", menuName = "GON/Tag/Stage Tag")] [CreateAssetMenu(fileName = "Stage Tag", menuName = "GON/Tags/Stage Tag")]
public class StageTag : SceneTag public class StageTag : SceneTag
{ {
[GroupConfigurations, SerializeField] private string stageId; [GroupConfigurations, SerializeField] private string stageId;

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 1f530d09e5cb49ceb525a4ea0b540014
timeCreated: 1782147645

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: cbd3083bdb524dd3ab68cefba525e3c9
timeCreated: 1782152485

View File

@ -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();
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 06e19c5ea6de4ba2ba26ba0d99942d16
timeCreated: 1782152501

View File

@ -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
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 3c11245659b8459cbfa73b4a882f63f8
timeCreated: 1782147660

View File

@ -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);
}
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: d328f8f221d44d379a466647b7b12719
timeCreated: 1782153254

View File

@ -5,7 +5,7 @@
"depth": 0, "depth": 0,
"source": "git", "source": "git",
"dependencies": {}, "dependencies": {},
"hash": "70ff157eeecf2ff71b1ce2e1ff089f279d75507e" "hash": "be2ea033f2bea17b65f158f686a54458e8cd9606"
}, },
"com.unity.2d.animation": { "com.unity.2d.animation": {
"version": "13.0.5", "version": "13.0.5",