diff --git a/Assets/FungusExamples/FirstPerson/FPDemoPriorityRouter.cs b/Assets/FungusExamples/FirstPerson/FPDemoPriorityRouter.cs
index f5766ae0..601fd35d 100644
--- a/Assets/FungusExamples/FirstPerson/FPDemoPriorityRouter.cs
+++ b/Assets/FungusExamples/FirstPerson/FPDemoPriorityRouter.cs
@@ -2,50 +2,54 @@
using System.Collections.Generic;
using UnityEngine;
-public class FPDemoPriorityRouter : MonoBehaviour
-{
- public Behaviour[] componentEnabledOutsideFungusPriority;
- public Behaviour[] componentEnabledInsideFungusPriority;
-
- void OnEnable()
- {
- Fungus.FungusPrioritySignals.OnFungusPriorityStart += FungusPrioritySignals_OnFungusPriorityStart;
- Fungus.FungusPrioritySignals.OnFungusPriorityEnd += FungusPrioritySignals_OnFungusPriorityEnd;
- }
- void OnDisable()
+namespace Fungus.Examples
+{
+ public class FPDemoPriorityRouter : MonoBehaviour
{
- Fungus.FungusPrioritySignals.OnFungusPriorityStart -= FungusPrioritySignals_OnFungusPriorityStart;
- Fungus.FungusPrioritySignals.OnFungusPriorityEnd -= FungusPrioritySignals_OnFungusPriorityEnd;
- }
+ public Behaviour[] componentEnabledOutsideFungusPriority;
+ public Behaviour[] componentEnabledInsideFungusPriority;
- private void FungusPrioritySignals_OnFungusPriorityEnd()
- {
- foreach (var item in componentEnabledOutsideFungusPriority)
+ void OnEnable()
{
- item.enabled = true;
+ Fungus.FungusPrioritySignals.OnFungusPriorityStart += FungusPrioritySignals_OnFungusPriorityStart;
+ Fungus.FungusPrioritySignals.OnFungusPriorityEnd += FungusPrioritySignals_OnFungusPriorityEnd;
}
- foreach (var item in componentEnabledInsideFungusPriority)
+
+ void OnDisable()
{
- item.enabled = false;
+ Fungus.FungusPrioritySignals.OnFungusPriorityStart -= FungusPrioritySignals_OnFungusPriorityStart;
+ Fungus.FungusPrioritySignals.OnFungusPriorityEnd -= FungusPrioritySignals_OnFungusPriorityEnd;
}
- }
- private void FungusPrioritySignals_OnFungusPriorityStart()
- {
- foreach (var item in componentEnabledOutsideFungusPriority)
+ private void FungusPrioritySignals_OnFungusPriorityEnd()
{
- item.enabled = false;
+ foreach (var item in componentEnabledOutsideFungusPriority)
+ {
+ item.enabled = true;
+ }
+ foreach (var item in componentEnabledInsideFungusPriority)
+ {
+ item.enabled = false;
+ }
}
- foreach (var item in componentEnabledInsideFungusPriority)
+
+ private void FungusPrioritySignals_OnFungusPriorityStart()
{
- item.enabled = true;
+ foreach (var item in componentEnabledOutsideFungusPriority)
+ {
+ item.enabled = false;
+ }
+ foreach (var item in componentEnabledInsideFungusPriority)
+ {
+ item.enabled = true;
+ }
}
- }
- // Update is called once per frame
- void Update()
- {
+ // Update is called once per frame
+ void Update()
+ {
+ }
}
-}
+}
\ No newline at end of file
diff --git a/Assets/FungusExamples/FirstPerson/FirstPersonDemo.unity b/Assets/FungusExamples/FirstPerson/FirstPersonDemo.unity
index 0b6f1465..99e660ea 100644
--- a/Assets/FungusExamples/FirstPerson/FirstPersonDemo.unity
+++ b/Assets/FungusExamples/FirstPerson/FirstPersonDemo.unity
@@ -1681,7 +1681,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 61dddfdc5e0e44ca298d8f46f7f5a915, type: 3}
m_Name:
m_EditorClassIdentifier:
- selectedFlowchart: {fileID: 1112454213}
+ selectedFlowchart: {fileID: 640305175}
--- !u!4 &428461411
Transform:
m_ObjectHideFlags: 1
@@ -2142,6 +2142,7 @@ GameObject:
- component: {fileID: 640305192}
- component: {fileID: 640305190}
- component: {fileID: 640305191}
+ - component: {fileID: 640305193}
m_Layer: 0
m_Name: Intro
m_TagString: Untagged
@@ -2216,7 +2217,7 @@ MonoBehaviour:
selectedBlocks:
- {fileID: 640305181}
selectedCommands:
- - {fileID: 640305190}
+ - {fileID: 640305193}
variables: []
description:
stepPause: 0
@@ -2347,6 +2348,7 @@ MonoBehaviour:
- {fileID: 640305190}
- {fileID: 640305187}
- {fileID: 640305184}
+ - {fileID: 640305193}
--- !u!114 &640305182
MonoBehaviour:
m_ObjectHideFlags: 2
@@ -2604,6 +2606,33 @@ MonoBehaviour:
stopVoiceover: 1
waitForVO: 0
setSayDialog: {fileID: 0}
+--- !u!114 &640305193
+MonoBehaviour:
+ m_ObjectHideFlags: 2
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 640305172}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 688e35811870d403f9e2b1ab2a699d98, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ itemId: 17
+ indentLevel: 0
+ description:
+ targetObject: {fileID: 1869019450}
+ targetComponentAssemblyName: Fungus.Examples.LookingAtDoor, Assembly-CSharp, Version=0.0.0.0,
+ Culture=neutral, PublicKeyToken=null
+ targetComponentFullname: UnityEngine.Component[]
+ targetComponentText: LookingAtDoor
+ targetMethod: ActivateNow
+ targetMethodText: 'ActivateNow (): Void'
+ methodParameters: []
+ saveReturnValue: 0
+ returnValueVariableKey:
+ returnValueType: System.Void
+ showInherited: 0
+ callMode: 0
--- !u!1 &640977583
GameObject:
m_ObjectHideFlags: 0
@@ -4040,7 +4069,7 @@ MonoBehaviour:
tint: {r: 1, g: 1, b: 1, a: 1}
useCustomTint: 0
itemId: 0
- blockName: New Block
+ blockName: Trigger
description:
eventHandler: {fileID: 1112454211}
commandList:
@@ -4071,10 +4100,8 @@ MonoBehaviour:
y: 0
width: 0
height: 0
- selectedBlocks:
- - {fileID: 1112454212}
- selectedCommands:
- - {fileID: 1112454210}
+ selectedBlocks: []
+ selectedCommands: []
variables:
- {fileID: 1112454209}
description:
@@ -4099,6 +4126,204 @@ BoxCollider:
serializedVersion: 2
m_Size: {x: 1, y: 3.9154902, z: 1.9876027}
m_Center: {x: 0, y: 0.03357935, z: -0.0018060207}
+--- !u!114 &1112454215
+MonoBehaviour:
+ m_ObjectHideFlags: 2
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1112454204}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: ebc295ba6aed8944fa3974a64f33cc42, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ itemId: 12
+ indentLevel: 0
+--- !u!114 &1112454216
+MonoBehaviour:
+ m_ObjectHideFlags: 2
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1112454204}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 93cb9773f2ca04e2bbf7a68ccfc23267, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ itemId: 11
+ indentLevel: 0
+--- !u!114 &1112454217
+MonoBehaviour:
+ m_ObjectHideFlags: 2
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1112454204}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: ec422cd568a9c4a31ad7c36d0572b9da, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ itemId: 10
+ indentLevel: 1
+ storyText: Yes, that's the door...
+ description:
+ character: {fileID: 92124522}
+ portrait: {fileID: 21300000, guid: bb66ae101c944a34e870fde3693b756d, type: 3}
+ voiceOverClip: {fileID: 0}
+ showAlways: 1
+ showCount: 1
+ extendPrevious: 0
+ fadeWhenDone: 1
+ waitForClick: 1
+ stopVoiceover: 1
+ waitForVO: 0
+ setSayDialog: {fileID: 0}
+--- !u!114 &1112454218
+MonoBehaviour:
+ m_ObjectHideFlags: 2
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1112454204}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 3fa968f01a7f9496bb50e13dfe16760d, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ itemId: 9
+ indentLevel: 0
+--- !u!114 &1112454219
+MonoBehaviour:
+ m_ObjectHideFlags: 2
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1112454204}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: ec422cd568a9c4a31ad7c36d0572b9da, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ itemId: 8
+ indentLevel: 1
+ storyText: "Yes, a door John. \n\nBut how to reach it."
+ description:
+ character: {fileID: 92124522}
+ portrait: {fileID: 21300000, guid: ab808050bc535a643afaf4755050339e, type: 3}
+ voiceOverClip: {fileID: 0}
+ showAlways: 1
+ showCount: 1
+ extendPrevious: 0
+ fadeWhenDone: 1
+ waitForClick: 1
+ stopVoiceover: 1
+ waitForVO: 0
+ setSayDialog: {fileID: 0}
+--- !u!114 &1112454220
+MonoBehaviour:
+ m_ObjectHideFlags: 2
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1112454204}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 70c5622b8a80845c980954170295f292, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ itemId: 7
+ indentLevel: 0
+ compareOperator: 0
+ variable: {fileID: 1112454209}
+ booleanData:
+ booleanRef: {fileID: 0}
+ booleanVal: 0
+ integerData:
+ integerRef: {fileID: 0}
+ integerVal: 0
+ floatData:
+ floatRef: {fileID: 0}
+ floatVal: 0
+ stringData:
+ stringRef: {fileID: 0}
+ stringVal:
+ animatorData:
+ animatorRef: {fileID: 0}
+ animatorVal: {fileID: 0}
+ audioSourceData:
+ audioSourceRef: {fileID: 0}
+ audioSourceVal: {fileID: 0}
+ colorData:
+ colorRef: {fileID: 0}
+ colorVal: {r: 0, g: 0, b: 0, a: 0}
+ gameObjectData:
+ gameObjectRef: {fileID: 0}
+ gameObjectVal: {fileID: 0}
+ materialData:
+ materialRef: {fileID: 0}
+ materialVal: {fileID: 0}
+ objectData:
+ objectRef: {fileID: 0}
+ objectVal: {fileID: 0}
+ rigidbody2DData:
+ rigidbody2DRef: {fileID: 0}
+ rigidbody2DVal: {fileID: 0}
+ spriteData:
+ spriteRef: {fileID: 0}
+ spriteVal: {fileID: 0}
+ textureData:
+ textureRef: {fileID: 0}
+ textureVal: {fileID: 0}
+ transformData:
+ transformRef: {fileID: 0}
+ transformVal: {fileID: 0}
+ vector2Data:
+ vector2Ref: {fileID: 0}
+ vector2Val: {x: 0, y: 0}
+ vector3Data:
+ vector3Ref: {fileID: 0}
+ vector3Val: {x: 0, y: 0, z: 0}
+--- !u!114 &1112454221
+MonoBehaviour:
+ m_ObjectHideFlags: 2
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1112454204}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 3d07cf5e706b13a4eb0ae53386c30fbd, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ itemId: 6
+ indentLevel: 0
+--- !u!114 &1112454222
+MonoBehaviour:
+ m_ObjectHideFlags: 2
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1112454204}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 3d3d73aef2cfc4f51abf34ac00241f60, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ nodeRect:
+ serializedVersion: 2
+ x: 295
+ y: 167
+ width: 120
+ height: 40
+ tint: {r: 1, g: 1, b: 1, a: 1}
+ useCustomTint: 0
+ itemId: 33
+ blockName: HasGazedAt
+ description:
+ eventHandler: {fileID: 0}
+ commandList:
+ - {fileID: 1112454221}
+ - {fileID: 1112454220}
+ - {fileID: 1112454219}
+ - {fileID: 1112454218}
+ - {fileID: 1112454217}
+ - {fileID: 1112454216}
+ - {fileID: 1112454215}
--- !u!1001 &1131486901
Prefab:
m_ObjectHideFlags: 0
@@ -4154,6 +4379,11 @@ Transform:
m_CorrespondingSourceObject: {fileID: 400000, guid: 93e86b57e56570d46814839867bf9a52,
type: 2}
m_PrefabInternal: {fileID: 1131486901}
+--- !u!4 &1135845069 stripped
+Transform:
+ m_CorrespondingSourceObject: {fileID: 400002, guid: 5e9e851c0e142814dac026a256ba2ac0,
+ type: 2}
+ m_PrefabInternal: {fileID: 1741904151}
--- !u!1001 &1226998104
Prefab:
m_ObjectHideFlags: 0
@@ -5450,7 +5680,8 @@ MonoBehaviour:
height: 0
selectedBlocks:
- {fileID: 1788221409}
- selectedCommands: []
+ selectedCommands:
+ - {fileID: 1788221406}
variables: []
description:
stepPause: 0
@@ -5659,6 +5890,22 @@ MonoBehaviour:
- {fileID: 1869019454}
componentEnabledInsideFungusPriority:
- {fileID: 1869019457}
+--- !u!114 &1869019452
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1869019450}
+ m_Enabled: 0
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: db36b7852b6f9b54e8d797861d0c5560, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ doorCol: {fileID: 1112454214}
+ gazeTime: 0.2
+ runBlockWhenGazed:
+ block: {fileID: 1112454222}
+ eye: {fileID: 1135845069}
--- !u!114 &1869019454 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 11400000, guid: 5e9e851c0e142814dac026a256ba2ac0,
diff --git a/Assets/FungusExamples/FirstPerson/ForceCursorVisible.cs b/Assets/FungusExamples/FirstPerson/ForceCursorVisible.cs
index 67ded9f1..8fc2ac8a 100644
--- a/Assets/FungusExamples/FirstPerson/ForceCursorVisible.cs
+++ b/Assets/FungusExamples/FirstPerson/ForceCursorVisible.cs
@@ -2,14 +2,17 @@
using System.Collections.Generic;
using UnityEngine;
-///
-/// Helper for FirstPerson Fungus Demo to work around some of the inflexibility of the Unity standard fps controller
-///
-public class ForceCursorVisible : MonoBehaviour
+namespace Fungus.Examples
{
- void Update()
+ ///
+ /// Helper for FirstPerson Fungus Demo to work around some of the inflexibility of the Unity standard fps controller
+ ///
+ public class ForceCursorVisible : MonoBehaviour
{
- Cursor.visible = true;
- Cursor.lockState = CursorLockMode.None;
+ void Update()
+ {
+ Cursor.visible = true;
+ Cursor.lockState = CursorLockMode.None;
+ }
}
-}
+}
\ No newline at end of file
diff --git a/Assets/FungusExamples/FirstPerson/LookingAtDoor.cs b/Assets/FungusExamples/FirstPerson/LookingAtDoor.cs
new file mode 100644
index 00000000..f4621a7b
--- /dev/null
+++ b/Assets/FungusExamples/FirstPerson/LookingAtDoor.cs
@@ -0,0 +1,46 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace Fungus.Examples
+{
+ public class LookingAtDoor : MonoBehaviour
+ {
+ public Collider doorCol;
+ public float gazeTime = 0.2f;
+ private float gazeCounter = 0;
+ public BlockReference runBlockWhenGazed;
+ public Transform eye;
+
+ public void ActivateNow()
+ {
+ enabled = true;
+ }
+
+ private void Update()
+ {
+ RaycastHit hit;
+ if(Physics.Raycast(eye.position, eye.forward, out hit))
+ {
+ if(hit.collider == doorCol)
+ {
+ gazeCounter += Time.deltaTime;
+ }
+ else
+ {
+ gazeCounter = 0;
+ }
+ }
+ else
+ {
+ gazeCounter = 0;
+ }
+
+ if(gazeCounter >= gazeTime)
+ {
+ runBlockWhenGazed.Execute();
+ enabled = false;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Assets/FungusExamples/FirstPerson/LookingAtDoor.cs.meta b/Assets/FungusExamples/FirstPerson/LookingAtDoor.cs.meta
new file mode 100644
index 00000000..f2bc6f43
--- /dev/null
+++ b/Assets/FungusExamples/FirstPerson/LookingAtDoor.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: db36b7852b6f9b54e8d797861d0c5560
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant: