shalliwell
5 years ago
398 changed files with 59424 additions and 9437 deletions
@ -0,0 +1,434 @@ |
|||||||
|
%YAML 1.1 |
||||||
|
%TAG !u! tag:unity3d.com,2011: |
||||||
|
--- !u!1 &3892339027384508655 |
||||||
|
GameObject: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
serializedVersion: 6 |
||||||
|
m_Component: |
||||||
|
- component: {fileID: 3892339027384508654} |
||||||
|
- component: {fileID: 3892339027384508652} |
||||||
|
- component: {fileID: 3892339027384508653} |
||||||
|
m_Layer: 5 |
||||||
|
m_Name: Background |
||||||
|
m_TagString: Untagged |
||||||
|
m_Icon: {fileID: 0} |
||||||
|
m_NavMeshLayer: 0 |
||||||
|
m_StaticEditorFlags: 0 |
||||||
|
m_IsActive: 1 |
||||||
|
--- !u!224 &3892339027384508654 |
||||||
|
RectTransform: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 3892339027384508655} |
||||||
|
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_Children: [] |
||||||
|
m_Father: {fileID: 3892339028978780123} |
||||||
|
m_RootOrder: 0 |
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
||||||
|
m_AnchorMin: {x: 0, y: 0} |
||||||
|
m_AnchorMax: {x: 1, y: 1} |
||||||
|
m_AnchoredPosition: {x: 0, y: 0} |
||||||
|
m_SizeDelta: {x: 0, y: 0} |
||||||
|
m_Pivot: {x: 0.5, y: 0.5} |
||||||
|
--- !u!222 &3892339027384508652 |
||||||
|
CanvasRenderer: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 3892339027384508655} |
||||||
|
m_CullTransparentMesh: 0 |
||||||
|
--- !u!114 &3892339027384508653 |
||||||
|
MonoBehaviour: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 3892339027384508655} |
||||||
|
m_Enabled: 1 |
||||||
|
m_EditorHideFlags: 0 |
||||||
|
m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} |
||||||
|
m_Name: |
||||||
|
m_EditorClassIdentifier: |
||||||
|
m_Material: {fileID: 0} |
||||||
|
m_Color: {r: 0.2783019, g: 0.50158674, b: 1, a: 1} |
||||||
|
m_RaycastTarget: 1 |
||||||
|
m_OnCullStateChanged: |
||||||
|
m_PersistentCalls: |
||||||
|
m_Calls: [] |
||||||
|
m_Texture: {fileID: 0} |
||||||
|
m_UVRect: |
||||||
|
serializedVersion: 2 |
||||||
|
x: 0 |
||||||
|
y: 0 |
||||||
|
width: 1 |
||||||
|
height: 1 |
||||||
|
--- !u!1 &3892339028022738724 |
||||||
|
GameObject: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
serializedVersion: 6 |
||||||
|
m_Component: |
||||||
|
- component: {fileID: 3892339028022738723} |
||||||
|
- component: {fileID: 3892339028022738735} |
||||||
|
- component: {fileID: 3892339028022738720} |
||||||
|
- component: {fileID: 3892339028022738721} |
||||||
|
- component: {fileID: 3892339028022738722} |
||||||
|
m_Layer: 5 |
||||||
|
m_Name: EntryDisplayHolder |
||||||
|
m_TagString: Untagged |
||||||
|
m_Icon: {fileID: 0} |
||||||
|
m_NavMeshLayer: 0 |
||||||
|
m_StaticEditorFlags: 0 |
||||||
|
m_IsActive: 1 |
||||||
|
--- !u!224 &3892339028022738723 |
||||||
|
RectTransform: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 3892339028022738724} |
||||||
|
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_Children: [] |
||||||
|
m_Father: {fileID: 3892339028978780123} |
||||||
|
m_RootOrder: 1 |
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
||||||
|
m_AnchorMin: {x: 0, y: 1} |
||||||
|
m_AnchorMax: {x: 0, y: 1} |
||||||
|
m_AnchoredPosition: {x: 0, y: 0.000015258789} |
||||||
|
m_SizeDelta: {x: 600, y: 0} |
||||||
|
m_Pivot: {x: 0, y: 1} |
||||||
|
--- !u!222 &3892339028022738735 |
||||||
|
CanvasRenderer: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 3892339028022738724} |
||||||
|
m_CullTransparentMesh: 0 |
||||||
|
--- !u!114 &3892339028022738720 |
||||||
|
MonoBehaviour: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 3892339028022738724} |
||||||
|
m_Enabled: 1 |
||||||
|
m_EditorHideFlags: 0 |
||||||
|
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} |
||||||
|
m_Name: |
||||||
|
m_EditorClassIdentifier: |
||||||
|
m_Material: {fileID: 0} |
||||||
|
m_Color: {r: 0.2783019, g: 0.50158674, b: 1, a: 1} |
||||||
|
m_RaycastTarget: 1 |
||||||
|
m_OnCullStateChanged: |
||||||
|
m_PersistentCalls: |
||||||
|
m_Calls: [] |
||||||
|
m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} |
||||||
|
m_Type: 1 |
||||||
|
m_PreserveAspect: 0 |
||||||
|
m_FillCenter: 1 |
||||||
|
m_FillMethod: 4 |
||||||
|
m_FillAmount: 1 |
||||||
|
m_FillClockwise: 1 |
||||||
|
m_FillOrigin: 0 |
||||||
|
m_UseSpriteMesh: 0 |
||||||
|
m_PixelsPerUnitMultiplier: 1 |
||||||
|
--- !u!114 &3892339028022738721 |
||||||
|
MonoBehaviour: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 3892339028022738724} |
||||||
|
m_Enabled: 1 |
||||||
|
m_EditorHideFlags: 0 |
||||||
|
m_Script: {fileID: 11500000, guid: 59f8146938fff824cb5fd77236b75775, type: 3} |
||||||
|
m_Name: |
||||||
|
m_EditorClassIdentifier: |
||||||
|
m_Padding: |
||||||
|
m_Left: 0 |
||||||
|
m_Right: 0 |
||||||
|
m_Top: 0 |
||||||
|
m_Bottom: 0 |
||||||
|
m_ChildAlignment: 0 |
||||||
|
m_Spacing: 0 |
||||||
|
m_ChildForceExpandWidth: 1 |
||||||
|
m_ChildForceExpandHeight: 0 |
||||||
|
m_ChildControlWidth: 1 |
||||||
|
m_ChildControlHeight: 1 |
||||||
|
m_ChildScaleWidth: 0 |
||||||
|
m_ChildScaleHeight: 0 |
||||||
|
--- !u!114 &3892339028022738722 |
||||||
|
MonoBehaviour: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 3892339028022738724} |
||||||
|
m_Enabled: 1 |
||||||
|
m_EditorHideFlags: 0 |
||||||
|
m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3} |
||||||
|
m_Name: |
||||||
|
m_EditorClassIdentifier: |
||||||
|
m_HorizontalFit: 0 |
||||||
|
m_VerticalFit: 2 |
||||||
|
--- !u!1 &3892339028774243865 |
||||||
|
GameObject: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
serializedVersion: 6 |
||||||
|
m_Component: |
||||||
|
- component: {fileID: 3892339028774243842} |
||||||
|
- component: {fileID: 3892339028774243843} |
||||||
|
- component: {fileID: 3892339028774243844} |
||||||
|
- component: {fileID: 3892339028774243845} |
||||||
|
- component: {fileID: 3892339028774243846} |
||||||
|
- component: {fileID: 3892339028774243864} |
||||||
|
m_Layer: 5 |
||||||
|
m_Name: NarrativeLog |
||||||
|
m_TagString: Untagged |
||||||
|
m_Icon: {fileID: 0} |
||||||
|
m_NavMeshLayer: 0 |
||||||
|
m_StaticEditorFlags: 0 |
||||||
|
m_IsActive: 1 |
||||||
|
--- !u!224 &3892339028774243842 |
||||||
|
RectTransform: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 3892339028774243865} |
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0} |
||||||
|
m_LocalScale: {x: 0, y: 0, z: 0} |
||||||
|
m_Children: |
||||||
|
- {fileID: 3892339028978780123} |
||||||
|
m_Father: {fileID: 0} |
||||||
|
m_RootOrder: 0 |
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
||||||
|
m_AnchorMin: {x: 0, y: 0} |
||||||
|
m_AnchorMax: {x: 0, y: 0} |
||||||
|
m_AnchoredPosition: {x: 0, y: 0} |
||||||
|
m_SizeDelta: {x: 0, y: 0} |
||||||
|
m_Pivot: {x: 0, y: 0} |
||||||
|
--- !u!223 &3892339028774243843 |
||||||
|
Canvas: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 3892339028774243865} |
||||||
|
m_Enabled: 1 |
||||||
|
serializedVersion: 3 |
||||||
|
m_RenderMode: 0 |
||||||
|
m_Camera: {fileID: 0} |
||||||
|
m_PlaneDistance: 100 |
||||||
|
m_PixelPerfect: 0 |
||||||
|
m_ReceivesEvents: 1 |
||||||
|
m_OverrideSorting: 0 |
||||||
|
m_OverridePixelPerfect: 0 |
||||||
|
m_SortingBucketNormalizedSize: 0 |
||||||
|
m_AdditionalShaderChannelsFlag: 0 |
||||||
|
m_SortingLayerID: 0 |
||||||
|
m_SortingOrder: 0 |
||||||
|
m_TargetDisplay: 0 |
||||||
|
--- !u!114 &3892339028774243844 |
||||||
|
MonoBehaviour: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 3892339028774243865} |
||||||
|
m_Enabled: 1 |
||||||
|
m_EditorHideFlags: 0 |
||||||
|
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} |
||||||
|
m_Name: |
||||||
|
m_EditorClassIdentifier: |
||||||
|
m_UiScaleMode: 0 |
||||||
|
m_ReferencePixelsPerUnit: 100 |
||||||
|
m_ScaleFactor: 1 |
||||||
|
m_ReferenceResolution: {x: 800, y: 600} |
||||||
|
m_ScreenMatchMode: 0 |
||||||
|
m_MatchWidthOrHeight: 0 |
||||||
|
m_PhysicalUnit: 3 |
||||||
|
m_FallbackScreenDPI: 96 |
||||||
|
m_DefaultSpriteDPI: 96 |
||||||
|
m_DynamicPixelsPerUnit: 1 |
||||||
|
--- !u!114 &3892339028774243845 |
||||||
|
MonoBehaviour: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 3892339028774243865} |
||||||
|
m_Enabled: 1 |
||||||
|
m_EditorHideFlags: 0 |
||||||
|
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} |
||||||
|
m_Name: |
||||||
|
m_EditorClassIdentifier: |
||||||
|
m_IgnoreReversedGraphics: 1 |
||||||
|
m_BlockingObjects: 0 |
||||||
|
m_BlockingMask: |
||||||
|
serializedVersion: 2 |
||||||
|
m_Bits: 4294967295 |
||||||
|
--- !u!225 &3892339028774243846 |
||||||
|
CanvasGroup: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 3892339028774243865} |
||||||
|
m_Enabled: 1 |
||||||
|
m_Alpha: 1 |
||||||
|
m_Interactable: 1 |
||||||
|
m_BlocksRaycasts: 1 |
||||||
|
m_IgnoreParentGroups: 0 |
||||||
|
--- !u!114 &3892339028774243864 |
||||||
|
MonoBehaviour: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 3892339028774243865} |
||||||
|
m_Enabled: 1 |
||||||
|
m_EditorHideFlags: 0 |
||||||
|
m_Script: {fileID: 11500000, guid: fde579c9edfbe7e469349e39e2a87a48, type: 3} |
||||||
|
m_Name: |
||||||
|
m_EditorClassIdentifier: |
||||||
|
entryDisplayPrefab: {fileID: 2879084013005042991, guid: 243a94cf6d8dda84f8351f4289587571, |
||||||
|
type: 3} |
||||||
|
entryHolder: {fileID: 3892339028022738723} |
||||||
|
--- !u!1 &3892339028978780124 |
||||||
|
GameObject: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
serializedVersion: 6 |
||||||
|
m_Component: |
||||||
|
- component: {fileID: 3892339028978780123} |
||||||
|
- component: {fileID: 3892339028978780103} |
||||||
|
- component: {fileID: 3892339028978780120} |
||||||
|
- component: {fileID: 3892339028978780121} |
||||||
|
- component: {fileID: 3892339028978780122} |
||||||
|
m_Layer: 5 |
||||||
|
m_Name: MainWindow |
||||||
|
m_TagString: Untagged |
||||||
|
m_Icon: {fileID: 0} |
||||||
|
m_NavMeshLayer: 0 |
||||||
|
m_StaticEditorFlags: 0 |
||||||
|
m_IsActive: 1 |
||||||
|
--- !u!224 &3892339028978780123 |
||||||
|
RectTransform: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 3892339028978780124} |
||||||
|
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_Children: |
||||||
|
- {fileID: 3892339027384508654} |
||||||
|
- {fileID: 3892339028022738723} |
||||||
|
m_Father: {fileID: 3892339028774243842} |
||||||
|
m_RootOrder: 0 |
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
||||||
|
m_AnchorMin: {x: 0.5, y: 0.5} |
||||||
|
m_AnchorMax: {x: 0.5, y: 0.5} |
||||||
|
m_AnchoredPosition: {x: 0, y: 108.70001} |
||||||
|
m_SizeDelta: {x: 600, y: 300} |
||||||
|
m_Pivot: {x: 0.5, y: 0.5} |
||||||
|
--- !u!222 &3892339028978780103 |
||||||
|
CanvasRenderer: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 3892339028978780124} |
||||||
|
m_CullTransparentMesh: 0 |
||||||
|
--- !u!114 &3892339028978780120 |
||||||
|
MonoBehaviour: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 3892339028978780124} |
||||||
|
m_Enabled: 1 |
||||||
|
m_EditorHideFlags: 0 |
||||||
|
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} |
||||||
|
m_Name: |
||||||
|
m_EditorClassIdentifier: |
||||||
|
m_Material: {fileID: 0} |
||||||
|
m_Color: {r: 1, g: 1, b: 1, a: 0.392} |
||||||
|
m_RaycastTarget: 1 |
||||||
|
m_OnCullStateChanged: |
||||||
|
m_PersistentCalls: |
||||||
|
m_Calls: [] |
||||||
|
m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} |
||||||
|
m_Type: 1 |
||||||
|
m_PreserveAspect: 0 |
||||||
|
m_FillCenter: 1 |
||||||
|
m_FillMethod: 4 |
||||||
|
m_FillAmount: 1 |
||||||
|
m_FillClockwise: 1 |
||||||
|
m_FillOrigin: 0 |
||||||
|
m_UseSpriteMesh: 0 |
||||||
|
m_PixelsPerUnitMultiplier: 1 |
||||||
|
--- !u!114 &3892339028978780121 |
||||||
|
MonoBehaviour: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 3892339028978780124} |
||||||
|
m_Enabled: 1 |
||||||
|
m_EditorHideFlags: 0 |
||||||
|
m_Script: {fileID: 11500000, guid: 1aa08ab6e0800fa44ae55d278d1423e3, type: 3} |
||||||
|
m_Name: |
||||||
|
m_EditorClassIdentifier: |
||||||
|
m_Content: {fileID: 3892339028022738723} |
||||||
|
m_Horizontal: 0 |
||||||
|
m_Vertical: 1 |
||||||
|
m_MovementType: 2 |
||||||
|
m_Elasticity: 0.1 |
||||||
|
m_Inertia: 1 |
||||||
|
m_DecelerationRate: 0.135 |
||||||
|
m_ScrollSensitivity: 1 |
||||||
|
m_Viewport: {fileID: 0} |
||||||
|
m_HorizontalScrollbar: {fileID: 0} |
||||||
|
m_VerticalScrollbar: {fileID: 0} |
||||||
|
m_HorizontalScrollbarVisibility: 0 |
||||||
|
m_VerticalScrollbarVisibility: 0 |
||||||
|
m_HorizontalScrollbarSpacing: 0 |
||||||
|
m_VerticalScrollbarSpacing: 0 |
||||||
|
m_OnValueChanged: |
||||||
|
m_PersistentCalls: |
||||||
|
m_Calls: [] |
||||||
|
--- !u!114 &3892339028978780122 |
||||||
|
MonoBehaviour: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 3892339028978780124} |
||||||
|
m_Enabled: 1 |
||||||
|
m_EditorHideFlags: 0 |
||||||
|
m_Script: {fileID: 11500000, guid: 31a19414c41e5ae4aae2af33fee712f6, type: 3} |
||||||
|
m_Name: |
||||||
|
m_EditorClassIdentifier: |
||||||
|
m_ShowMaskGraphic: 1 |
@ -0,0 +1,7 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: bffd475e4bfb82f49810ceafe8d17b78 |
||||||
|
PrefabImporter: |
||||||
|
externalObjects: {} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,269 @@ |
|||||||
|
%YAML 1.1 |
||||||
|
%TAG !u! tag:unity3d.com,2011: |
||||||
|
--- !u!1 &2333275596563789949 |
||||||
|
GameObject: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
serializedVersion: 6 |
||||||
|
m_Component: |
||||||
|
- component: {fileID: 8885489252217067950} |
||||||
|
- component: {fileID: 7933068750079926288} |
||||||
|
- component: {fileID: 4379489694222926579} |
||||||
|
m_Layer: 5 |
||||||
|
m_Name: NameText |
||||||
|
m_TagString: Untagged |
||||||
|
m_Icon: {fileID: 0} |
||||||
|
m_NavMeshLayer: 0 |
||||||
|
m_StaticEditorFlags: 0 |
||||||
|
m_IsActive: 1 |
||||||
|
--- !u!224 &8885489252217067950 |
||||||
|
RectTransform: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 2333275596563789949} |
||||||
|
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_Children: [] |
||||||
|
m_Father: {fileID: 2481548615123137394} |
||||||
|
m_RootOrder: 0 |
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
||||||
|
m_AnchorMin: {x: 0, y: 0} |
||||||
|
m_AnchorMax: {x: 0, y: 0} |
||||||
|
m_AnchoredPosition: {x: 0, y: 0} |
||||||
|
m_SizeDelta: {x: 0, y: 0} |
||||||
|
m_Pivot: {x: 0.5, y: 0.5} |
||||||
|
--- !u!222 &7933068750079926288 |
||||||
|
CanvasRenderer: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 2333275596563789949} |
||||||
|
m_CullTransparentMesh: 0 |
||||||
|
--- !u!114 &4379489694222926579 |
||||||
|
MonoBehaviour: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 2333275596563789949} |
||||||
|
m_Enabled: 1 |
||||||
|
m_EditorHideFlags: 0 |
||||||
|
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} |
||||||
|
m_Name: |
||||||
|
m_EditorClassIdentifier: |
||||||
|
m_Material: {fileID: 0} |
||||||
|
m_Color: {r: 1, g: 1, b: 1, a: 1} |
||||||
|
m_RaycastTarget: 1 |
||||||
|
m_OnCullStateChanged: |
||||||
|
m_PersistentCalls: |
||||||
|
m_Calls: [] |
||||||
|
m_FontData: |
||||||
|
m_Font: {fileID: 12800000, guid: 64bd3e45f7a714f16b3c213f55f17fea, type: 3} |
||||||
|
m_FontSize: 18 |
||||||
|
m_FontStyle: 0 |
||||||
|
m_BestFit: 0 |
||||||
|
m_MinSize: 1 |
||||||
|
m_MaxSize: 40 |
||||||
|
m_Alignment: 0 |
||||||
|
m_AlignByGeometry: 0 |
||||||
|
m_RichText: 1 |
||||||
|
m_HorizontalOverflow: 0 |
||||||
|
m_VerticalOverflow: 0 |
||||||
|
m_LineSpacing: 1 |
||||||
|
m_Text: Name |
||||||
|
--- !u!1 &3511986559566215052 |
||||||
|
GameObject: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
serializedVersion: 6 |
||||||
|
m_Component: |
||||||
|
- component: {fileID: 3365827255933976305} |
||||||
|
- component: {fileID: 3857872114285753493} |
||||||
|
- component: {fileID: 19882628764411882} |
||||||
|
m_Layer: 5 |
||||||
|
m_Name: StoryText |
||||||
|
m_TagString: Untagged |
||||||
|
m_Icon: {fileID: 0} |
||||||
|
m_NavMeshLayer: 0 |
||||||
|
m_StaticEditorFlags: 0 |
||||||
|
m_IsActive: 1 |
||||||
|
--- !u!224 &3365827255933976305 |
||||||
|
RectTransform: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 3511986559566215052} |
||||||
|
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_Children: [] |
||||||
|
m_Father: {fileID: 2481548615123137394} |
||||||
|
m_RootOrder: 1 |
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
||||||
|
m_AnchorMin: {x: 0, y: 0} |
||||||
|
m_AnchorMax: {x: 0, y: 0} |
||||||
|
m_AnchoredPosition: {x: 0, y: 0} |
||||||
|
m_SizeDelta: {x: 0, y: 0} |
||||||
|
m_Pivot: {x: 0.5, y: 0.5} |
||||||
|
--- !u!222 &3857872114285753493 |
||||||
|
CanvasRenderer: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 3511986559566215052} |
||||||
|
m_CullTransparentMesh: 0 |
||||||
|
--- !u!114 &19882628764411882 |
||||||
|
MonoBehaviour: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 3511986559566215052} |
||||||
|
m_Enabled: 1 |
||||||
|
m_EditorHideFlags: 0 |
||||||
|
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} |
||||||
|
m_Name: |
||||||
|
m_EditorClassIdentifier: |
||||||
|
m_Material: {fileID: 0} |
||||||
|
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} |
||||||
|
m_RaycastTarget: 1 |
||||||
|
m_OnCullStateChanged: |
||||||
|
m_PersistentCalls: |
||||||
|
m_Calls: [] |
||||||
|
m_FontData: |
||||||
|
m_Font: {fileID: 12800000, guid: 64bd3e45f7a714f16b3c213f55f17fea, type: 3} |
||||||
|
m_FontSize: 22 |
||||||
|
m_FontStyle: 0 |
||||||
|
m_BestFit: 0 |
||||||
|
m_MinSize: 2 |
||||||
|
m_MaxSize: 40 |
||||||
|
m_Alignment: 0 |
||||||
|
m_AlignByGeometry: 0 |
||||||
|
m_RichText: 1 |
||||||
|
m_HorizontalOverflow: 0 |
||||||
|
m_VerticalOverflow: 0 |
||||||
|
m_LineSpacing: 1 |
||||||
|
m_Text: New Text |
||||||
|
--- !u!1 &9061313995661533662 |
||||||
|
GameObject: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
serializedVersion: 6 |
||||||
|
m_Component: |
||||||
|
- component: {fileID: 2481548615123137394} |
||||||
|
- component: {fileID: 3382758035194104851} |
||||||
|
- component: {fileID: 819304301769093009} |
||||||
|
- component: {fileID: 5508376540251964814} |
||||||
|
- component: {fileID: 2879084013005042991} |
||||||
|
m_Layer: 5 |
||||||
|
m_Name: NarrativeLogEntryDisplay |
||||||
|
m_TagString: Untagged |
||||||
|
m_Icon: {fileID: 0} |
||||||
|
m_NavMeshLayer: 0 |
||||||
|
m_StaticEditorFlags: 0 |
||||||
|
m_IsActive: 1 |
||||||
|
--- !u!224 &2481548615123137394 |
||||||
|
RectTransform: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 9061313995661533662} |
||||||
|
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_Children: |
||||||
|
- {fileID: 8885489252217067950} |
||||||
|
- {fileID: 3365827255933976305} |
||||||
|
m_Father: {fileID: 0} |
||||||
|
m_RootOrder: 0 |
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
||||||
|
m_AnchorMin: {x: 0, y: 0} |
||||||
|
m_AnchorMax: {x: 0, y: 0} |
||||||
|
m_AnchoredPosition: {x: 0, y: 0} |
||||||
|
m_SizeDelta: {x: 0, y: 278} |
||||||
|
m_Pivot: {x: 0.5, y: 0.5} |
||||||
|
--- !u!222 &3382758035194104851 |
||||||
|
CanvasRenderer: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 9061313995661533662} |
||||||
|
m_CullTransparentMesh: 0 |
||||||
|
--- !u!114 &819304301769093009 |
||||||
|
MonoBehaviour: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 9061313995661533662} |
||||||
|
m_Enabled: 0 |
||||||
|
m_EditorHideFlags: 0 |
||||||
|
m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} |
||||||
|
m_Name: |
||||||
|
m_EditorClassIdentifier: |
||||||
|
m_Material: {fileID: 0} |
||||||
|
m_Color: {r: 1, g: 1, b: 1, a: 1} |
||||||
|
m_RaycastTarget: 1 |
||||||
|
m_OnCullStateChanged: |
||||||
|
m_PersistentCalls: |
||||||
|
m_Calls: [] |
||||||
|
m_Texture: {fileID: 0} |
||||||
|
m_UVRect: |
||||||
|
serializedVersion: 2 |
||||||
|
x: 0 |
||||||
|
y: 0 |
||||||
|
width: 1 |
||||||
|
height: 1 |
||||||
|
--- !u!114 &5508376540251964814 |
||||||
|
MonoBehaviour: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 9061313995661533662} |
||||||
|
m_Enabled: 1 |
||||||
|
m_EditorHideFlags: 0 |
||||||
|
m_Script: {fileID: 11500000, guid: 59f8146938fff824cb5fd77236b75775, type: 3} |
||||||
|
m_Name: |
||||||
|
m_EditorClassIdentifier: |
||||||
|
m_Padding: |
||||||
|
m_Left: 10 |
||||||
|
m_Right: 10 |
||||||
|
m_Top: 10 |
||||||
|
m_Bottom: 10 |
||||||
|
m_ChildAlignment: 0 |
||||||
|
m_Spacing: 0 |
||||||
|
m_ChildForceExpandWidth: 1 |
||||||
|
m_ChildForceExpandHeight: 1 |
||||||
|
m_ChildControlWidth: 1 |
||||||
|
m_ChildControlHeight: 1 |
||||||
|
m_ChildScaleWidth: 0 |
||||||
|
m_ChildScaleHeight: 0 |
||||||
|
--- !u!114 &2879084013005042991 |
||||||
|
MonoBehaviour: |
||||||
|
m_ObjectHideFlags: 0 |
||||||
|
m_CorrespondingSourceObject: {fileID: 0} |
||||||
|
m_PrefabInstance: {fileID: 0} |
||||||
|
m_PrefabAsset: {fileID: 0} |
||||||
|
m_GameObject: {fileID: 9061313995661533662} |
||||||
|
m_Enabled: 1 |
||||||
|
m_EditorHideFlags: 0 |
||||||
|
m_Script: {fileID: 11500000, guid: 824b58b7741a0dd4e9b43693c47b24f7, type: 3} |
||||||
|
m_Name: |
||||||
|
m_EditorClassIdentifier: |
||||||
|
nameTextField: {fileID: 4379489694222926579} |
||||||
|
storyTextField: {fileID: 19882628764411882} |
@ -0,0 +1,7 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 243a94cf6d8dda84f8351f4289587571 |
||||||
|
PrefabImporter: |
||||||
|
externalObjects: {} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,70 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
using UnityEngine.Assertions; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Assert on 2 Fungus variable values. |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Scripting", |
||||||
|
"Assert", |
||||||
|
"Assert based on compared values.")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class AssertCommand : Command |
||||||
|
{ |
||||||
|
[SerializeField] |
||||||
|
protected StringData message; |
||||||
|
|
||||||
|
[SerializeField] |
||||||
|
[VariableProperty(AllVariableTypes.VariableAny.Any)] |
||||||
|
protected Variable a, b; |
||||||
|
|
||||||
|
public enum Method |
||||||
|
{ |
||||||
|
AreEqual, |
||||||
|
AreNotEqual, |
||||||
|
} |
||||||
|
|
||||||
|
[SerializeField] |
||||||
|
protected Method method; |
||||||
|
|
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
switch (method) |
||||||
|
{ |
||||||
|
case Method.AreEqual: |
||||||
|
Assert.AreEqual(a.GetValue(), b.GetValue()); |
||||||
|
break; |
||||||
|
|
||||||
|
case Method.AreNotEqual: |
||||||
|
Assert.AreNotEqual(a.GetValue(), b.GetValue()); |
||||||
|
break; |
||||||
|
|
||||||
|
default: |
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
Continue(); |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
if (a == null) |
||||||
|
return "Error: No A variable"; |
||||||
|
if (b == null) |
||||||
|
return "Error: No B variable"; |
||||||
|
|
||||||
|
return a.Key + " " + method.ToString() + " " + b.Key; |
||||||
|
} |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
return variable == message.stringRef || |
||||||
|
variable == a || variable == b || |
||||||
|
base.HasReference(variable); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: c40b126bd148ae743b56bc8c00162589 |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -1,9 +1,8 @@ |
|||||||
fileFormatVersion: 2 |
fileFormatVersion: 2 |
||||||
guid: f7ddb80a0487d1342b36129da32ad1f6 |
guid: 7d7820abad934b747ae1797c3aa82197 |
||||||
folderAsset: yes |
folderAsset: yes |
||||||
timeCreated: 1503815490 |
|
||||||
licenseType: Free |
|
||||||
DefaultImporter: |
DefaultImporter: |
||||||
|
externalObjects: {} |
||||||
userData: |
userData: |
||||||
assetBundleName: |
assetBundleName: |
||||||
assetBundleVariant: |
assetBundleVariant: |
@ -0,0 +1,35 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Base class for all FungusCollection commands |
||||||
|
/// </summary> |
||||||
|
[AddComponentMenu("")] |
||||||
|
public abstract class CollectionBaseCommand : Command |
||||||
|
{ |
||||||
|
[SerializeField] |
||||||
|
protected CollectionData collection; |
||||||
|
|
||||||
|
public override Color GetButtonColor() |
||||||
|
{ |
||||||
|
return new Color32(191, 217, 235, 255); |
||||||
|
} |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
return variable == collection.collectionRef; |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
if (collection.Value == null) |
||||||
|
return "Error: no collection selected"; |
||||||
|
|
||||||
|
return collection.Value.name; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: dab2b4efcfae62841b5070c4cfec8c4a |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,42 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Base class for all FungusCollection commands that use an intvar |
||||||
|
/// </summary> |
||||||
|
[AddComponentMenu("")] |
||||||
|
public abstract class CollectionBaseIntCommand : CollectionBaseCommand |
||||||
|
{ |
||||||
|
[SerializeField] |
||||||
|
protected IntegerData integer; |
||||||
|
|
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
if (collection.Value != null) |
||||||
|
{ |
||||||
|
OnEnterInner(); |
||||||
|
} |
||||||
|
|
||||||
|
Continue(); |
||||||
|
} |
||||||
|
|
||||||
|
protected abstract void OnEnterInner(); |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
return variable == integer.integerRef || base.HasReference(variable); |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
if (collection.Value == null) |
||||||
|
return "Error: no collection selected"; |
||||||
|
|
||||||
|
return integer.Value.ToString() + " on " + collection.Value.name; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 328b7e125f24d5349be4fe583267ba1d |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,50 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Base class for all FungusCollection commands that require a second collection of the same type |
||||||
|
/// </summary> |
||||||
|
[AddComponentMenu("")] |
||||||
|
public abstract class CollectionBaseTwoCollectionCommand : CollectionBaseCommand |
||||||
|
{ |
||||||
|
[SerializeField] |
||||||
|
protected CollectionData rhsCollection; |
||||||
|
|
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
if (collection.Value != null && rhsCollection.Value != null) |
||||||
|
{ |
||||||
|
OnEnterInner(); |
||||||
|
} |
||||||
|
|
||||||
|
Continue(); |
||||||
|
} |
||||||
|
|
||||||
|
protected abstract void OnEnterInner(); |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
return variable == rhsCollection.collectionRef || base.HasReference(variable); |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
if (collection.Value == null) |
||||||
|
return "Error: no collection selected"; |
||||||
|
|
||||||
|
if (rhsCollection.Value == null) |
||||||
|
return "Error: no variable selected"; |
||||||
|
|
||||||
|
if (collection.Value.ContainedType() != rhsCollection.Value.ContainedType()) |
||||||
|
{ |
||||||
|
return "Error: Collection types do not match. " + collection.Value.ContainedType().Name + " != " + rhsCollection.Value.ContainedType().Name; |
||||||
|
} |
||||||
|
|
||||||
|
return collection.Value.name + " , " + rhsCollection.Value.name; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: c4010b5577069fc4cb9480f87ed3f73e |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,47 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Base class for all FungusCollection commands that require a compatible variable and an integer |
||||||
|
/// </summary> |
||||||
|
[AddComponentMenu("")] |
||||||
|
public abstract class CollectionBaseVarAndIntCommand : CollectionBaseVarCommand |
||||||
|
{ |
||||||
|
[SerializeField] |
||||||
|
[VariableProperty(typeof(IntegerVariable))] |
||||||
|
protected IntegerVariable integer; |
||||||
|
|
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
if (collection.Value != null && variableToUse != null && integer != null) |
||||||
|
{ |
||||||
|
OnEnterInner(); |
||||||
|
} |
||||||
|
|
||||||
|
Continue(); |
||||||
|
} |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
return variable == integer || base.HasReference(variable); |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
if (collection.Value == null) |
||||||
|
return "Error: no collection selected"; |
||||||
|
|
||||||
|
if (variableToUse == null) |
||||||
|
return "Error: no variable selected"; |
||||||
|
|
||||||
|
if (integer == null) |
||||||
|
return "Error: no integer selected"; |
||||||
|
|
||||||
|
return integer.Key + " on " + variableToUse.Key + " in " + collection.Value.name; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 561b53abc515d704d8845caa3b3ee26f |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,54 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Base class for all FungusCollection commands that require a compatible variable type |
||||||
|
/// </summary> |
||||||
|
[AddComponentMenu("")] |
||||||
|
public abstract class CollectionBaseVarCommand : CollectionBaseCommand, ICollectionCompatible |
||||||
|
{ |
||||||
|
[SerializeField] |
||||||
|
[VariableProperty(compatibleVariableName = "collection")] |
||||||
|
protected Variable variableToUse; |
||||||
|
|
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
if (collection.Value != null && variableToUse != null) |
||||||
|
{ |
||||||
|
OnEnterInner(); |
||||||
|
} |
||||||
|
|
||||||
|
Continue(); |
||||||
|
} |
||||||
|
|
||||||
|
protected abstract void OnEnterInner(); |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
return variable == variableToUse || base.HasReference(variable); |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
if (collection.Value == null) |
||||||
|
return "Error: no collection selected"; |
||||||
|
|
||||||
|
if (variableToUse == null) |
||||||
|
return "Error: no variable selected"; |
||||||
|
|
||||||
|
return variableToUse.Key + " to " + collection.Value.name; |
||||||
|
} |
||||||
|
|
||||||
|
bool ICollectionCompatible.IsVarCompatibleWithCollection(Variable variable, string compatibleWith) |
||||||
|
{ |
||||||
|
if (compatibleWith == "collection") |
||||||
|
return collection.Value == null ? false : collection.Value.IsElementCompatible(variable); |
||||||
|
else |
||||||
|
return true; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: fe12b6eb87e59984cb4122f978f11e45 |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,39 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Add an item to a collection |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Add", |
||||||
|
"Add an item to a collection")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandAdd : CollectionBaseVarCommand |
||||||
|
{ |
||||||
|
[Tooltip("Only add if the item does not already exist in the collection")] |
||||||
|
[SerializeField] |
||||||
|
protected BooleanData onlyIfUnique = new BooleanData(false); |
||||||
|
|
||||||
|
protected override void OnEnterInner() |
||||||
|
{ |
||||||
|
if (onlyIfUnique.Value) |
||||||
|
collection.Value.AddUnique(variableToUse); |
||||||
|
else |
||||||
|
collection.Value.Add(variableToUse); |
||||||
|
} |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
return onlyIfUnique.booleanRef == variable || base.HasReference(variable); |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
return base.GetSummary() + (onlyIfUnique.Value ? " Unique" : ""); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: a30a3b6902ecde54ea81d503f6a2b27e |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,39 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Add all items in given rhs collection to target collection |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Add All", |
||||||
|
"Add all items in given rhs collection to target collection")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandAddAll : CollectionBaseTwoCollectionCommand |
||||||
|
{ |
||||||
|
[Tooltip("Only add if the item does not already exist in the collection")] |
||||||
|
[SerializeField] |
||||||
|
protected BooleanData onlyIfUnique = new BooleanData(false); |
||||||
|
|
||||||
|
protected override void OnEnterInner() |
||||||
|
{ |
||||||
|
if (onlyIfUnique.Value) |
||||||
|
collection.Value.AddUnique(rhsCollection); |
||||||
|
else |
||||||
|
collection.Value.Add(rhsCollection); |
||||||
|
} |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
return onlyIfUnique.booleanRef == variable || base.HasReference(variable); |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
return base.GetSummary() + (onlyIfUnique.Value ? " Unique" : ""); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 5688faa1580d8d147b59e18fcdd888ad |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,27 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Clears a target collection |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Clear", |
||||||
|
"Clears a target collection")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandClear : CollectionBaseCommand |
||||||
|
{ |
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
if (collection.Value != null) |
||||||
|
{ |
||||||
|
collection.Value.Clear(); |
||||||
|
} |
||||||
|
|
||||||
|
Continue(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 8b071472a9dcdc7469059042e2e6e50d |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,37 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Does the collection contain the given variable |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Contains", |
||||||
|
"Does the collection contain the given variable")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandContains : CollectionBaseVarCommand |
||||||
|
{ |
||||||
|
[VariableProperty(typeof(BooleanVariable))] |
||||||
|
protected BooleanVariable result; |
||||||
|
|
||||||
|
protected override void OnEnterInner() |
||||||
|
{ |
||||||
|
if (result == null) |
||||||
|
{ |
||||||
|
Debug.LogWarning("No result var set"); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
result.Value = collection.Value.Contains(variableToUse); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
return result == variable || base.HasReference(variable); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 6bd67ee6ac8134b4e9aea26299040034 |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,53 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Does target collection, contain all rhs collection items |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Contains All Of", |
||||||
|
"Does target collection, contain all rhs collection items")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandContainsAll : CollectionBaseTwoCollectionCommand |
||||||
|
{ |
||||||
|
[Tooltip("Do they have to be in the same order?")] |
||||||
|
[SerializeField] |
||||||
|
protected BooleanData inSameOrder = new BooleanData(false); |
||||||
|
|
||||||
|
[VariableProperty(typeof(BooleanVariable))] |
||||||
|
protected BooleanVariable result; |
||||||
|
|
||||||
|
protected override void OnEnterInner() |
||||||
|
{ |
||||||
|
if (result == null) |
||||||
|
{ |
||||||
|
Debug.LogWarning("No result var set"); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
if (inSameOrder.Value) |
||||||
|
{ |
||||||
|
result.Value = collection.Value.ContainsAllOfOrdered(rhsCollection.Value); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
result.Value = collection.Value.ContainsAllOf(rhsCollection.Value); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
return result == variable || inSameOrder.booleanRef == variable || base.HasReference(variable); |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
return base.GetSummary() + (inSameOrder.Value ? " Ordered" : ""); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 1df2de5cf986f9d419a124bb9d834b11 |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,37 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Does target collection, contain any of the items in the rhs collection items |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Contains Any Of", |
||||||
|
"Does target collection, contain any of the items in the rhs collection items")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandContainsAny : CollectionBaseTwoCollectionCommand |
||||||
|
{ |
||||||
|
[VariableProperty(typeof(BooleanVariable))] |
||||||
|
protected BooleanVariable result; |
||||||
|
|
||||||
|
protected override void OnEnterInner() |
||||||
|
{ |
||||||
|
if (result == null) |
||||||
|
{ |
||||||
|
Debug.LogWarning("No result var set"); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
result.Value = collection.Value.ContainsAnyOf(rhsCollection.Value); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
return result == variable || base.HasReference(variable); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: c4e05f36271510b41a7d7889025e180e |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,22 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Clears target and then adds all of rhs to target. |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Copy", |
||||||
|
"Clears target and then adds all of rhs to target.")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandCopy : CollectionBaseTwoCollectionCommand |
||||||
|
{ |
||||||
|
protected override void OnEnterInner() |
||||||
|
{ |
||||||
|
collection.Value.CopyFrom(rhsCollection.Value); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 820324be5b6a927469519df54a9bbad0 |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,25 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Number of items in the collection |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Count", |
||||||
|
"Number of items in the collection")] |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Length", |
||||||
|
"Number of items in the collection")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandCount : CollectionBaseIntCommand |
||||||
|
{ |
||||||
|
protected override void OnEnterInner() |
||||||
|
{ |
||||||
|
integer.Value = collection.Value.Count; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 31765259d3ac50e4993fd654cd7ea78b |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,53 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Get or Set, an element in a collection |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Element", |
||||||
|
"Get or Set, an element in a collection")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandElement : CollectionBaseVarCommand |
||||||
|
{ |
||||||
|
public enum GetSet |
||||||
|
{ |
||||||
|
Get, |
||||||
|
Set, |
||||||
|
} |
||||||
|
|
||||||
|
[SerializeField] |
||||||
|
protected IntegerData index; |
||||||
|
|
||||||
|
[SerializeField] |
||||||
|
protected GetSet getset = GetSet.Get; |
||||||
|
|
||||||
|
protected override void OnEnterInner() |
||||||
|
{ |
||||||
|
if (index.Value >= 0 && index.Value < collection.Value.Count) |
||||||
|
{ |
||||||
|
if (getset == GetSet.Get) |
||||||
|
{ |
||||||
|
collection.Value.Get(index.Value, ref variableToUse); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
collection.Value.Set(index.Value, variableToUse); |
||||||
|
} |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
throw new System.ArgumentOutOfRangeException(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
return base.GetSummary() + " " + getset.ToString(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: bf40659a274400d40856f146223798ac |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,24 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Remove all items from collection that are also in RHS and add all the items in RHS that are not already |
||||||
|
/// in target. Similar to a xor |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Exclusive", |
||||||
|
"Remove all items from collection that are also in RHS and add all the items in RHS that are not already in target. " + |
||||||
|
"Similar to a xor")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandExclusive : CollectionBaseTwoCollectionCommand |
||||||
|
{ |
||||||
|
protected override void OnEnterInner() |
||||||
|
{ |
||||||
|
collection.Value.Exclusive(rhsCollection.Value); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 824e24d12ca84774ea135507417e94a1 |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,41 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Find an item in a collection |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Find", |
||||||
|
"Find an item in a collection")] |
||||||
|
[CommandInfo("Collection", |
||||||
|
"IndexOf", |
||||||
|
"Find an item in a collection")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandFind : CollectionBaseVarAndIntCommand |
||||||
|
{ |
||||||
|
[Tooltip("If true, will find the last occurance rather than first occurance.")] |
||||||
|
[SerializeField] |
||||||
|
protected BooleanData lastInsteadOfFirst = new BooleanData(false); |
||||||
|
|
||||||
|
protected override void OnEnterInner() |
||||||
|
{ |
||||||
|
integer.Value = !lastInsteadOfFirst.Value ? |
||||||
|
collection.Value.IndexOf(variableToUse) |
||||||
|
: collection.Value.LastIndexOf(variableToUse); |
||||||
|
} |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
return lastInsteadOfFirst.booleanRef == variable || base.HasReference(variable); |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
return base.GetSummary() + (lastInsteadOfFirst.Value ? " Last" : ""); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 59afe81b26e37ea4ea10dd91dfeee937 |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,22 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Add at a specific location in the collection |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Insert", |
||||||
|
"Add at a specific location in the collection")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandInsert : CollectionBaseVarAndIntCommand |
||||||
|
{ |
||||||
|
protected override void OnEnterInner() |
||||||
|
{ |
||||||
|
collection.Value.Insert(integer.Value, variableToUse); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: dd126ef47d8264a4d8a6aac5b4f3fb12 |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,22 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Remove all items from collection that aren't also in RHS, similar to an overlap. |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Intersection", |
||||||
|
"Remove all items from collection that aren't also in RHS, similar to an overlap.")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandIntersection : CollectionBaseTwoCollectionCommand |
||||||
|
{ |
||||||
|
protected override void OnEnterInner() |
||||||
|
{ |
||||||
|
collection.Value.Intersection(rhsCollection.Value); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 586c189d813b1b045ba358c612f4a6eb |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,22 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// How many occurrences of a given variable exist in a target collection |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Occurrences", |
||||||
|
"How many occurrences of a given variable exist in a target collection")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandOccurrences : CollectionBaseVarAndIntCommand |
||||||
|
{ |
||||||
|
protected override void OnEnterInner() |
||||||
|
{ |
||||||
|
integer.Value = collection.Value.Occurrences(variableToUse); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 75a3711bc9cd44e429e15e10f6029fae |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,39 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Remove an item to a collection |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Remove", |
||||||
|
"Remove an item to a collection")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandRemove : CollectionBaseVarCommand |
||||||
|
{ |
||||||
|
[Tooltip("Should it remove ALL occurances of variable")] |
||||||
|
[SerializeField] |
||||||
|
protected BooleanData allOccurances = new BooleanData(false); |
||||||
|
|
||||||
|
protected override void OnEnterInner() |
||||||
|
{ |
||||||
|
if (allOccurances.Value) |
||||||
|
collection.Value.RemoveAll(variableToUse); |
||||||
|
else |
||||||
|
collection.Value.Remove(variableToUse); |
||||||
|
} |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
return allOccurances.booleanRef == variable || base.HasReference(variable); |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
return base.GetSummary() + (allOccurances.Value ? " ALL" : ""); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 6e2313a05ce56ea49bbf1922b58d793a |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,22 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Remove all items in given rhs collection to target collection |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Remove All Of", |
||||||
|
"Remove all items in given rhs collection to target collection")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandRemoveAllOf : CollectionBaseTwoCollectionCommand |
||||||
|
{ |
||||||
|
protected override void OnEnterInner() |
||||||
|
{ |
||||||
|
collection.Value.RemoveAll(rhsCollection); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 2bb49f43c99a0af4db604a1770b31e83 |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,22 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Remove item at given index |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Remove At", |
||||||
|
"Remove item at given index")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandRemoveAt : CollectionBaseIntCommand |
||||||
|
{ |
||||||
|
protected override void OnEnterInner() |
||||||
|
{ |
||||||
|
collection.Value.RemoveAt(integer.Value); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: c8ee8f64433f29a4f82b03a8e6550ae2 |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,22 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Reserve space for given number of items in the collection |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Reserve", |
||||||
|
"Reserve space for given number of items in the collection")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandReserve : CollectionBaseIntCommand |
||||||
|
{ |
||||||
|
protected override void OnEnterInner() |
||||||
|
{ |
||||||
|
collection.Value.Reserve(integer.Value); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 4672406760fa8f340aabac4528f04c1c |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,22 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Resize will grow the collection to be the given size, will not remove items to shrink |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Resize", |
||||||
|
"Resize will grow the collection to be the given size, will not remove items to shrink")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandResize : CollectionBaseIntCommand |
||||||
|
{ |
||||||
|
protected override void OnEnterInner() |
||||||
|
{ |
||||||
|
collection.Value.Resize(integer.Value); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 3ce11d7cce59a3340937a8d112cd4ad5 |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,27 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Reverse the current order of a target collection |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Reverse", |
||||||
|
"Reverse the current order of a target collection")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandReverse : CollectionBaseCommand |
||||||
|
{ |
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
if (collection.Value != null) |
||||||
|
{ |
||||||
|
collection.Value.Reverse(); |
||||||
|
} |
||||||
|
|
||||||
|
Continue(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: d7359fcb744d14a41acae4b3a2e34b73 |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,27 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Randomly reorders all elements of a target collection |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Shuffle", |
||||||
|
"Randomly reorders all elements of a target collection")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandShuffle : CollectionBaseCommand |
||||||
|
{ |
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
if (collection.Value != null) |
||||||
|
{ |
||||||
|
collection.Value.Shuffle(); |
||||||
|
} |
||||||
|
|
||||||
|
Continue(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: a15d511e013edfe45a0a4726bda90c8f |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,27 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Sort a target collection |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Sort", |
||||||
|
"Sort a target collection")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandSort : CollectionBaseCommand |
||||||
|
{ |
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
if (collection.Value != null) |
||||||
|
{ |
||||||
|
collection.Value.Sort(); |
||||||
|
} |
||||||
|
|
||||||
|
Continue(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 00093f39e8583954ba5935bca806f0f1 |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,27 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Removes all duplicates. |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Unique", |
||||||
|
"Removes all duplicates.")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandUnique : CollectionBaseCommand |
||||||
|
{ |
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
if (collection.Value != null) |
||||||
|
{ |
||||||
|
collection.Value.Unique(); |
||||||
|
} |
||||||
|
|
||||||
|
Continue(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 59ae026a39db9cf4d8453309fa6192db |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,22 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Use the collection as a source of random selection. Picking a random item each run. |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"RandomItem", |
||||||
|
"Use the collection as a source of random selection. Picking a random item each run.")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionRandom : CollectionBaseVarCommand |
||||||
|
{ |
||||||
|
protected override void OnEnterInner() |
||||||
|
{ |
||||||
|
collection.Value.Get(Random.Range(0, collection.Value.Count - 1), ref variableToUse); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: d58ddca8952c1a149a39835e2eeac9a7 |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,80 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Use the collection as a source of random items and turn it into a random bag. Drawing the |
||||||
|
/// next random item until out of items and then reshuffling them. |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"RandomBag", |
||||||
|
"Use the collection as a source of random items and turn it into a random bag. " + |
||||||
|
"Drawing the next random item until out of items and then reshuffling them.")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionRandomBag : CollectionBaseVarCommand |
||||||
|
{ |
||||||
|
[SerializeField] |
||||||
|
[Tooltip("Will add this many copies to the bag. If you want 5 of everything, you want 4 copies.")] |
||||||
|
protected IntegerData duplicatesToPutInBag = new IntegerData(0); |
||||||
|
|
||||||
|
[SerializeField] |
||||||
|
protected IntegerData currentIndex = new IntegerData(int.MaxValue); |
||||||
|
|
||||||
|
protected bool isInit = false; |
||||||
|
|
||||||
|
protected override void OnEnterInner() |
||||||
|
{ |
||||||
|
if (!isInit) |
||||||
|
{ |
||||||
|
Init(); |
||||||
|
} |
||||||
|
|
||||||
|
currentIndex.Value++; |
||||||
|
|
||||||
|
if (currentIndex.Value >= collection.Value.Count) |
||||||
|
{ |
||||||
|
Reshuffle(); |
||||||
|
} |
||||||
|
|
||||||
|
collection.Value.Get(currentIndex.Value, ref variableToUse); |
||||||
|
} |
||||||
|
|
||||||
|
protected void Init() |
||||||
|
{ |
||||||
|
var startingCount = collection.Value.Count; |
||||||
|
for (int i = 0; i < duplicatesToPutInBag.Value; i++) |
||||||
|
{ |
||||||
|
for (int j = 0; j < startingCount; j++) |
||||||
|
{ |
||||||
|
collection.Value.Add(collection.Value.Get(j)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
//force invalid index |
||||||
|
currentIndex.Value = collection.Value.Count; |
||||||
|
|
||||||
|
isInit = true; |
||||||
|
} |
||||||
|
|
||||||
|
protected void Reshuffle() |
||||||
|
{ |
||||||
|
currentIndex.Value = 0; |
||||||
|
collection.Value.Shuffle(); |
||||||
|
} |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
return base.HasReference(variable) || duplicatesToPutInBag.integerRef == variable || currentIndex.integerRef; |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
return base.GetSummary() + |
||||||
|
(duplicatesToPutInBag.integerRef != null ? " " + duplicatesToPutInBag.integerRef.Key : "") + |
||||||
|
(currentIndex.integerRef != null ? " " + currentIndex.integerRef.Key : ""); ; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 56176eef6b396a442b08b88220304436 |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,90 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Loop over each element in the given collection. |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"For Each", |
||||||
|
"Loop over each element in the given collection, similar to a foreach but internally uses indicies")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class ForEach : Condition, ICollectionCompatible |
||||||
|
{ |
||||||
|
[SerializeField] |
||||||
|
protected CollectionData collection; |
||||||
|
|
||||||
|
[SerializeField] |
||||||
|
[VariableProperty(compatibleVariableName = "collection")] |
||||||
|
protected Variable item; |
||||||
|
|
||||||
|
[SerializeField] |
||||||
|
[Tooltip("Optional")] |
||||||
|
protected IntegerData curIndex; |
||||||
|
|
||||||
|
#region Public members |
||||||
|
|
||||||
|
public override bool IsLooping { get { return true; } } |
||||||
|
|
||||||
|
protected override void PreEvaluate() |
||||||
|
{ |
||||||
|
//if we came from the end then we are already looping, if not this is first loop so prep |
||||||
|
if (ParentBlock.PreviousActiveCommandIndex != endCommand.CommandIndex) |
||||||
|
{ |
||||||
|
curIndex.Value = -1; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected override bool EvaluateCondition() |
||||||
|
{ |
||||||
|
var col = collection.Value; |
||||||
|
curIndex.Value++; |
||||||
|
if (curIndex < col.Count) |
||||||
|
{ |
||||||
|
col.Get(curIndex, ref item); |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
protected override void OnFalse() |
||||||
|
{ |
||||||
|
MoveToEnd(); |
||||||
|
} |
||||||
|
|
||||||
|
protected override bool HasNeededProperties() |
||||||
|
{ |
||||||
|
return collection.Value != null && item != null; |
||||||
|
} |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
return collection.collectionRef == variable || item == variable || |
||||||
|
base.HasReference(variable); |
||||||
|
} |
||||||
|
|
||||||
|
bool ICollectionCompatible.IsVarCompatibleWithCollection(Variable variable, string compatibleWith) |
||||||
|
{ |
||||||
|
if (compatibleWith == "collection") |
||||||
|
return collection.Value == null ? false : collection.Value.IsElementCompatible(variable); |
||||||
|
else |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
if (item == null) |
||||||
|
return "Error: No item var"; |
||||||
|
if (collection.Value == null) |
||||||
|
return "Error: No collection"; |
||||||
|
|
||||||
|
return item.Key + " in " + collection.Value.name; |
||||||
|
} |
||||||
|
|
||||||
|
#endregion Public members |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 1ce547d5384ce3a41b7142cab8ab41dd |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,51 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
[CommandInfo("GameObject", |
||||||
|
"FindAll", |
||||||
|
"Find all gameobjects by tag and store in a collection")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class GameObjectFind : CollectionBaseCommand |
||||||
|
{ |
||||||
|
[Tooltip("Find all gameobjects of tag")] |
||||||
|
[SerializeField] |
||||||
|
protected StringData tagString; |
||||||
|
|
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
var col = collection.Value; |
||||||
|
|
||||||
|
if (col != null) |
||||||
|
{ |
||||||
|
var res = GameObject.FindGameObjectsWithTag(tagString.Value); |
||||||
|
|
||||||
|
for (int i = 0; i < res.Length; i++) |
||||||
|
{ |
||||||
|
col.Add(res[i]); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
Continue(); |
||||||
|
} |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
return variable == tagString.stringRef || base.HasReference(variable); |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
if (collection.Value == null) |
||||||
|
return "Error: no collection selected"; |
||||||
|
|
||||||
|
if (!(collection.Value is GameObjectCollection)) |
||||||
|
return "Error: collection is not GameObjectCollection"; |
||||||
|
|
||||||
|
return tagString.Value + " GOs, store in " + collection.Value.name; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 8509f58e038dd8c46b98cab78d34e06a |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,162 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
[CommandInfo("Physics2D", |
||||||
|
"Cast2D", |
||||||
|
"Find all gameobjects hit by given physics shape overlap")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class Physics2DCast : CollectionBaseCommand |
||||||
|
{ |
||||||
|
public enum CastType |
||||||
|
{ |
||||||
|
Box, |
||||||
|
Capsule, |
||||||
|
Circle, |
||||||
|
Line, |
||||||
|
Ray, |
||||||
|
} |
||||||
|
|
||||||
|
[Tooltip("")] |
||||||
|
[SerializeField] |
||||||
|
protected CastType castType = CastType.Ray; |
||||||
|
|
||||||
|
[Tooltip("Starting point or centre of shape")] |
||||||
|
[SerializeField] |
||||||
|
protected Vector3Data position1; |
||||||
|
|
||||||
|
[Tooltip("")] |
||||||
|
[SerializeField] |
||||||
|
protected Vector3Data direction; |
||||||
|
|
||||||
|
[Tooltip("")] |
||||||
|
[SerializeField] |
||||||
|
protected FloatData maxDistance = new FloatData(float.PositiveInfinity); |
||||||
|
|
||||||
|
[Tooltip("CAPSULE & Circle ONLY")] |
||||||
|
[SerializeField] |
||||||
|
protected FloatData radius = new FloatData(0.5f); |
||||||
|
|
||||||
|
[Tooltip("BOX & CAPSULE ONLY")] |
||||||
|
[SerializeField] |
||||||
|
protected Vector3Data shapeSize = new Vector3Data(Vector3.one * 0.5f); |
||||||
|
|
||||||
|
[Tooltip("BOX & CAPSULE ONLY")] |
||||||
|
[SerializeField] |
||||||
|
protected FloatData shapeAngle; |
||||||
|
|
||||||
|
[Tooltip("LINE ONLY")] |
||||||
|
[SerializeField] |
||||||
|
protected Vector3Data lineEnd; |
||||||
|
|
||||||
|
[Tooltip("")] |
||||||
|
[SerializeField] |
||||||
|
protected LayerMask layerMask = ~0; |
||||||
|
|
||||||
|
[Tooltip("")] |
||||||
|
[SerializeField] |
||||||
|
protected FloatData minDepth = new FloatData(float.NegativeInfinity), maxDepth = new FloatData(float.PositiveInfinity); |
||||||
|
|
||||||
|
[SerializeField] |
||||||
|
protected CapsuleDirection2D capsuleDirection; |
||||||
|
|
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
var col = collection.Value; |
||||||
|
|
||||||
|
if (col != null) |
||||||
|
{ |
||||||
|
RaycastHit2D[] resHits = null; |
||||||
|
|
||||||
|
switch (castType) |
||||||
|
{ |
||||||
|
case CastType.Box: |
||||||
|
resHits = Physics2D.BoxCastAll(position1.Value, shapeSize.Value, shapeAngle.Value, direction.Value, maxDistance.Value, layerMask.value, minDepth.Value, maxDepth.Value); |
||||||
|
break; |
||||||
|
|
||||||
|
case CastType.Capsule: |
||||||
|
resHits = Physics2D.CapsuleCastAll(position1.Value, shapeSize.Value, capsuleDirection, shapeAngle.Value, direction.Value, maxDistance.Value, layerMask.value, minDepth.Value, maxDepth.Value); |
||||||
|
break; |
||||||
|
|
||||||
|
case CastType.Circle: |
||||||
|
resHits = Physics2D.CircleCastAll(position1.Value, radius.Value, direction.Value, maxDistance.Value, layerMask.value, minDepth.Value, maxDepth.Value); |
||||||
|
break; |
||||||
|
|
||||||
|
case CastType.Line: |
||||||
|
resHits = Physics2D.LinecastAll(position1.Value, lineEnd.Value, layerMask.value, minDepth.Value, maxDepth.Value); |
||||||
|
break; |
||||||
|
|
||||||
|
case CastType.Ray: |
||||||
|
resHits = Physics2D.RaycastAll(position1.Value, direction.Value, maxDistance.Value, layerMask.value, minDepth.Value, maxDepth.Value); |
||||||
|
break; |
||||||
|
|
||||||
|
default: |
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
PutCollidersIntoGameObjectCollection(resHits); |
||||||
|
} |
||||||
|
|
||||||
|
Continue(); |
||||||
|
} |
||||||
|
|
||||||
|
protected void PutCollidersIntoGameObjectCollection(RaycastHit2D[] resColliders) |
||||||
|
{ |
||||||
|
if (resColliders != null) |
||||||
|
{ |
||||||
|
var col = collection.Value; |
||||||
|
for (int i = 0; i < resColliders.Length; i++) |
||||||
|
{ |
||||||
|
col.Add(resColliders[i].collider.gameObject); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
return variable == position1.vector3Ref || |
||||||
|
variable == radius.floatRef || |
||||||
|
variable == shapeSize.vector3Ref || |
||||||
|
variable == shapeAngle.floatRef || |
||||||
|
variable == minDepth.floatRef || |
||||||
|
variable == maxDepth.floatRef || |
||||||
|
variable == direction.vector3Ref || |
||||||
|
variable == maxDistance.floatRef || |
||||||
|
variable == lineEnd.vector3Ref || |
||||||
|
base.HasReference(variable); |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
if (collection.Value == null) |
||||||
|
return "Error: no collection selected"; |
||||||
|
|
||||||
|
//TODO we could support more than just GOs |
||||||
|
if (!(collection.Value is GameObjectCollection)) |
||||||
|
return "Error: collection is not GameObjectCollection"; |
||||||
|
|
||||||
|
return castType.ToString() + ", store in " + collection.Value.name; |
||||||
|
} |
||||||
|
|
||||||
|
public override bool IsPropertyVisible(string propertyName) |
||||||
|
{ |
||||||
|
if (castType == CastType.Capsule && propertyName == "capsulePosition2") |
||||||
|
return true; |
||||||
|
|
||||||
|
if (castType == CastType.Line && propertyName == "lineEnd") |
||||||
|
return true; |
||||||
|
|
||||||
|
if ((castType == CastType.Capsule || castType == CastType.Circle) && propertyName == "radius") |
||||||
|
return true; |
||||||
|
|
||||||
|
if ((castType == CastType.Capsule || castType == CastType.Box) && |
||||||
|
(propertyName == "shapeAngle" || propertyName == "shapeSize")) |
||||||
|
return true; |
||||||
|
|
||||||
|
return base.IsPropertyVisible(propertyName); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: da8de59f5960f5c4b9d61002cc912b37 |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,154 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
[CommandInfo("Physics2D", |
||||||
|
"Overlap2D", |
||||||
|
"Find all gameobjects hit by given physics shape overlap")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class Physics2DOverlap : CollectionBaseCommand |
||||||
|
{ |
||||||
|
public enum Shape |
||||||
|
{ |
||||||
|
Point, |
||||||
|
Area, |
||||||
|
Box, |
||||||
|
Circle, |
||||||
|
Capsule, |
||||||
|
} |
||||||
|
|
||||||
|
[Tooltip("")] |
||||||
|
[SerializeField] |
||||||
|
protected Shape shape = Shape.Box; |
||||||
|
|
||||||
|
[Tooltip("Starting point or centre of shape")] |
||||||
|
[SerializeField] |
||||||
|
protected Vector3Data position1; |
||||||
|
|
||||||
|
[Tooltip("AREA ONLY")] |
||||||
|
[SerializeField] |
||||||
|
protected Vector3Data areaEndPosition; |
||||||
|
|
||||||
|
[Tooltip("CAPSULE & Circle ONLY")] |
||||||
|
[SerializeField] |
||||||
|
protected FloatData radius = new FloatData(0.5f); |
||||||
|
|
||||||
|
[Tooltip("BOX & CAPSULE ONLY")] |
||||||
|
[SerializeField] |
||||||
|
protected Vector3Data shapeSize = new Vector3Data(Vector3.one * 0.5f); |
||||||
|
|
||||||
|
[Tooltip("BOX & CAPSULE ONLY")] |
||||||
|
[SerializeField] |
||||||
|
protected FloatData shapeAngle; |
||||||
|
|
||||||
|
[Tooltip("")] |
||||||
|
[SerializeField] |
||||||
|
protected LayerMask layerMask = ~0; |
||||||
|
|
||||||
|
[Tooltip("")] |
||||||
|
[SerializeField] |
||||||
|
protected FloatData minDepth = new FloatData(float.NegativeInfinity), maxDepth = new FloatData(float.PositiveInfinity); |
||||||
|
|
||||||
|
[SerializeField] |
||||||
|
protected CapsuleDirection2D capsuleDirection; |
||||||
|
|
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
var col = collection.Value; |
||||||
|
|
||||||
|
if (col != null) |
||||||
|
{ |
||||||
|
Collider2D[] resColliders = null; |
||||||
|
|
||||||
|
switch (shape) |
||||||
|
{ |
||||||
|
case Shape.Area: |
||||||
|
resColliders = Physics2D.OverlapAreaAll(position1.Value, areaEndPosition.Value, layerMask.value, minDepth.Value, maxDepth.Value); |
||||||
|
break; |
||||||
|
|
||||||
|
case Shape.Box: |
||||||
|
resColliders = Physics2D.OverlapBoxAll(position1.Value, shapeSize.Value, shapeAngle.Value, layerMask.value, minDepth.Value, maxDepth.Value); |
||||||
|
break; |
||||||
|
|
||||||
|
case Shape.Circle: |
||||||
|
resColliders = Physics2D.OverlapCircleAll(position1.Value, radius.Value, layerMask.value, minDepth.Value, maxDepth.Value); |
||||||
|
break; |
||||||
|
|
||||||
|
case Shape.Capsule: |
||||||
|
resColliders = Physics2D.OverlapCapsuleAll(position1.Value, shapeSize.Value, capsuleDirection, shapeAngle.Value, layerMask.value, minDepth.Value, maxDepth.Value); |
||||||
|
break; |
||||||
|
|
||||||
|
case Shape.Point: |
||||||
|
resColliders = Physics2D.OverlapPointAll(position1.Value, layerMask.value, minDepth.Value, maxDepth.Value); |
||||||
|
break; |
||||||
|
|
||||||
|
default: |
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
PutCollidersIntoGameObjectCollection(resColliders); |
||||||
|
} |
||||||
|
|
||||||
|
Continue(); |
||||||
|
} |
||||||
|
|
||||||
|
protected void PutCollidersIntoGameObjectCollection(Collider2D[] resColliders) |
||||||
|
{ |
||||||
|
if (resColliders != null) |
||||||
|
{ |
||||||
|
var col = collection.Value; |
||||||
|
for (int i = 0; i < resColliders.Length; i++) |
||||||
|
{ |
||||||
|
col.Add(resColliders[i].gameObject); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
return variable == position1.vector3Ref || |
||||||
|
variable == areaEndPosition.vector3Ref || |
||||||
|
variable == radius.floatRef || |
||||||
|
variable == shapeSize.vector3Ref || |
||||||
|
variable == shapeAngle.floatRef || |
||||||
|
variable == minDepth.floatRef || |
||||||
|
variable == maxDepth.floatRef || |
||||||
|
base.HasReference(variable); |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
if (collection.Value == null) |
||||||
|
return "Error: no collection selected"; |
||||||
|
|
||||||
|
//TODO we could support more than just GOs |
||||||
|
if (!(collection.Value is GameObjectCollection)) |
||||||
|
return "Error: collection is not GameObjectCollection"; |
||||||
|
|
||||||
|
return shape.ToString() + ", store in " + collection.Value.name; |
||||||
|
} |
||||||
|
|
||||||
|
public override bool IsPropertyVisible(string propertyName) |
||||||
|
{ |
||||||
|
if (shape == Shape.Capsule && propertyName == "capsulePosition2") |
||||||
|
return true; |
||||||
|
|
||||||
|
if (shape == Shape.Area && propertyName == "areaEndPosition") |
||||||
|
return true; |
||||||
|
|
||||||
|
if ((shape == Shape.Capsule || shape == Shape.Circle) && propertyName == "radius") |
||||||
|
return true; |
||||||
|
|
||||||
|
if ((shape == Shape.Capsule || shape == Shape.Box) && propertyName == "shapeAngle") |
||||||
|
return true; |
||||||
|
|
||||||
|
if (shape == Shape.Box && (propertyName == "boxHalfExtends" || propertyName == "boxOrientation")) |
||||||
|
return true; |
||||||
|
|
||||||
|
return base.IsPropertyVisible(propertyName); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: c27aec18d802f45429190093660305e4 |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,147 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
[CommandInfo("Physics", |
||||||
|
"Cast", |
||||||
|
"Find all gameobjects hit by given physics shape cast")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class PhysicsCast : CollectionBaseCommand |
||||||
|
{ |
||||||
|
public enum CastType |
||||||
|
{ |
||||||
|
Box, |
||||||
|
Capsule, |
||||||
|
Ray, |
||||||
|
Sphere, |
||||||
|
} |
||||||
|
|
||||||
|
[SerializeField] |
||||||
|
protected CastType castType = CastType.Ray; |
||||||
|
|
||||||
|
[Tooltip("Starting point/origin or centre of shape")] |
||||||
|
[SerializeField] |
||||||
|
protected Vector3Data position1; |
||||||
|
|
||||||
|
[Tooltip("")] |
||||||
|
[SerializeField] |
||||||
|
protected Vector3Data direction; |
||||||
|
|
||||||
|
[Tooltip("")] |
||||||
|
[SerializeField] |
||||||
|
protected FloatData maxDistance = new FloatData(float.PositiveInfinity); |
||||||
|
|
||||||
|
[Tooltip("CAPSULE ONLY; end point of the capsule")] |
||||||
|
[SerializeField] |
||||||
|
protected Vector3Data capsulePosition2; |
||||||
|
|
||||||
|
[Tooltip("CAPSULE & SPHERE ONLY")] |
||||||
|
[SerializeField] |
||||||
|
protected FloatData radius = new FloatData(0.5f); |
||||||
|
|
||||||
|
[Tooltip("BOX ONLY")] |
||||||
|
[SerializeField] |
||||||
|
protected Vector3Data boxHalfExtends = new Vector3Data(Vector3.one * 0.5f); |
||||||
|
|
||||||
|
[Tooltip("BOX ONLY")] |
||||||
|
[SerializeField] |
||||||
|
protected QuaternionData boxOrientation = new QuaternionData(Quaternion.identity); |
||||||
|
|
||||||
|
[Tooltip("")] |
||||||
|
[SerializeField] |
||||||
|
protected LayerMask layerMask = ~0; |
||||||
|
|
||||||
|
[Tooltip("")] |
||||||
|
[SerializeField] |
||||||
|
protected QueryTriggerInteraction queryTriggerInteraction = QueryTriggerInteraction.UseGlobal; |
||||||
|
|
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
var col = collection.Value; |
||||||
|
|
||||||
|
if (col != null) |
||||||
|
{ |
||||||
|
RaycastHit[] resHits = null; |
||||||
|
|
||||||
|
switch (castType) |
||||||
|
{ |
||||||
|
case CastType.Ray: |
||||||
|
resHits = Physics.RaycastAll(position1.Value, direction.Value, maxDistance.Value, layerMask.value, queryTriggerInteraction); |
||||||
|
break; |
||||||
|
|
||||||
|
case CastType.Sphere: |
||||||
|
resHits = Physics.SphereCastAll(position1.Value, radius.Value, direction.Value, maxDistance.Value, layerMask.value, queryTriggerInteraction); |
||||||
|
break; |
||||||
|
|
||||||
|
case CastType.Box: |
||||||
|
resHits = Physics.BoxCastAll(position1.Value, boxHalfExtends.Value, direction.Value, boxOrientation.Value, maxDistance.Value, layerMask.value, queryTriggerInteraction); |
||||||
|
break; |
||||||
|
|
||||||
|
case CastType.Capsule: |
||||||
|
resHits = Physics.CapsuleCastAll(position1.Value, capsulePosition2.Value, radius.Value, direction.Value, maxDistance.Value, layerMask.value, queryTriggerInteraction); |
||||||
|
break; |
||||||
|
|
||||||
|
default: |
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
PutCollidersIntoGameObjectCollection(resHits); |
||||||
|
} |
||||||
|
|
||||||
|
Continue(); |
||||||
|
} |
||||||
|
|
||||||
|
protected void PutCollidersIntoGameObjectCollection(RaycastHit[] resHits) |
||||||
|
{ |
||||||
|
if (resHits != null) |
||||||
|
{ |
||||||
|
var col = collection.Value; |
||||||
|
for (int i = 0; i < resHits.Length; i++) |
||||||
|
{ |
||||||
|
col.Add(resHits[i].collider.gameObject); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
return variable == direction.vector3Ref || |
||||||
|
variable == maxDistance.floatRef || |
||||||
|
variable == position1.vector3Ref || |
||||||
|
variable == capsulePosition2.vector3Ref || |
||||||
|
variable == radius.floatRef || |
||||||
|
variable == boxHalfExtends.vector3Ref || |
||||||
|
variable == boxOrientation.quaternionRef || |
||||||
|
base.HasReference(variable); |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
if (collection.Value == null) |
||||||
|
return "Error: no collection selected"; |
||||||
|
|
||||||
|
//TODO we could support more than just GOs |
||||||
|
if (!(collection.Value is GameObjectCollection)) |
||||||
|
return "Error: collection is not GameObjectCollection"; |
||||||
|
|
||||||
|
return castType.ToString() + ", store in " + collection.Value.name; |
||||||
|
} |
||||||
|
|
||||||
|
public override bool IsPropertyVisible(string propertyName) |
||||||
|
{ |
||||||
|
if (castType == CastType.Capsule && propertyName == "capsulePosition2") |
||||||
|
return true; |
||||||
|
|
||||||
|
if ((castType == CastType.Capsule || castType == CastType.Sphere) && propertyName == "radius") |
||||||
|
return true; |
||||||
|
|
||||||
|
if (castType == CastType.Box && (propertyName == "boxHalfExtends" || propertyName == "boxOrientation")) |
||||||
|
return true; |
||||||
|
|
||||||
|
return base.IsPropertyVisible(propertyName); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 44a4b238cb3af004bbae4a6145089ea2 |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,136 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Physics", |
||||||
|
"Overlap", |
||||||
|
"Find all gameobjects hit by given physics shape overlap")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class PhysicsOverlap : CollectionBaseCommand |
||||||
|
{ |
||||||
|
public enum Shape |
||||||
|
{ |
||||||
|
Box, |
||||||
|
Capsule, |
||||||
|
Sphere, |
||||||
|
} |
||||||
|
|
||||||
|
[Tooltip("")] |
||||||
|
[SerializeField] |
||||||
|
protected Shape shape = Shape.Box; |
||||||
|
|
||||||
|
[Tooltip("Starting point or centre of shape")] |
||||||
|
[SerializeField] |
||||||
|
protected Vector3Data position1; |
||||||
|
|
||||||
|
[Tooltip("CAPSULE ONLY; end point of the capsule")] |
||||||
|
[SerializeField] |
||||||
|
protected Vector3Data capsulePosition2; |
||||||
|
|
||||||
|
[Tooltip("CAPSULE & SPHERE ONLY")] |
||||||
|
[SerializeField] |
||||||
|
protected FloatData radius = new FloatData(0.5f); |
||||||
|
|
||||||
|
[Tooltip("BOX ONLY")] |
||||||
|
[SerializeField] |
||||||
|
protected Vector3Data boxHalfExtends = new Vector3Data(Vector3.one * 0.5f); |
||||||
|
|
||||||
|
[Tooltip("BOX ONLY")] |
||||||
|
[SerializeField] |
||||||
|
protected QuaternionData boxOrientation = new QuaternionData(Quaternion.identity); |
||||||
|
|
||||||
|
[Tooltip("")] |
||||||
|
[SerializeField] |
||||||
|
protected LayerMask layerMask = ~0; |
||||||
|
|
||||||
|
[Tooltip("")] |
||||||
|
[SerializeField] |
||||||
|
protected QueryTriggerInteraction queryTriggerInteraction = QueryTriggerInteraction.UseGlobal; |
||||||
|
|
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
var col = collection.Value; |
||||||
|
|
||||||
|
if (col != null) |
||||||
|
{ |
||||||
|
Collider[] resColliders = null; |
||||||
|
|
||||||
|
switch (shape) |
||||||
|
{ |
||||||
|
case Shape.Box: |
||||||
|
resColliders = Physics.OverlapBox(position1.Value, boxHalfExtends.Value, boxOrientation.Value, layerMask.value, queryTriggerInteraction); |
||||||
|
break; |
||||||
|
|
||||||
|
case Shape.Sphere: |
||||||
|
resColliders = Physics.OverlapSphere(position1.Value, radius.Value, layerMask.value, queryTriggerInteraction); |
||||||
|
break; |
||||||
|
|
||||||
|
case Shape.Capsule: |
||||||
|
resColliders = Physics.OverlapCapsule(position1.Value, capsulePosition2.Value, radius.Value, layerMask.value, queryTriggerInteraction); |
||||||
|
break; |
||||||
|
|
||||||
|
default: |
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
PutCollidersIntoGameObjectCollection(resColliders); |
||||||
|
} |
||||||
|
|
||||||
|
Continue(); |
||||||
|
} |
||||||
|
|
||||||
|
protected void PutCollidersIntoGameObjectCollection(Collider[] resColliders) |
||||||
|
{ |
||||||
|
if (resColliders != null) |
||||||
|
{ |
||||||
|
var col = collection.Value; |
||||||
|
for (int i = 0; i < resColliders.Length; i++) |
||||||
|
{ |
||||||
|
col.Add(resColliders[i].gameObject); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
return variable == position1.vector3Ref || |
||||||
|
variable == capsulePosition2.vector3Ref || |
||||||
|
variable == radius.floatRef || |
||||||
|
variable == boxHalfExtends.vector3Ref || |
||||||
|
variable == boxOrientation.quaternionRef || |
||||||
|
base.HasReference(variable); |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
if (collection.Value == null) |
||||||
|
return "Error: no collection selected"; |
||||||
|
|
||||||
|
//TODO we could support more than just GOs |
||||||
|
if (!(collection.Value is GameObjectCollection)) |
||||||
|
return "Error: collection is not GameObjectCollection"; |
||||||
|
|
||||||
|
return shape.ToString() + ", store in " + collection.Value.name; |
||||||
|
} |
||||||
|
|
||||||
|
public override bool IsPropertyVisible(string propertyName) |
||||||
|
{ |
||||||
|
if (shape == Shape.Capsule && propertyName == "capsulePosition2") |
||||||
|
return true; |
||||||
|
|
||||||
|
if ((shape == Shape.Capsule || shape == Shape.Sphere) && propertyName == "radius") |
||||||
|
return true; |
||||||
|
|
||||||
|
if (shape == Shape.Box && (propertyName == "boxHalfExtends" || propertyName == "boxOrientation")) |
||||||
|
return true; |
||||||
|
|
||||||
|
return base.IsPropertyVisible(propertyName); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 5996bc0e902a19f4fa257341b0691de3 |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,41 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Calls DontDestroyOnLoad on the target gameobject. |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Scripting", |
||||||
|
"DestroyOnLoad", |
||||||
|
"Calls DontDestroyOnLoad on the target gameobject")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class DestroyOnLoad : Command |
||||||
|
{ |
||||||
|
[SerializeField] protected GameObjectData target; |
||||||
|
|
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
DontDestroyOnLoad(target.Value); |
||||||
|
|
||||||
|
Continue(); |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
return target.Value != null ? target.Value.name : "Error: no target set"; |
||||||
|
} |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
return variable == target.gameObjectRef; |
||||||
|
} |
||||||
|
|
||||||
|
public override Color GetButtonColor() |
||||||
|
{ |
||||||
|
return new Color32(235, 191, 217, 255); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 779fdb236b4ca6343a6d631108388e42 |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,89 @@ |
|||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
// <summary> |
||||||
|
/// Store Input.mousePosition and mouse screen conversions in a variable(s) |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Input", |
||||||
|
"Get Mouse Position", |
||||||
|
"Store various interpretations of Input.mousePosition")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class GetMousePosition : Command |
||||||
|
{ |
||||||
|
[VariableProperty(typeof(Vector2Variable))] |
||||||
|
[SerializeField] |
||||||
|
protected Vector2Variable screenPosition; |
||||||
|
|
||||||
|
[Tooltip("If null, Camera.main is used")] |
||||||
|
protected Camera castCamera; |
||||||
|
|
||||||
|
[VariableProperty(typeof(Vector2Variable))] |
||||||
|
[SerializeField] |
||||||
|
protected Vector2Variable viewPosition; |
||||||
|
|
||||||
|
[VariableProperty(typeof(Vector3Variable))] |
||||||
|
[SerializeField] |
||||||
|
protected Vector3Variable worldPosition; |
||||||
|
|
||||||
|
[VariableProperty(typeof(Vector3Variable))] |
||||||
|
[SerializeField] |
||||||
|
protected Vector3Variable worldDirection; |
||||||
|
|
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
if (castCamera == null) |
||||||
|
{ |
||||||
|
castCamera = Camera.main; |
||||||
|
} |
||||||
|
|
||||||
|
if (screenPosition != null) |
||||||
|
{ |
||||||
|
screenPosition.Value = Input.mousePosition; |
||||||
|
} |
||||||
|
|
||||||
|
if (viewPosition != null) |
||||||
|
{ |
||||||
|
viewPosition.Value = castCamera.ScreenToViewportPoint(Input.mousePosition); |
||||||
|
} |
||||||
|
|
||||||
|
if (worldPosition != null) |
||||||
|
{ |
||||||
|
var screenWithZ = Input.mousePosition; |
||||||
|
screenWithZ.z = castCamera.nearClipPlane; |
||||||
|
worldPosition.Value = castCamera.ScreenToWorldPoint(screenWithZ); |
||||||
|
} |
||||||
|
|
||||||
|
if (worldDirection != null) |
||||||
|
{ |
||||||
|
var screenWithZ = Input.mousePosition; |
||||||
|
screenWithZ.z = castCamera.nearClipPlane; |
||||||
|
worldDirection.Value = castCamera.ScreenPointToRay(screenWithZ).direction; |
||||||
|
} |
||||||
|
|
||||||
|
Continue(); |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
return (screenPosition != null ? screenPosition.Key + " " : "") + |
||||||
|
(castCamera != null ? castCamera.name + " " : "MainCam") + |
||||||
|
(viewPosition != null ? viewPosition.Key + " " : "") + |
||||||
|
(worldPosition != null ? worldPosition.Key + " " : "") + |
||||||
|
(worldDirection != null ? worldDirection.Key + " " : ""); |
||||||
|
} |
||||||
|
|
||||||
|
public override Color GetButtonColor() |
||||||
|
{ |
||||||
|
return new Color32(235, 191, 217, 255); |
||||||
|
} |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
return (screenPosition == variable || |
||||||
|
viewPosition == variable || |
||||||
|
worldPosition == variable || |
||||||
|
worldDirection == variable); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: fb32240870e5bf545a0dafba446d3990 |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,84 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) maintained by Chris Gregan (http://twitter.com/gofungus). |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Loop over a fixed integer range, similar to a common for loop. |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Flow", |
||||||
|
"Loop Range", |
||||||
|
"Loop over a fixed integer range, similar to a common for loop.")] |
||||||
|
[CommandInfo("Flow", |
||||||
|
"For", |
||||||
|
"Loop over a fixed integer range, similar to a common for loop.")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class LoopRange : Condition |
||||||
|
{ |
||||||
|
[Tooltip("Starting value for the counter variable")] |
||||||
|
[SerializeField] |
||||||
|
protected IntegerData startingValue; |
||||||
|
|
||||||
|
[Tooltip("End value for the counter variable, exclusive")] |
||||||
|
[SerializeField] |
||||||
|
protected IntegerData endValue; |
||||||
|
|
||||||
|
[Tooltip("Optional int var to hold the current loop counter.")] |
||||||
|
[SerializeField] |
||||||
|
protected IntegerData counter; |
||||||
|
|
||||||
|
[Tooltip("Step size for the counter, how much does it go up by each loop. Default 1")] |
||||||
|
[SerializeField] |
||||||
|
protected IntegerData step = new IntegerData(1); |
||||||
|
|
||||||
|
#region Public members |
||||||
|
|
||||||
|
public override bool IsLooping { get { return true; } } |
||||||
|
|
||||||
|
protected override void PreEvaluate() |
||||||
|
{ |
||||||
|
//if we came from the end then we are already looping, if not this is first loop so prep |
||||||
|
if (ParentBlock.PreviousActiveCommandIndex != endCommand.CommandIndex) |
||||||
|
{ |
||||||
|
counter.Value = startingValue.Value; |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
counter.Value += (startingValue.Value <= endValue.Value ? step.Value : -step.Value); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected override bool EvaluateCondition() |
||||||
|
{ |
||||||
|
return (startingValue.Value <= endValue.Value ? |
||||||
|
counter.Value < endValue.Value : |
||||||
|
counter.Value > endValue.Value); |
||||||
|
} |
||||||
|
|
||||||
|
protected override void OnFalse() |
||||||
|
{ |
||||||
|
MoveToEnd(); |
||||||
|
} |
||||||
|
|
||||||
|
public override void OnValidate() |
||||||
|
{ |
||||||
|
// no infinite loops |
||||||
|
if (step.Value == 0) |
||||||
|
step.Value = 1; |
||||||
|
|
||||||
|
//no negative steps, we do that automatically |
||||||
|
step.Value = Mathf.Abs(step.Value); |
||||||
|
} |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
return startingValue.integerRef == variable || endValue.integerRef == variable || |
||||||
|
counter.integerRef == variable || step.integerRef == variable || |
||||||
|
base.HasReference(variable); |
||||||
|
} |
||||||
|
|
||||||
|
#endregion |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: b0eebb5bf2fc1e542a35e2e5332e60d4 |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue