Browse Source

Merge branch 'develop' into 2017.4

Minor scene corrections
master
shalliwell 5 years ago
parent
commit
45ca6694d9
  1. 34
      .github/ISSUE_TEMPLATE/bug_report.md
  2. 22
      .github/ISSUE_TEMPLATE/feature_request.md
  3. 42
      .github/pull_request_template.md
  4. 1
      .gitignore
  5. 3
      Assets/Fungus/Docs/CHANGELOG.txt
  6. 434
      Assets/Fungus/Resources/Prefabs/NarrativeLog.prefab
  7. 7
      Assets/Fungus/Resources/Prefabs/NarrativeLog.prefab.meta
  8. 269
      Assets/Fungus/Resources/Prefabs/NarrativeLogEntryDisplay.prefab
  9. 7
      Assets/Fungus/Resources/Prefabs/NarrativeLogEntryDisplay.prefab.meta
  10. 70
      Assets/Fungus/Scripts/Commands/AssertCommand.cs
  11. 11
      Assets/Fungus/Scripts/Commands/AssertCommand.cs.meta
  12. 52
      Assets/Fungus/Scripts/Commands/Break.cs
  13. 4
      Assets/Fungus/Scripts/Commands/Call.cs
  14. 2
      Assets/Fungus/Scripts/Commands/CallMethod.cs
  15. 2
      Assets/Fungus/Scripts/Commands/ClearMenu.cs
  16. 5
      Assets/Fungus/Scripts/Commands/Collection.meta
  17. 35
      Assets/Fungus/Scripts/Commands/Collection/CollectionBaseCommand.cs
  18. 11
      Assets/Fungus/Scripts/Commands/Collection/CollectionBaseCommand.cs.meta
  19. 42
      Assets/Fungus/Scripts/Commands/Collection/CollectionBaseIntCommand.cs
  20. 11
      Assets/Fungus/Scripts/Commands/Collection/CollectionBaseIntCommand.cs.meta
  21. 50
      Assets/Fungus/Scripts/Commands/Collection/CollectionBaseTwoCollectionCommand.cs
  22. 11
      Assets/Fungus/Scripts/Commands/Collection/CollectionBaseTwoCollectionCommand.cs.meta
  23. 47
      Assets/Fungus/Scripts/Commands/Collection/CollectionBaseVarAndIntCommand.cs
  24. 11
      Assets/Fungus/Scripts/Commands/Collection/CollectionBaseVarAndIntCommand.cs.meta
  25. 54
      Assets/Fungus/Scripts/Commands/Collection/CollectionBaseVarCommand.cs
  26. 11
      Assets/Fungus/Scripts/Commands/Collection/CollectionBaseVarCommand.cs.meta
  27. 39
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandAdd.cs
  28. 11
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandAdd.cs.meta
  29. 39
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandAddAll.cs
  30. 11
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandAddAll.cs.meta
  31. 27
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandClear.cs
  32. 11
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandClear.cs.meta
  33. 37
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandContains.cs
  34. 11
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandContains.cs.meta
  35. 53
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandContainsAll.cs
  36. 11
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandContainsAll.cs.meta
  37. 37
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandContainsAny.cs
  38. 11
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandContainsAny.cs.meta
  39. 22
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandCopy.cs
  40. 11
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandCopy.cs.meta
  41. 25
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandCount.cs
  42. 11
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandCount.cs.meta
  43. 53
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandElement.cs
  44. 11
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandElement.cs.meta
  45. 24
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandExclusive.cs
  46. 11
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandExclusive.cs.meta
  47. 41
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandFind.cs
  48. 11
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandFind.cs.meta
  49. 22
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandInsert.cs
  50. 11
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandInsert.cs.meta
  51. 22
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandIntersection.cs
  52. 11
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandIntersection.cs.meta
  53. 22
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandOccurrences.cs
  54. 11
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandOccurrences.cs.meta
  55. 39
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandRemove.cs
  56. 11
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandRemove.cs.meta
  57. 22
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandRemoveAllOf.cs
  58. 11
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandRemoveAllOf.cs.meta
  59. 22
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandRemoveAt.cs
  60. 11
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandRemoveAt.cs.meta
  61. 22
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandReserve.cs
  62. 11
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandReserve.cs.meta
  63. 22
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandResize.cs
  64. 11
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandResize.cs.meta
  65. 27
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandReverse.cs
  66. 11
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandReverse.cs.meta
  67. 27
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandShuffle.cs
  68. 11
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandShuffle.cs.meta
  69. 27
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandSort.cs
  70. 11
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandSort.cs.meta
  71. 27
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandUnique.cs
  72. 11
      Assets/Fungus/Scripts/Commands/Collection/CollectionCommandUnique.cs.meta
  73. 22
      Assets/Fungus/Scripts/Commands/Collection/CollectionRandom.cs
  74. 11
      Assets/Fungus/Scripts/Commands/Collection/CollectionRandom.cs.meta
  75. 80
      Assets/Fungus/Scripts/Commands/Collection/CollectionRandomBag.cs
  76. 11
      Assets/Fungus/Scripts/Commands/Collection/CollectionRandomBag.cs.meta
  77. 90
      Assets/Fungus/Scripts/Commands/Collection/ForEach.cs
  78. 11
      Assets/Fungus/Scripts/Commands/Collection/ForEach.cs.meta
  79. 51
      Assets/Fungus/Scripts/Commands/Collection/GameObjectFind.cs
  80. 11
      Assets/Fungus/Scripts/Commands/Collection/GameObjectFind.cs.meta
  81. 162
      Assets/Fungus/Scripts/Commands/Collection/Physics2DCast.cs
  82. 11
      Assets/Fungus/Scripts/Commands/Collection/Physics2DCast.cs.meta
  83. 154
      Assets/Fungus/Scripts/Commands/Collection/Physics2DOverlap.cs
  84. 11
      Assets/Fungus/Scripts/Commands/Collection/Physics2DOverlap.cs.meta
  85. 147
      Assets/Fungus/Scripts/Commands/Collection/PhysicsCast.cs
  86. 11
      Assets/Fungus/Scripts/Commands/Collection/PhysicsCast.cs.meta
  87. 136
      Assets/Fungus/Scripts/Commands/Collection/PhysicsOverlap.cs
  88. 11
      Assets/Fungus/Scripts/Commands/Collection/PhysicsOverlap.cs.meta
  89. 2
      Assets/Fungus/Scripts/Commands/Comment.cs
  90. 248
      Assets/Fungus/Scripts/Commands/Condition.cs
  91. 2
      Assets/Fungus/Scripts/Commands/ControlAudio.cs
  92. 2
      Assets/Fungus/Scripts/Commands/ControlStage.cs
  93. 2
      Assets/Fungus/Scripts/Commands/ControlWithDisplay.cs
  94. 2
      Assets/Fungus/Scripts/Commands/Conversation.cs
  95. 2
      Assets/Fungus/Scripts/Commands/DebugBreak.cs
  96. 2
      Assets/Fungus/Scripts/Commands/DebugLog.cs
  97. 2
      Assets/Fungus/Scripts/Commands/DeleteSaveKey.cs
  98. 2
      Assets/Fungus/Scripts/Commands/Destroy.cs
  99. 41
      Assets/Fungus/Scripts/Commands/DestroyOnLoad.cs
  100. 11
      Assets/Fungus/Scripts/Commands/DestroyOnLoad.cs.meta
  101. Some files were not shown because too many files have changed in this diff Show More

34
.github/ISSUE_TEMPLATE/bug_report.md

@ -0,0 +1,34 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is. Is it a bug during playback or a bug in editing Flowcharts, Blocks, Commands, and so on? When and where it is happening, is it only in editor or only in build or both?
**To Reproduce**
In order for someone else to attempt to solve the issue we need to know how to make it occur. As such when reporting bugs please detail how to make them occur in existing FungusExample scenes, or how to create a scene from empty, or attach a unitypackage with a minimal scene in it.
Then describe the steps to reproduce the behavior:
1. Go to the scene '...' in the FungusExample ***OR*** In a new scene, add the following '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Versions & Platform (please complete the following information):**
- Unity version [e.g. 2019.2.20f1 or 2017.4.25]
- Fungus Version[e.g. v.3.12.0] This can be found in your Docs/ChangeLog or via Preferences->Fungus
- Editor OS: [e.g. Win 10 or OSX Mavericks]
- Build Platform [e.g. WebGL, Windows IL2CPP, iOS, Android]
**Additional context**
Add any other context about the problem here.

22
.github/ISSUE_TEMPLATE/feature_request.md

@ -0,0 +1,22 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
Please double check the feature or suggestion you have has not already been raised by searching within the existing [issues](https://github.com/snozbot/fungus/issues). If you find something similar to what you were thinking, please reply to the existing issue with either additional details/suggestions or simply a +1.
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

42
.github/pull_request_template.md

@ -0,0 +1,42 @@
🚨Before submitting this PR.
- Please review the [guidelines for contributing](./CONTRIBUTING.md) to this repository.
- We welcome the submission of incomplete PRs, for comment, feedback, or assistance. Please prefix the PR with [WIP].
- Make sure you are making a pull request against the **develop branch** (left side). Also you should start *your branch* off *develop*.
- Make sure you are requesting to **pull a topic/feature/bugfix branch** (right side). We don't recommend you request from your master!
- Check the commit's or even all commits' message styles matches our style and structure.
- Check your code additions pass all tests.
- Check your code additions have not negatively impacted or altered the behaviour of the FungusExamples.
- If adding a new feature, ensure you have added a demo to the FungusExamples and if possible added Tests too.
💔Thank you! With that done and out of the way, you can remove all the above text and get to submitting this PR.
### Description
<!-- Please describe your pull request. Is it a bug fix, a new feature, code refactor, documentation update, etc.-->
### What is the current behavior?
<!-- Please describe the current behavior that you are modifying, and link to a relevant issue.
Issue Number: N/A
-->
### What is the new behavior?
<!-- Please describe the behavior or changes that are being added by this PR. -->
-
-
-
### Important Notes
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
- [ ] My change require changes to documentation
- My changes modify
- [ ] the editing of flowcharts/blocks/commands etc.
- [ ] the runtime execution of existing Fungus Features. e.g., Say, Menus, Portraits, etc.
- [ ] My change adds additional tests
- [ ] My change modifies existing FungusExamples
<!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. -->
### Other information
<!-- Any other information that is important to this PR such as screenshots, gifs, video of before and after the change are always great -->

1
.gitignore vendored

@ -17,3 +17,4 @@ UWP/*
Assets/Plugins/
Assets/Plugins.meta
Logs/*
.vscode/launch.json

3
Assets/Fungus/Docs/CHANGELOG.txt

@ -1,7 +1,7 @@
Changelog {#changelog}
=========
v3.12.0 rc1
v3.12.0
======
## Added
@ -32,6 +32,7 @@ v3.12.0 rc1
- More elaborated use of text in TMPro demo
- Block Inspector forces type at creation. Thanks to Michaelwolf95
- Warning when requesting menu elements that are not avaialble, such as more menu items that you have created.
- Fungus Docs can now generate in github markdown format
v3.11.5 {#v3.11.5}

434
Assets/Fungus/Resources/Prefabs/NarrativeLog.prefab

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

7
Assets/Fungus/Resources/Prefabs/NarrativeLog.prefab.meta

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

269
Assets/Fungus/Resources/Prefabs/NarrativeLogEntryDisplay.prefab

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

7
Assets/Fungus/Resources/Prefabs/NarrativeLogEntryDisplay.prefab.meta

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

70
Assets/Fungus/Scripts/Commands/AssertCommand.cs

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

11
Assets/Fungus/Scripts/Commands/AssertCommand.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c40b126bd148ae743b56bc8c00162589
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

52
Assets/Fungus/Scripts/Commands/Break.cs

@ -1,4 +1,4 @@
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// 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;
@ -8,61 +8,39 @@ namespace Fungus
/// <summary>
/// Force a loop to terminate immediately.
/// </summary>
[CommandInfo("Flow",
"Break",
[CommandInfo("Flow",
"Break",
"Force a loop to terminate immediately.")]
[AddComponentMenu("")]
public class Break : Command
{
#region Public members
//located the containing loop and tell it to end
public override void OnEnter()
{
// Find index of previous while command
int whileIndex = -1;
int whileIndentLevel = -1;
for (int i = CommandIndex - 1; i >=0; --i)
Condition loopingCond = null;
// Find index of previous looping command
for (int i = CommandIndex - 1; i >= 0; --i)
{
While whileCommand = ParentBlock.CommandList[i] as While;
if (whileCommand != null)
Condition cond = ParentBlock.CommandList[i] as Condition;
if (cond != null && cond.IsLooping)
{
whileIndex = i;
whileIndentLevel = whileCommand.IndentLevel;
loopingCond = cond;
break;
}
}
if (whileIndex == -1)
if (loopingCond == null)
{
// No enclosing While command found, just continue
// No enclosing loop command found, just continue
Debug.LogError("Break called but found no enclosing looping construct." + GetLocationIdentifier());
Continue();
return;
}
// Find matching End statement at same indent level as While
for (int i = whileIndex + 1; i < ParentBlock.CommandList.Count; ++i)
else
{
End endCommand = ParentBlock.CommandList[i] as End;
if (endCommand != null &&
endCommand.IndentLevel == whileIndentLevel)
{
// Sanity check that break command is actually between the While and End commands
if (CommandIndex > whileIndex && CommandIndex < endCommand.CommandIndex)
{
// Continue at next command after End
Continue (endCommand.CommandIndex + 1);
return;
}
else
{
break;
}
}
loopingCond.MoveToEnd();
}
// No matching End command found so just continue
Continue();
}
public override Color GetButtonColor()

4
Assets/Fungus/Scripts/Commands/Call.cs

@ -1,4 +1,4 @@
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// 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;
@ -53,8 +53,6 @@ namespace Fungus
public override void OnEnter()
{
var flowchart = GetFlowchart();
if (targetBlock != null)
{
// Check if calling your own parent block

2
Assets/Fungus/Scripts/Commands/CallMethod.cs

@ -1,4 +1,4 @@
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// 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;

2
Assets/Fungus/Scripts/Commands/ClearMenu.cs

@ -1,4 +1,4 @@
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// 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;

5
Assets/Fungus/Scripts/Commands/Transform.meta → Assets/Fungus/Scripts/Commands/Collection.meta

@ -1,9 +1,8 @@
fileFormatVersion: 2
guid: f7ddb80a0487d1342b36129da32ad1f6
guid: 7d7820abad934b747ae1797c3aa82197
folderAsset: yes
timeCreated: 1503815490
licenseType: Free
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

35
Assets/Fungus/Scripts/Commands/Collection/CollectionBaseCommand.cs

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

11
Assets/Fungus/Scripts/Commands/Collection/CollectionBaseCommand.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: dab2b4efcfae62841b5070c4cfec8c4a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

42
Assets/Fungus/Scripts/Commands/Collection/CollectionBaseIntCommand.cs

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

11
Assets/Fungus/Scripts/Commands/Collection/CollectionBaseIntCommand.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 328b7e125f24d5349be4fe583267ba1d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

50
Assets/Fungus/Scripts/Commands/Collection/CollectionBaseTwoCollectionCommand.cs

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

11
Assets/Fungus/Scripts/Commands/Collection/CollectionBaseTwoCollectionCommand.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c4010b5577069fc4cb9480f87ed3f73e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

47
Assets/Fungus/Scripts/Commands/Collection/CollectionBaseVarAndIntCommand.cs

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

11
Assets/Fungus/Scripts/Commands/Collection/CollectionBaseVarAndIntCommand.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 561b53abc515d704d8845caa3b3ee26f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

54
Assets/Fungus/Scripts/Commands/Collection/CollectionBaseVarCommand.cs

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

11
Assets/Fungus/Scripts/Commands/Collection/CollectionBaseVarCommand.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fe12b6eb87e59984cb4122f978f11e45
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

39
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandAdd.cs

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

11
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandAdd.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a30a3b6902ecde54ea81d503f6a2b27e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

39
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandAddAll.cs

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

11
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandAddAll.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5688faa1580d8d147b59e18fcdd888ad
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

27
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandClear.cs

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

11
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandClear.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8b071472a9dcdc7469059042e2e6e50d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

37
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandContains.cs

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

11
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandContains.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6bd67ee6ac8134b4e9aea26299040034
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

53
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandContainsAll.cs

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

11
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandContainsAll.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1df2de5cf986f9d419a124bb9d834b11
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

37
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandContainsAny.cs

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

11
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandContainsAny.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c4e05f36271510b41a7d7889025e180e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

22
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandCopy.cs

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

11
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandCopy.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 820324be5b6a927469519df54a9bbad0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

25
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandCount.cs

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

11
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandCount.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 31765259d3ac50e4993fd654cd7ea78b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

53
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandElement.cs

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

11
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandElement.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: bf40659a274400d40856f146223798ac
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

24
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandExclusive.cs

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

11
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandExclusive.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 824e24d12ca84774ea135507417e94a1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

41
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandFind.cs

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

11
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandFind.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 59afe81b26e37ea4ea10dd91dfeee937
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

22
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandInsert.cs

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

11
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandInsert.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: dd126ef47d8264a4d8a6aac5b4f3fb12
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

22
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandIntersection.cs

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

11
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandIntersection.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 586c189d813b1b045ba358c612f4a6eb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

22
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandOccurrences.cs

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

11
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandOccurrences.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 75a3711bc9cd44e429e15e10f6029fae
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

39
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandRemove.cs

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

11
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandRemove.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6e2313a05ce56ea49bbf1922b58d793a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

22
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandRemoveAllOf.cs

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

11
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandRemoveAllOf.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2bb49f43c99a0af4db604a1770b31e83
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

22
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandRemoveAt.cs

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

11
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandRemoveAt.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c8ee8f64433f29a4f82b03a8e6550ae2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

22
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandReserve.cs

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

11
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandReserve.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4672406760fa8f340aabac4528f04c1c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

22
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandResize.cs

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

11
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandResize.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3ce11d7cce59a3340937a8d112cd4ad5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

27
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandReverse.cs

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

11
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandReverse.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d7359fcb744d14a41acae4b3a2e34b73
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

27
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandShuffle.cs

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

11
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandShuffle.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a15d511e013edfe45a0a4726bda90c8f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

27
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandSort.cs

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

11
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandSort.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 00093f39e8583954ba5935bca806f0f1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

27
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandUnique.cs

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

11
Assets/Fungus/Scripts/Commands/Collection/CollectionCommandUnique.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 59ae026a39db9cf4d8453309fa6192db
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

22
Assets/Fungus/Scripts/Commands/Collection/CollectionRandom.cs

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

11
Assets/Fungus/Scripts/Commands/Collection/CollectionRandom.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d58ddca8952c1a149a39835e2eeac9a7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

80
Assets/Fungus/Scripts/Commands/Collection/CollectionRandomBag.cs

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

11
Assets/Fungus/Scripts/Commands/Collection/CollectionRandomBag.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 56176eef6b396a442b08b88220304436
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

90
Assets/Fungus/Scripts/Commands/Collection/ForEach.cs

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

11
Assets/Fungus/Scripts/Commands/Collection/ForEach.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1ce547d5384ce3a41b7142cab8ab41dd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

51
Assets/Fungus/Scripts/Commands/Collection/GameObjectFind.cs

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

11
Assets/Fungus/Scripts/Commands/Collection/GameObjectFind.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8509f58e038dd8c46b98cab78d34e06a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

162
Assets/Fungus/Scripts/Commands/Collection/Physics2DCast.cs

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

11
Assets/Fungus/Scripts/Commands/Collection/Physics2DCast.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: da8de59f5960f5c4b9d61002cc912b37
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

154
Assets/Fungus/Scripts/Commands/Collection/Physics2DOverlap.cs

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

11
Assets/Fungus/Scripts/Commands/Collection/Physics2DOverlap.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c27aec18d802f45429190093660305e4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

147
Assets/Fungus/Scripts/Commands/Collection/PhysicsCast.cs

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

11
Assets/Fungus/Scripts/Commands/Collection/PhysicsCast.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 44a4b238cb3af004bbae4a6145089ea2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

136
Assets/Fungus/Scripts/Commands/Collection/PhysicsOverlap.cs

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

11
Assets/Fungus/Scripts/Commands/Collection/PhysicsOverlap.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5996bc0e902a19f4fa257341b0691de3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

2
Assets/Fungus/Scripts/Commands/Comment.cs

@ -1,4 +1,4 @@
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// 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;

248
Assets/Fungus/Scripts/Commands/Condition.cs

@ -1,118 +1,166 @@
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// 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 for all Conditional based Commands, Ifs, Loops, and so on.
/// </summary>
[AddComponentMenu("")]
public abstract class Condition : Command
{
public static string GetOperatorDescription(CompareOperator compareOperator)
protected End endCommand;
public override void OnEnter()
{
string summary = "";
switch (compareOperator)
if (ParentBlock == null)
{
case CompareOperator.Equals:
summary += "==";
break;
case CompareOperator.NotEquals:
summary += "!=";
break;
case CompareOperator.LessThan:
summary += "<";
break;
case CompareOperator.GreaterThan:
summary += ">";
break;
case CompareOperator.LessThanOrEquals:
summary += "<=";
break;
case CompareOperator.GreaterThanOrEquals:
summary += ">=";
break;
return;
}
return summary;
}
#region Public members
public override void OnEnter()
{
if (ParentBlock == null)
//if looping we need the end command in order to work
if(IsLooping && !EnsureRequiredEnd())
{
Debug.LogError(GetLocationIdentifier() + " is looping but has no matching End command");
Continue();
return;
}
if( !HasNeededProperties() )
if ( !HasNeededProperties() )
{
Debug.LogError(GetLocationIdentifier() + " cannot run due to missing required properties");
Continue();
return;
}
if( !this.IsElseIf )
//Ensuring we arrived at this elif honestly, not incorrectly due to fall through from a previous command
if (this.IsElseIf && !DoesPassElifSanityCheck())
{
//elif is being asked to run but didn't come from a previously failing if or elif, this isn't allowed
MoveToEnd();
return;
}
EvaluateAndContinue();
}
public override bool OpenBlock()
{
return true;
}
public override Color GetButtonColor()
{
return new Color32(253, 253, 150, 255);
}
public virtual bool IsLooping { get { return false; } }
/// <summary>
/// Moves execution to the closing End of the current command, attempts to locate end if not
/// already known and if no closing End exists.
/// </summary>
public virtual void MoveToEnd()
{
if(endCommand == null)
{
endCommand = FindOurEndCommand();
}
if (endCommand != null)
{
EvaluateAndContinue();
// Continue at next command after End
// and make the end non looping incase it gets run via index etc.
endCommand.Loop = false;
Continue(endCommand.CommandIndex + 1);
}
else
{
System.Type previousCommandType = ParentBlock.GetPreviousActiveCommandType();
var prevCmdIndent = ParentBlock.GetPreviousActiveCommandIndent();
//nowhere to go, so we assume the block wants to stop but is missing and end, this
// is also ensures back compat
Debug.LogWarning("Condition wants to move to end but no End command found, stopping block. " + GetLocationIdentifier());
StopParentBlock();
}
}
//handle our matching if or else if in the chain failing and moving to us,
// need to make sure it is the same indent level
if (prevCmdIndent == IndentLevel && previousCommandType.IsSubclassOf(typeof(Condition)))
{
// Else If behaves the same as an If command
EvaluateAndContinue();
}
else
{
// Else If behaves mostly like an Else command,
// but will also jump to a following Else command.
protected End FindOurEndCommand()
{
return FindMatchingEndCommand(this);
}
// Stop if this is the last command in the list
if (CommandIndex >= ParentBlock.CommandList.Count - 1)
{
StopParentBlock();
return;
}
/// <summary>
/// Helper to find the paired End Command for the given command.
/// </summary>
/// <param name="startCommand"></param>
/// <returns>Mathcing End Command or null if not found</returns>
public static End FindMatchingEndCommand(Command startCommand)
{
if (startCommand.ParentBlock == null)
return null;
int indent = startCommand.IndentLevel;
for (int i = startCommand.CommandIndex + 1; i < startCommand.ParentBlock.CommandList.Count; ++i)
{
var command = startCommand.ParentBlock.CommandList[i];
// Find the next End command at the same indent level as this Else If command
int indent = indentLevel;
for (int i = CommandIndex + 1; i < ParentBlock.CommandList.Count; ++i)
if (command.IndentLevel == indent)
{
if (command is End)
{
var command = ParentBlock.CommandList[i];
if (command.IndentLevel == indent)
{
System.Type type = command.GetType();
if (type == typeof(End))
{
// Execute command immediately after the Else or End command
Continue(command.CommandIndex + 1);
return;
}
}
return command as End;
}
// No End command found
StopParentBlock();
}
else if (command.IndentLevel < indent)
{
//managed to be less indent than the inner but not find and end, this shouldn't occur
// but may be user error or bad data, makes sense for completeness here
return null;
}
}
return null;
}
public override bool OpenBlock()
/// <summary>
/// Helper for child classes that require an End command to function. For IsLooping commands
/// this also configures the loopback within the End command.
/// </summary>
/// <returns></returns>
protected virtual bool EnsureRequiredEnd()
{
if (endCommand == null)
{
endCommand = FindOurEndCommand();
if (endCommand == null)
{
Debug.LogError( GetLocationIdentifier() + "', could not find closing End command and thus cannot loop.");
//StopParentBlock();
return false;
}
}
if (IsLooping)
{
// Tell the following end command to loop back
endCommand.Loop = true;
endCommand.LoopBackIndex = CommandIndex;
}
return true;
}
#endregion
/// <summary>
/// Called by OnEnter when the condition is needed to evaluate and continue execution.
/// Means child classes do not have to deal with erronuous execution conditions, like fall through.
/// </summary>
protected virtual void EvaluateAndContinue()
{
PreEvaluate();
if (EvaluateCondition())
{
OnTrue();
@ -123,17 +171,23 @@ namespace Fungus
}
}
/// <summary>
/// Called when the condition is run and EvaluateCondition returns true
/// </summary>
protected virtual void OnTrue()
{
Continue();
}
/// <summary>
/// Called when the condition is run and EvaluateCondition returns false
/// </summary>
protected virtual void OnFalse()
{
// Last command in block
if (CommandIndex >= ParentBlock.CommandList.Count)
//looping constructs only care about the end
if(IsLooping)
{
StopParentBlock();
MoveToEnd();
return;
}
@ -177,7 +231,6 @@ namespace Fungus
{
// Execute the Else If command
Continue(i);
return;
}
}
@ -186,10 +239,47 @@ namespace Fungus
StopParentBlock();
}
/// <summary>
/// Sits in the if within EvaluateAndContinue, if returns true, OnTrue will run, if false, OnFalse will run.
/// </summary>
protected abstract bool EvaluateCondition();
protected abstract bool HasNeededProperties();
/// <summary>
/// Child classes are required to report if it is possible for them to be evaulated.
/// </summary>
protected virtual bool HasNeededProperties() { return true; }
/// <summary>
/// Declare if the child class is implementing an 'else if' command, which requires some special handling
/// </summary>
protected virtual bool IsElseIf { get { return false; } }
/// <summary>
/// Called before EvaluateCondition, allowing for child classes to gather required data
/// </summary>
protected virtual void PreEvaluate() { }
/// <summary>
/// Ensure that this condition didn't come from a non matching if/elif.
/// </summary>
/// <returns></returns>
protected virtual bool DoesPassElifSanityCheck()
{
System.Type previousCommandType = ParentBlock.GetPreviousActiveCommandType();
var prevCmdIndent = ParentBlock.GetPreviousActiveCommandIndent();
var prevCmd = ParentBlock.GetPreviousActiveCommand();
//handle our matching if or else if in the chain failing and moving to us,
// need to make sure it is the same indent level
if (prevCmd == null ||
prevCmdIndent != IndentLevel ||
!previousCommandType.IsSubclassOf(typeof(Condition)) ||
(prevCmd as Condition).IsLooping)
{
return false;
}
return true;
}
}
}

2
Assets/Fungus/Scripts/Commands/ControlAudio.cs

@ -1,4 +1,4 @@
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// 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;

2
Assets/Fungus/Scripts/Commands/ControlStage.cs

@ -1,4 +1,4 @@
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// 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;

2
Assets/Fungus/Scripts/Commands/ControlWithDisplay.cs

@ -1,4 +1,4 @@
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// 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 System;

2
Assets/Fungus/Scripts/Commands/Conversation.cs

@ -1,4 +1,4 @@
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// 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;

2
Assets/Fungus/Scripts/Commands/DebugBreak.cs

@ -1,4 +1,4 @@
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// 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;

2
Assets/Fungus/Scripts/Commands/DebugLog.cs

@ -1,4 +1,4 @@
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// 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;

2
Assets/Fungus/Scripts/Commands/DeleteSaveKey.cs

@ -1,4 +1,4 @@
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// 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;

2
Assets/Fungus/Scripts/Commands/Destroy.cs

@ -1,4 +1,4 @@
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// 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;

41
Assets/Fungus/Scripts/Commands/DestroyOnLoad.cs

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

11
Assets/Fungus/Scripts/Commands/DestroyOnLoad.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 779fdb236b4ca6343a6d631108388e42
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…
Cancel
Save