Butterfly Distraction

This commit is contained in:
DamianCorazza
2025-11-14 00:04:33 +01:00
parent c08fc4a720
commit 19be64a75f
8 changed files with 452 additions and 39 deletions

View File

@@ -0,0 +1,43 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: SPiderweb
m_Shader: {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _AlphaTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 0c9ec27b671ec814fb53bee78443c9c9, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- PixelSnap: 0
- _EnableExternalAlpha: 0
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _Flip: {r: 1, g: 1, b: 1, a: 1}
- _RendererColor: {r: 1, g: 1, b: 1, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 74a21ef39c3a86548804ca284dd6995a
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

View File

@@ -0,0 +1,156 @@
fileFormatVersion: 2
guid: 0c9ec27b671ec814fb53bee78443c9c9
TextureImporter:
internalIDToNameTable:
- first:
213: -8296513218426820769
second: SPiderweb_0
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 2
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: SPiderweb_0
rect:
serializedVersion: 2
x: 2
y: 0
width: 254
height: 255
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
physicsShape: []
tessellationDetail: -1
bones: []
spriteID: f5726554f2ddcdc80800000000000000
internalID: -8296513218426820769
vertices: []
indices:
edges: []
weights: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable:
SPiderweb_0: -8296513218426820769
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -255,10 +255,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 0a0d74ee1aa43b54ab5d08005bdd9b16, type: 3}
m_Name:
m_EditorClassIdentifier: '::'
getDistractedMin: 5
getDistractedMax: 8
getFlirtyMin: 4
getFlirtyMax: 5
fakeChocolate: {fileID: 2391935521422290070}
realChocolate: {fileID: 0}
distractedAudioClips: {fileID: 6418180475301049370, guid: 956d8d84e8dd1de4e94ba48c041dc6ec, type: 2}

View File

@@ -2999,6 +2999,7 @@ Transform:
- {fileID: 506226583}
- {fileID: 125187285}
- {fileID: 965496301}
- {fileID: 1152380538}
- {fileID: 514383804}
- {fileID: 2002720692}
- {fileID: 1449295683}
@@ -3780,7 +3781,7 @@ TilemapRenderer:
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 4b5abdd2e0aed944893af33d98905114, type: 2}
- {fileID: 2100000, guid: 74a21ef39c3a86548804ca284dd6995a, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
@@ -445574,6 +445575,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1471606854}
- {fileID: 1699099100}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &980459205
@@ -447375,7 +447377,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!4 &1046094549
Transform:
m_ObjectHideFlags: 0
@@ -449308,6 +449310,14 @@ PrefabInstance:
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8361739881193827101, guid: 4b7426bc1f8736749b68973653f4dbfb, type: 3}
propertyPath: m_LocalPosition.x
value: 7.439999
objectReference: {fileID: 0}
- target: {fileID: 8361739881193827101, guid: 4b7426bc1f8736749b68973653f4dbfb, type: 3}
propertyPath: m_LocalPosition.y
value: 11.47
objectReference: {fileID: 0}
- target: {fileID: 9074453772172382270, guid: 4b7426bc1f8736749b68973653f4dbfb, type: 3}
propertyPath: lawnMowerRef
value:
@@ -450514,6 +450524,96 @@ Transform:
m_CorrespondingSourceObject: {fileID: 5145306031820616614, guid: fbbe1f4baf226904b96f839fe0c00181, type: 3}
m_PrefabInstance: {fileID: 1152325451}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &1152380537
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 182591824}
m_Modifications:
- target: {fileID: 6629276459160142542, guid: 6cbcaf4eb20e63e4fb462f6fb1ada3a7, type: 3}
propertyPath: m_Sprite
value:
objectReference: {fileID: -1978118650525188057, guid: 5ff790e31ebc32b49a164889b673a882, type: 3}
- target: {fileID: 6629276459160142542, guid: 6cbcaf4eb20e63e4fb462f6fb1ada3a7, type: 3}
propertyPath: m_SortingLayer
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6629276459160142542, guid: 6cbcaf4eb20e63e4fb462f6fb1ada3a7, type: 3}
propertyPath: m_SortingOrder
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6629276459160142542, guid: 6cbcaf4eb20e63e4fb462f6fb1ada3a7, type: 3}
propertyPath: m_SortingLayerID
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8282617218565496284, guid: 6cbcaf4eb20e63e4fb462f6fb1ada3a7, type: 3}
propertyPath: m_Name
value: TinyBushA (20)
objectReference: {fileID: 0}
- target: {fileID: 9067462609398217044, guid: 6cbcaf4eb20e63e4fb462f6fb1ada3a7, type: 3}
propertyPath: m_LocalScale.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 9067462609398217044, guid: 6cbcaf4eb20e63e4fb462f6fb1ada3a7, type: 3}
propertyPath: m_LocalScale.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 9067462609398217044, guid: 6cbcaf4eb20e63e4fb462f6fb1ada3a7, type: 3}
propertyPath: m_LocalScale.z
value: 1
objectReference: {fileID: 0}
- target: {fileID: 9067462609398217044, guid: 6cbcaf4eb20e63e4fb462f6fb1ada3a7, type: 3}
propertyPath: m_LocalPosition.x
value: 50.97
objectReference: {fileID: 0}
- target: {fileID: 9067462609398217044, guid: 6cbcaf4eb20e63e4fb462f6fb1ada3a7, type: 3}
propertyPath: m_LocalPosition.y
value: -9.28
objectReference: {fileID: 0}
- target: {fileID: 9067462609398217044, guid: 6cbcaf4eb20e63e4fb462f6fb1ada3a7, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9067462609398217044, guid: 6cbcaf4eb20e63e4fb462f6fb1ada3a7, type: 3}
propertyPath: m_LocalRotation.w
value: 0.9994425
objectReference: {fileID: 0}
- target: {fileID: 9067462609398217044, guid: 6cbcaf4eb20e63e4fb462f6fb1ada3a7, type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 9067462609398217044, guid: 6cbcaf4eb20e63e4fb462f6fb1ada3a7, type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 9067462609398217044, guid: 6cbcaf4eb20e63e4fb462f6fb1ada3a7, type: 3}
propertyPath: m_LocalRotation.z
value: -0.033387545
objectReference: {fileID: 0}
- target: {fileID: 9067462609398217044, guid: 6cbcaf4eb20e63e4fb462f6fb1ada3a7, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9067462609398217044, guid: 6cbcaf4eb20e63e4fb462f6fb1ada3a7, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9067462609398217044, guid: 6cbcaf4eb20e63e4fb462f6fb1ada3a7, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: -3.827
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 6cbcaf4eb20e63e4fb462f6fb1ada3a7, type: 3}
--- !u!4 &1152380538 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 9067462609398217044, guid: 6cbcaf4eb20e63e4fb462f6fb1ada3a7, type: 3}
m_PrefabInstance: {fileID: 1152380537}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &1153004718
PrefabInstance:
m_ObjectHideFlags: 0
@@ -453825,7 +453925,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!4 &1339904432
Transform:
m_ObjectHideFlags: 0
@@ -453835,7 +453935,7 @@ Transform:
m_GameObject: {fileID: 1339904431}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 49.15, y: -5.5, z: 1.5}
m_LocalPosition: {x: 48.39, y: -6.17, z: 1.5}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
@@ -453866,7 +453966,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 6821f70f6ac4b85418b15ce068ddc6da, type: 3}
m_Name:
m_EditorClassIdentifier: '::'
butterflyRef: {fileID: 0}
butterflyRef: {fileID: 1486039842}
picnicRef: {fileID: 2035142374}
--- !u!1001 &1347210919
PrefabInstance:
m_ObjectHideFlags: 0
@@ -454148,7 +454249,7 @@ SpriteRenderer:
m_GlobalIlluminationMeshLod: 0
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_SortingOrder: 1
m_Sprite: {fileID: -265841166610147798, guid: d5bbe5b893ed9bc43b303a0e5c712a09, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 1
@@ -456944,7 +457045,7 @@ SpriteRenderer:
m_GlobalIlluminationMeshLod: 0
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_SortingOrder: 1
m_Sprite: {fileID: -265841166610147798, guid: d5bbe5b893ed9bc43b303a0e5c712a09, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 1
@@ -461020,6 +461121,96 @@ Transform:
m_CorrespondingSourceObject: {fileID: 5145306031820616614, guid: fbbe1f4baf226904b96f839fe0c00181, type: 3}
m_PrefabInstance: {fileID: 1693995484}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1699099098
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1699099100}
- component: {fileID: 1699099099}
m_Layer: 0
m_Name: Spiderweb
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!212 &1699099099
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1699099098}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RayTracingAccelStructBuildFlagsOverride: 0
m_RayTracingAccelStructBuildFlags: 1
m_SmallMeshCulling: 1
m_ForceMeshLod: -1
m_MeshLodSelectionBias: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 9dfc825aed78fcd4ba02077103263b40, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_GlobalIlluminationMeshLod: 0
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: -8296513218426820769, guid: 0c9ec27b671ec814fb53bee78443c9c9, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 2.54, y: 2.55}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 1
--- !u!4 &1699099100
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1699099098}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 48.329697, y: -6.5, z: 0}
m_LocalScale: {x: 1.4648, y: 1.4648, z: 1.4648}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 971772284}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &1700499946
PrefabInstance:
m_ObjectHideFlags: 0
@@ -461347,7 +461538,7 @@ SpriteRenderer:
m_GlobalIlluminationMeshLod: 0
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_SortingOrder: 1
m_Sprite: {fileID: -265841166610147798, guid: d5bbe5b893ed9bc43b303a0e5c712a09, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 1
@@ -462976,7 +463167,7 @@ Transform:
m_GameObject: {fileID: 1807522039}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 49.15, y: -5.5, z: 1.5}
m_LocalPosition: {x: 48.39, y: -6.17, z: 1.5}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
@@ -468106,6 +468297,17 @@ Transform:
- {fileID: 1061826737}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &2035142374 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 5762733430166618195, guid: 97f767ded753d524086106f3c39a645f, type: 3}
m_PrefabInstance: {fileID: 3634696358937253989}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0a0d74ee1aa43b54ab5d08005bdd9b16, type: 3}
m_Name:
m_EditorClassIdentifier: '::'
--- !u!1001 &2054236272
PrefabInstance:
m_ObjectHideFlags: 0
@@ -470297,7 +470499,7 @@ MonoBehaviour:
butterStateMachine: {fileID: 1471606857}
butterflightSpline: {fileID: 2136071210}
butterflyObject: {fileID: 2143678520}
flightDuration: 2
flightDuration: 4
flightDelay: 0
--- !u!1 &2143678519
GameObject:
@@ -472169,6 +472371,7 @@ SceneRoots:
- {fileID: 1657455509}
- {fileID: 2061458589}
- {fileID: 3634696358937253989}
- {fileID: 971772284}
- {fileID: 1101333109}
- {fileID: 4912039252317080710}
- {fileID: 2117822310}
@@ -472204,4 +472407,3 @@ SceneRoots:
- {fileID: 1374202465}
- {fileID: 519077570}
- {fileID: 708284666}
- {fileID: 971772284}

View File

@@ -5,6 +5,7 @@ public class ButterflyFreeBehaviour : MonoBehaviour
{
public GameObject butterflyRef;
private Animator butterflyAnimator;
public PicnicBehaviour picnicRef;
public void OnEnable()
{
if (butterflyRef != null)
@@ -12,6 +13,7 @@ public class ButterflyFreeBehaviour : MonoBehaviour
butterflyAnimator = butterflyRef.GetComponentInChildren<Animator>();
}
butterflyAnimator.SetTrigger("IsFree");
picnicRef.EnterDistractedState();
Debug.Log("ButterflyFreeBehaviour enabled");
}

View File

@@ -8,12 +8,6 @@ using UnityEngine.Audio;
public class PicnicBehaviour : ManagedBehaviour
{
[Header("Random Call Settings")]
public float getDistractedMin = 2f;
public float getDistractedMax = 5f;
public float getFlirtyMin = 1f;
public float getFlirtyMax = 3f;
private AppleMachine stateMachine;
private Animator animator;
@@ -32,6 +26,7 @@ public class PicnicBehaviour : ManagedBehaviour
// Runtime state tracking
private bool _fakeChocolateDestroyed;
private bool _isDistracted; // track current explicit state so it can be saved
internal override void OnManagedAwake()
{
@@ -48,28 +43,37 @@ public class PicnicBehaviour : ManagedBehaviour
}
else
{
StartCoroutine(StateCycleRoutine());
// Restore the saved state (distracted or chilling) and wait for external control to change states.
if (_isDistracted)
EnterDistractedState();
else
EnterChillingState();
}
}
private IEnumerator StateCycleRoutine()
// Manual state control methods (replaces automatic timer-based switching)
public void EnterDistractedState()
{
while (true)
{
// Distracted state
float distractedWait = UnityEngine.Random.Range(getDistractedMin, getDistractedMax);
stateMachine.ChangeState("Picnic PPL Distracted");
animator.SetBool("theyDistracted", true);
_audioSource.Stop();
yield return new WaitForSeconds(distractedWait);
if (stateMachine == null) stateMachine = GetComponent<AppleMachine>();
if (animator == null) animator = GetComponent<Animator>();
if (_audioSource == null) _audioSource = GetComponent<AppleAudioSource>();
// Chilling state
float chillingWait = UnityEngine.Random.Range(getFlirtyMin, getFlirtyMax);
stateMachine.ChangeState("Picnic PPL Chilling");
animator.SetBool("theyDistracted", false);
_audioSource.Stop();
yield return new WaitForSeconds(chillingWait);
}
_audioSource.Stop();
stateMachine.ChangeState("Picnic PPL Distracted");
animator.SetBool("theyDistracted", true);
_isDistracted = true;
}
public void EnterChillingState()
{
if (stateMachine == null) stateMachine = GetComponent<AppleMachine>();
if (animator == null) animator = GetComponent<Animator>();
if (_audioSource == null) _audioSource = GetComponent<AppleAudioSource>();
_audioSource.Stop();
stateMachine.ChangeState("Picnic PPL Chilling");
animator.SetBool("theyDistracted", false);
_isDistracted = false;
}
public void triedToStealChocolate()
@@ -122,7 +126,7 @@ public class PicnicBehaviour : ManagedBehaviour
internal override string OnSceneSaveRequested()
{
var state = new PicnicBehaviourState { fakeChocolateDestroyed = _fakeChocolateDestroyed };
var state = new PicnicBehaviourState { fakeChocolateDestroyed = _fakeChocolateDestroyed, isDistracted = _isDistracted };
return JsonUtility.ToJson(state);
}
@@ -136,6 +140,7 @@ public class PicnicBehaviour : ManagedBehaviour
if (state != null)
{
_fakeChocolateDestroyed = state.fakeChocolateDestroyed;
_isDistracted = state.isDistracted;
}
}
catch (Exception ex)
@@ -149,4 +154,5 @@ public class PicnicBehaviour : ManagedBehaviour
public class PicnicBehaviourState
{
public bool fakeChocolateDestroyed;
public bool isDistracted;
}