Browse Source

Added LookingAtDoor check for FirstPerson demo

master
desktop-maesty/steve 7 years ago
parent
commit
5ffb4655ca
  1. 6
      Assets/FungusExamples/FirstPerson/FPDemoPriorityRouter.cs
  2. 263
      Assets/FungusExamples/FirstPerson/FirstPersonDemo.unity
  3. 11
      Assets/FungusExamples/FirstPerson/ForceCursorVisible.cs
  4. 46
      Assets/FungusExamples/FirstPerson/LookingAtDoor.cs
  5. 11
      Assets/FungusExamples/FirstPerson/LookingAtDoor.cs.meta

6
Assets/FungusExamples/FirstPerson/FPDemoPriorityRouter.cs

@ -2,8 +2,11 @@
using System.Collections.Generic;
using UnityEngine;
public class FPDemoPriorityRouter : MonoBehaviour
namespace Fungus.Examples
{
public class FPDemoPriorityRouter : MonoBehaviour
{
public Behaviour[] componentEnabledOutsideFungusPriority;
public Behaviour[] componentEnabledInsideFungusPriority;
@ -48,4 +51,5 @@ public class FPDemoPriorityRouter : MonoBehaviour
{
}
}
}

263
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,

11
Assets/FungusExamples/FirstPerson/ForceCursorVisible.cs

@ -2,14 +2,17 @@
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// Helper for FirstPerson Fungus Demo to work around some of the inflexibility of the Unity standard fps controller
/// </summary>
public class ForceCursorVisible : MonoBehaviour
namespace Fungus.Examples
{
/// <summary>
/// Helper for FirstPerson Fungus Demo to work around some of the inflexibility of the Unity standard fps controller
/// </summary>
public class ForceCursorVisible : MonoBehaviour
{
void Update()
{
Cursor.visible = true;
Cursor.lockState = CursorLockMode.None;
}
}
}

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

11
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:
Loading…
Cancel
Save