├── .gitignore ├── Assets ├── STasks.meta └── STasks │ ├── Examples.meta │ ├── Examples │ ├── ConsoleTests.meta │ ├── ConsoleTests │ │ ├── STask.unity │ │ ├── STask.unity.meta │ │ ├── STaskSimpleTest.cs │ │ └── STaskSimpleTest.cs.meta │ ├── Koffie.SimpleTasks.Examples.asmdef │ ├── Koffie.SimpleTasks.Examples.asmdef.meta │ ├── STaskCooldownUI.cs │ ├── STaskCooldownUI.cs.meta │ ├── STaskExamples.cs │ ├── STaskExamples.cs.meta │ ├── STaskLivesUI.cs │ ├── STaskLivesUI.cs.meta │ ├── STaskPlayer.cs │ ├── STaskPlayer.cs.meta │ ├── STasksExamples.unity │ ├── STasksExamples.unity.meta │ ├── Sprites.meta │ └── Sprites │ │ ├── Square.png │ │ ├── Square.png.meta │ │ ├── circle.png │ │ └── circle.png.meta │ ├── Scripts.meta │ ├── Scripts │ ├── Koffie.SimpleTasks.asmdef │ ├── Koffie.SimpleTasks.asmdef.meta │ ├── STask.cs │ ├── STask.cs.meta │ ├── STaskSettings.cs │ ├── STaskSettings.cs.meta │ ├── STasks.cs │ ├── STasks.cs.meta │ ├── STasksCollection.cs │ ├── STasksCollection.cs.meta │ ├── Task Variants.meta │ ├── Task Variants │ │ ├── DoAfterFramesTask.cs │ │ ├── DoAfterFramesTask.cs.meta │ │ ├── DoRepeatingTask.cs │ │ ├── DoRepeatingTask.cs.meta │ │ ├── DoTask.cs │ │ ├── DoTask.cs.meta │ │ ├── DoUntilTask.cs │ │ ├── DoUntilTask.cs.meta │ │ ├── DoWhenTask.cs │ │ └── DoWhenTask.cs.meta │ ├── UpdateHelper.cs │ └── UpdateHelper.cs.meta │ ├── package.json │ └── package.json.meta ├── LICENSE ├── LICENSE.meta ├── README.md ├── README.md.meta └── STasks.unitypackage /.gitignore: -------------------------------------------------------------------------------- 1 | # Add any directories, files, or patterns you don't want to be tracked by version control 2 | .~lock.*csv* 3 | .~lock.*ods* 4 | 5 | Library/ 6 | Temp/ 7 | .vs/ 8 | obj/ 9 | Builds/ 10 | 11 | 12 | fast_login.txt 13 | 14 | # =========================== 15 | # Default Collab Ignore Rules 16 | # =========================== 17 | 18 | # OS Generated 19 | # ============ 20 | .DS_Store 21 | ._* 22 | .Spotlight-V100 23 | .Trashes 24 | ehthumbs.db 25 | [Tt]humbs.db 26 | [Dd]esktop.ini 27 | 28 | # Visual Studio / MonoDevelop generated 29 | # ===================================== 30 | [Ee]xported[Oo]bj/ 31 | *.userprefs 32 | *.csproj 33 | *.pidb 34 | *.suo 35 | *.sln 36 | *.user 37 | *.unityproj 38 | *.booproj 39 | 40 | # Unity generated 41 | # =============== 42 | [Oo]bj/ 43 | [Bb]uild 44 | sysinfo.txt 45 | *.stackdump 46 | .consulo/* 47 | .plastic 48 | ignore.conf 49 | repo.fe 50 | ProjectSettings 51 | Packages 52 | Logs 53 | UserSettings 54 | *.vsconfig 55 | -------------------------------------------------------------------------------- /Assets/STasks.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 078a53bf95f77074cbbc2fbf95f5778f 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/STasks/Examples.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7088aed051afcd945a5d08adcc7a55fe 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/STasks/Examples/ConsoleTests.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2d73d1469209ebb4e9fbbbe2505dde2d 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/STasks/Examples/ConsoleTests/STask.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 9 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 0 28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} 29 | m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} 30 | m_HaloStrength: 0.5 31 | m_FlareStrength: 1 32 | m_FlareFadeSpeed: 3 33 | m_HaloTexture: {fileID: 0} 34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 35 | m_DefaultReflectionMode: 0 36 | m_DefaultReflectionResolution: 128 37 | m_ReflectionBounces: 1 38 | m_ReflectionIntensity: 1 39 | m_CustomReflection: {fileID: 0} 40 | m_Sun: {fileID: 0} 41 | m_IndirectSpecularColor: {r: 0.37311953, g: 0.38074014, b: 0.3587274, a: 1} 42 | m_UseRadianceAmbientProbe: 0 43 | --- !u!157 &3 44 | LightmapSettings: 45 | m_ObjectHideFlags: 0 46 | serializedVersion: 12 47 | m_GIWorkflowMode: 1 48 | m_GISettings: 49 | serializedVersion: 2 50 | m_BounceScale: 1 51 | m_IndirectOutputScale: 1 52 | m_AlbedoBoost: 1 53 | m_EnvironmentLightingMode: 0 54 | m_EnableBakedLightmaps: 1 55 | m_EnableRealtimeLightmaps: 0 56 | m_LightmapEditorSettings: 57 | serializedVersion: 12 58 | m_Resolution: 2 59 | m_BakeResolution: 40 60 | m_AtlasSize: 1024 61 | m_AO: 0 62 | m_AOMaxDistance: 1 63 | m_CompAOExponent: 1 64 | m_CompAOExponentDirect: 0 65 | m_ExtractAmbientOcclusion: 0 66 | m_Padding: 2 67 | m_LightmapParameters: {fileID: 0} 68 | m_LightmapsBakeMode: 1 69 | m_TextureCompression: 1 70 | m_FinalGather: 0 71 | m_FinalGatherFiltering: 1 72 | m_FinalGatherRayCount: 256 73 | m_ReflectionCompression: 2 74 | m_MixedBakeMode: 2 75 | m_BakeBackend: 1 76 | m_PVRSampling: 1 77 | m_PVRDirectSampleCount: 32 78 | m_PVRSampleCount: 512 79 | m_PVRBounces: 2 80 | m_PVREnvironmentSampleCount: 256 81 | m_PVREnvironmentReferencePointCount: 2048 82 | m_PVRFilteringMode: 1 83 | m_PVRDenoiserTypeDirect: 1 84 | m_PVRDenoiserTypeIndirect: 1 85 | m_PVRDenoiserTypeAO: 1 86 | m_PVRFilterTypeDirect: 0 87 | m_PVRFilterTypeIndirect: 0 88 | m_PVRFilterTypeAO: 0 89 | m_PVREnvironmentMIS: 1 90 | m_PVRCulling: 1 91 | m_PVRFilteringGaussRadiusDirect: 1 92 | m_PVRFilteringGaussRadiusIndirect: 5 93 | m_PVRFilteringGaussRadiusAO: 2 94 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 95 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 96 | m_PVRFilteringAtrousPositionSigmaAO: 1 97 | m_ExportTrainingData: 0 98 | m_TrainingDataDestination: TrainingData 99 | m_LightProbeSampleCountMultiplier: 4 100 | m_LightingDataAsset: {fileID: 0} 101 | m_LightingSettings: {fileID: 0} 102 | --- !u!196 &4 103 | NavMeshSettings: 104 | serializedVersion: 2 105 | m_ObjectHideFlags: 0 106 | m_BuildSettings: 107 | serializedVersion: 2 108 | agentTypeID: 0 109 | agentRadius: 0.5 110 | agentHeight: 2 111 | agentSlope: 45 112 | agentClimb: 0.4 113 | ledgeDropHeight: 0 114 | maxJumpAcrossDistance: 0 115 | minRegionArea: 2 116 | manualCellSize: 0 117 | cellSize: 0.16666667 118 | manualTileSize: 0 119 | tileSize: 256 120 | accuratePlacement: 0 121 | maxJobWorkers: 0 122 | preserveTilesOutsideBounds: 0 123 | debug: 124 | m_Flags: 0 125 | m_NavMeshData: {fileID: 0} 126 | --- !u!1 &210961988 127 | GameObject: 128 | m_ObjectHideFlags: 0 129 | m_CorrespondingSourceObject: {fileID: 0} 130 | m_PrefabInstance: {fileID: 0} 131 | m_PrefabAsset: {fileID: 0} 132 | serializedVersion: 6 133 | m_Component: 134 | - component: {fileID: 210961992} 135 | - component: {fileID: 210961991} 136 | - component: {fileID: 210961990} 137 | - component: {fileID: 210961989} 138 | m_Layer: 5 139 | m_Name: Canvas 140 | m_TagString: Untagged 141 | m_Icon: {fileID: 0} 142 | m_NavMeshLayer: 0 143 | m_StaticEditorFlags: 0 144 | m_IsActive: 1 145 | --- !u!114 &210961989 146 | MonoBehaviour: 147 | m_ObjectHideFlags: 0 148 | m_CorrespondingSourceObject: {fileID: 0} 149 | m_PrefabInstance: {fileID: 0} 150 | m_PrefabAsset: {fileID: 0} 151 | m_GameObject: {fileID: 210961988} 152 | m_Enabled: 1 153 | m_EditorHideFlags: 0 154 | m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} 155 | m_Name: 156 | m_EditorClassIdentifier: 157 | m_IgnoreReversedGraphics: 1 158 | m_BlockingObjects: 0 159 | m_BlockingMask: 160 | serializedVersion: 2 161 | m_Bits: 4294967295 162 | --- !u!114 &210961990 163 | MonoBehaviour: 164 | m_ObjectHideFlags: 0 165 | m_CorrespondingSourceObject: {fileID: 0} 166 | m_PrefabInstance: {fileID: 0} 167 | m_PrefabAsset: {fileID: 0} 168 | m_GameObject: {fileID: 210961988} 169 | m_Enabled: 1 170 | m_EditorHideFlags: 0 171 | m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} 172 | m_Name: 173 | m_EditorClassIdentifier: 174 | m_UiScaleMode: 0 175 | m_ReferencePixelsPerUnit: 100 176 | m_ScaleFactor: 1 177 | m_ReferenceResolution: {x: 800, y: 600} 178 | m_ScreenMatchMode: 0 179 | m_MatchWidthOrHeight: 0 180 | m_PhysicalUnit: 3 181 | m_FallbackScreenDPI: 96 182 | m_DefaultSpriteDPI: 96 183 | m_DynamicPixelsPerUnit: 1 184 | m_PresetInfoIsWorld: 0 185 | --- !u!223 &210961991 186 | Canvas: 187 | m_ObjectHideFlags: 0 188 | m_CorrespondingSourceObject: {fileID: 0} 189 | m_PrefabInstance: {fileID: 0} 190 | m_PrefabAsset: {fileID: 0} 191 | m_GameObject: {fileID: 210961988} 192 | m_Enabled: 1 193 | serializedVersion: 3 194 | m_RenderMode: 0 195 | m_Camera: {fileID: 0} 196 | m_PlaneDistance: 100 197 | m_PixelPerfect: 0 198 | m_ReceivesEvents: 1 199 | m_OverrideSorting: 0 200 | m_OverridePixelPerfect: 0 201 | m_SortingBucketNormalizedSize: 0 202 | m_AdditionalShaderChannelsFlag: 0 203 | m_SortingLayerID: 0 204 | m_SortingOrder: 0 205 | m_TargetDisplay: 0 206 | --- !u!224 &210961992 207 | RectTransform: 208 | m_ObjectHideFlags: 0 209 | m_CorrespondingSourceObject: {fileID: 0} 210 | m_PrefabInstance: {fileID: 0} 211 | m_PrefabAsset: {fileID: 0} 212 | m_GameObject: {fileID: 210961988} 213 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 214 | m_LocalPosition: {x: 0, y: 0, z: 0} 215 | m_LocalScale: {x: 0, y: 0, z: 0} 216 | m_ConstrainProportionsScale: 0 217 | m_Children: 218 | - {fileID: 709257831} 219 | - {fileID: 1536235273} 220 | m_Father: {fileID: 0} 221 | m_RootOrder: 2 222 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 223 | m_AnchorMin: {x: 0, y: 0} 224 | m_AnchorMax: {x: 0, y: 0} 225 | m_AnchoredPosition: {x: 0, y: 0} 226 | m_SizeDelta: {x: 0, y: 0} 227 | m_Pivot: {x: 0, y: 0} 228 | --- !u!1 &301439604 229 | GameObject: 230 | m_ObjectHideFlags: 0 231 | m_CorrespondingSourceObject: {fileID: 0} 232 | m_PrefabInstance: {fileID: 0} 233 | m_PrefabAsset: {fileID: 0} 234 | serializedVersion: 6 235 | m_Component: 236 | - component: {fileID: 301439607} 237 | - component: {fileID: 301439606} 238 | - component: {fileID: 301439605} 239 | m_Layer: 0 240 | m_Name: EventSystem 241 | m_TagString: Untagged 242 | m_Icon: {fileID: 0} 243 | m_NavMeshLayer: 0 244 | m_StaticEditorFlags: 0 245 | m_IsActive: 1 246 | --- !u!114 &301439605 247 | MonoBehaviour: 248 | m_ObjectHideFlags: 0 249 | m_CorrespondingSourceObject: {fileID: 0} 250 | m_PrefabInstance: {fileID: 0} 251 | m_PrefabAsset: {fileID: 0} 252 | m_GameObject: {fileID: 301439604} 253 | m_Enabled: 1 254 | m_EditorHideFlags: 0 255 | m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3} 256 | m_Name: 257 | m_EditorClassIdentifier: 258 | m_SendPointerHoverToParent: 1 259 | m_HorizontalAxis: Horizontal 260 | m_VerticalAxis: Vertical 261 | m_SubmitButton: Submit 262 | m_CancelButton: Cancel 263 | m_InputActionsPerSecond: 10 264 | m_RepeatDelay: 0.5 265 | m_ForceModuleActive: 0 266 | --- !u!114 &301439606 267 | MonoBehaviour: 268 | m_ObjectHideFlags: 0 269 | m_CorrespondingSourceObject: {fileID: 0} 270 | m_PrefabInstance: {fileID: 0} 271 | m_PrefabAsset: {fileID: 0} 272 | m_GameObject: {fileID: 301439604} 273 | m_Enabled: 1 274 | m_EditorHideFlags: 0 275 | m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} 276 | m_Name: 277 | m_EditorClassIdentifier: 278 | m_FirstSelected: {fileID: 0} 279 | m_sendNavigationEvents: 1 280 | m_DragThreshold: 10 281 | --- !u!4 &301439607 282 | Transform: 283 | m_ObjectHideFlags: 0 284 | m_CorrespondingSourceObject: {fileID: 0} 285 | m_PrefabInstance: {fileID: 0} 286 | m_PrefabAsset: {fileID: 0} 287 | m_GameObject: {fileID: 301439604} 288 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 289 | m_LocalPosition: {x: 0, y: 0, z: 0} 290 | m_LocalScale: {x: 1, y: 1, z: 1} 291 | m_ConstrainProportionsScale: 0 292 | m_Children: [] 293 | m_Father: {fileID: 0} 294 | m_RootOrder: 3 295 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 296 | --- !u!1 &709257830 297 | GameObject: 298 | m_ObjectHideFlags: 0 299 | m_CorrespondingSourceObject: {fileID: 0} 300 | m_PrefabInstance: {fileID: 0} 301 | m_PrefabAsset: {fileID: 0} 302 | serializedVersion: 6 303 | m_Component: 304 | - component: {fileID: 709257831} 305 | - component: {fileID: 709257833} 306 | - component: {fileID: 709257832} 307 | m_Layer: 5 308 | m_Name: Text (Legacy) 309 | m_TagString: Untagged 310 | m_Icon: {fileID: 0} 311 | m_NavMeshLayer: 0 312 | m_StaticEditorFlags: 0 313 | m_IsActive: 1 314 | --- !u!224 &709257831 315 | RectTransform: 316 | m_ObjectHideFlags: 0 317 | m_CorrespondingSourceObject: {fileID: 0} 318 | m_PrefabInstance: {fileID: 0} 319 | m_PrefabAsset: {fileID: 0} 320 | m_GameObject: {fileID: 709257830} 321 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 322 | m_LocalPosition: {x: 0, y: 0, z: 0} 323 | m_LocalScale: {x: 1, y: 1, z: 1} 324 | m_ConstrainProportionsScale: 0 325 | m_Children: [] 326 | m_Father: {fileID: 210961992} 327 | m_RootOrder: 0 328 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 329 | m_AnchorMin: {x: 0, y: 0} 330 | m_AnchorMax: {x: 1, y: 1} 331 | m_AnchoredPosition: {x: 0, y: 0} 332 | m_SizeDelta: {x: 0, y: 0} 333 | m_Pivot: {x: 0.5, y: 0.5} 334 | --- !u!114 &709257832 335 | MonoBehaviour: 336 | m_ObjectHideFlags: 0 337 | m_CorrespondingSourceObject: {fileID: 0} 338 | m_PrefabInstance: {fileID: 0} 339 | m_PrefabAsset: {fileID: 0} 340 | m_GameObject: {fileID: 709257830} 341 | m_Enabled: 1 342 | m_EditorHideFlags: 0 343 | m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} 344 | m_Name: 345 | m_EditorClassIdentifier: 346 | m_Material: {fileID: 0} 347 | m_Color: {r: 1, g: 1, b: 1, a: 1} 348 | m_RaycastTarget: 1 349 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 350 | m_Maskable: 1 351 | m_OnCullStateChanged: 352 | m_PersistentCalls: 353 | m_Calls: [] 354 | m_FontData: 355 | m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} 356 | m_FontSize: 34 357 | m_FontStyle: 0 358 | m_BestFit: 0 359 | m_MinSize: 10 360 | m_MaxSize: 40 361 | m_Alignment: 4 362 | m_AlignByGeometry: 0 363 | m_RichText: 1 364 | m_HorizontalOverflow: 0 365 | m_VerticalOverflow: 0 366 | m_LineSpacing: 1 367 | m_Text: "This scene is for playing with the different task settings. \n\nSelect 368 | the STask Tester in the hierarchy to change the settings.\n\nYou can see how 369 | the callbacks are executed in the console! " 370 | --- !u!222 &709257833 371 | CanvasRenderer: 372 | m_ObjectHideFlags: 0 373 | m_CorrespondingSourceObject: {fileID: 0} 374 | m_PrefabInstance: {fileID: 0} 375 | m_PrefabAsset: {fileID: 0} 376 | m_GameObject: {fileID: 709257830} 377 | m_CullTransparentMesh: 1 378 | --- !u!1 &902260074 379 | GameObject: 380 | m_ObjectHideFlags: 0 381 | m_CorrespondingSourceObject: {fileID: 0} 382 | m_PrefabInstance: {fileID: 0} 383 | m_PrefabAsset: {fileID: 0} 384 | serializedVersion: 6 385 | m_Component: 386 | - component: {fileID: 902260075} 387 | - component: {fileID: 902260076} 388 | m_Layer: 0 389 | m_Name: STask Tester 390 | m_TagString: Untagged 391 | m_Icon: {fileID: 0} 392 | m_NavMeshLayer: 0 393 | m_StaticEditorFlags: 0 394 | m_IsActive: 1 395 | --- !u!4 &902260075 396 | Transform: 397 | m_ObjectHideFlags: 0 398 | m_CorrespondingSourceObject: {fileID: 0} 399 | m_PrefabInstance: {fileID: 0} 400 | m_PrefabAsset: {fileID: 0} 401 | m_GameObject: {fileID: 902260074} 402 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 403 | m_LocalPosition: {x: 0, y: 0, z: 0} 404 | m_LocalScale: {x: 1, y: 1, z: 1} 405 | m_ConstrainProportionsScale: 0 406 | m_Children: [] 407 | m_Father: {fileID: 0} 408 | m_RootOrder: 1 409 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 410 | --- !u!114 &902260076 411 | MonoBehaviour: 412 | m_ObjectHideFlags: 0 413 | m_CorrespondingSourceObject: {fileID: 0} 414 | m_PrefabInstance: {fileID: 0} 415 | m_PrefabAsset: {fileID: 0} 416 | m_GameObject: {fileID: 902260074} 417 | m_Enabled: 1 418 | m_EditorHideFlags: 0 419 | m_Script: {fileID: 11500000, guid: 708ad056a7a1d9e4484ded32f50516d9, type: 3} 420 | m_Name: 421 | m_EditorClassIdentifier: 422 | autoExecuteOnStart: 0 423 | iterationsOnTaskStart: 0 424 | restartTaskOnComplete: 1 425 | currentIteration: 0 426 | TaskType: 0 427 | frequency: 1 428 | startAfter: 1 429 | maxDuration: 1 430 | maxIterations: 10 431 | repeatTimes: 10 432 | frames: 10 433 | --- !u!1 &1285401195 434 | GameObject: 435 | m_ObjectHideFlags: 0 436 | m_CorrespondingSourceObject: {fileID: 0} 437 | m_PrefabInstance: {fileID: 0} 438 | m_PrefabAsset: {fileID: 0} 439 | serializedVersion: 6 440 | m_Component: 441 | - component: {fileID: 1285401198} 442 | - component: {fileID: 1285401197} 443 | - component: {fileID: 1285401196} 444 | m_Layer: 0 445 | m_Name: Main Camera 446 | m_TagString: MainCamera 447 | m_Icon: {fileID: 0} 448 | m_NavMeshLayer: 0 449 | m_StaticEditorFlags: 0 450 | m_IsActive: 1 451 | --- !u!81 &1285401196 452 | AudioListener: 453 | m_ObjectHideFlags: 0 454 | m_CorrespondingSourceObject: {fileID: 0} 455 | m_PrefabInstance: {fileID: 0} 456 | m_PrefabAsset: {fileID: 0} 457 | m_GameObject: {fileID: 1285401195} 458 | m_Enabled: 1 459 | --- !u!20 &1285401197 460 | Camera: 461 | m_ObjectHideFlags: 0 462 | m_CorrespondingSourceObject: {fileID: 0} 463 | m_PrefabInstance: {fileID: 0} 464 | m_PrefabAsset: {fileID: 0} 465 | m_GameObject: {fileID: 1285401195} 466 | m_Enabled: 1 467 | serializedVersion: 2 468 | m_ClearFlags: 2 469 | m_BackGroundColor: {r: 0, g: 0, b: 0, a: 0} 470 | m_projectionMatrixMode: 1 471 | m_GateFitMode: 2 472 | m_FOVAxisMode: 0 473 | m_SensorSize: {x: 36, y: 24} 474 | m_LensShift: {x: 0, y: 0} 475 | m_FocalLength: 50 476 | m_NormalizedViewPortRect: 477 | serializedVersion: 2 478 | x: 0 479 | y: 0 480 | width: 1 481 | height: 1 482 | near clip plane: 0.3 483 | far clip plane: 1000 484 | field of view: 60 485 | orthographic: 0 486 | orthographic size: 5 487 | m_Depth: -1 488 | m_CullingMask: 489 | serializedVersion: 2 490 | m_Bits: 4294967295 491 | m_RenderingPath: -1 492 | m_TargetTexture: {fileID: 0} 493 | m_TargetDisplay: 0 494 | m_TargetEye: 3 495 | m_HDR: 1 496 | m_AllowMSAA: 1 497 | m_AllowDynamicResolution: 0 498 | m_ForceIntoRT: 0 499 | m_OcclusionCulling: 1 500 | m_StereoConvergence: 10 501 | m_StereoSeparation: 0.022 502 | --- !u!4 &1285401198 503 | Transform: 504 | m_ObjectHideFlags: 0 505 | m_CorrespondingSourceObject: {fileID: 0} 506 | m_PrefabInstance: {fileID: 0} 507 | m_PrefabAsset: {fileID: 0} 508 | m_GameObject: {fileID: 1285401195} 509 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 510 | m_LocalPosition: {x: 0, y: 1, z: -10} 511 | m_LocalScale: {x: 1, y: 1, z: 1} 512 | m_ConstrainProportionsScale: 0 513 | m_Children: [] 514 | m_Father: {fileID: 0} 515 | m_RootOrder: 0 516 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 517 | --- !u!1 &1536235272 518 | GameObject: 519 | m_ObjectHideFlags: 0 520 | m_CorrespondingSourceObject: {fileID: 0} 521 | m_PrefabInstance: {fileID: 0} 522 | m_PrefabAsset: {fileID: 0} 523 | serializedVersion: 6 524 | m_Component: 525 | - component: {fileID: 1536235273} 526 | - component: {fileID: 1536235275} 527 | - component: {fileID: 1536235274} 528 | m_Layer: 5 529 | m_Name: Text (Legacy) (1) 530 | m_TagString: Untagged 531 | m_Icon: {fileID: 0} 532 | m_NavMeshLayer: 0 533 | m_StaticEditorFlags: 0 534 | m_IsActive: 1 535 | --- !u!224 &1536235273 536 | RectTransform: 537 | m_ObjectHideFlags: 0 538 | m_CorrespondingSourceObject: {fileID: 0} 539 | m_PrefabInstance: {fileID: 0} 540 | m_PrefabAsset: {fileID: 0} 541 | m_GameObject: {fileID: 1536235272} 542 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 543 | m_LocalPosition: {x: 0, y: 0, z: 0} 544 | m_LocalScale: {x: 1, y: 1, z: 1} 545 | m_ConstrainProportionsScale: 0 546 | m_Children: [] 547 | m_Father: {fileID: 210961992} 548 | m_RootOrder: 1 549 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 550 | m_AnchorMin: {x: 0, y: 0} 551 | m_AnchorMax: {x: 1, y: 1} 552 | m_AnchoredPosition: {x: 0, y: 0} 553 | m_SizeDelta: {x: 0, y: 0} 554 | m_Pivot: {x: 0.5, y: 0.5} 555 | --- !u!114 &1536235274 556 | MonoBehaviour: 557 | m_ObjectHideFlags: 0 558 | m_CorrespondingSourceObject: {fileID: 0} 559 | m_PrefabInstance: {fileID: 0} 560 | m_PrefabAsset: {fileID: 0} 561 | m_GameObject: {fileID: 1536235272} 562 | m_Enabled: 1 563 | m_EditorHideFlags: 0 564 | m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} 565 | m_Name: 566 | m_EditorClassIdentifier: 567 | m_Material: {fileID: 0} 568 | m_Color: {r: 1, g: 1, b: 1, a: 1} 569 | m_RaycastTarget: 1 570 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 571 | m_Maskable: 1 572 | m_OnCullStateChanged: 573 | m_PersistentCalls: 574 | m_Calls: [] 575 | m_FontData: 576 | m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} 577 | m_FontSize: 34 578 | m_FontStyle: 0 579 | m_BestFit: 0 580 | m_MinSize: 10 581 | m_MaxSize: 40 582 | m_Alignment: 6 583 | m_AlignByGeometry: 0 584 | m_RichText: 1 585 | m_HorizontalOverflow: 0 586 | m_VerticalOverflow: 0 587 | m_LineSpacing: 1 588 | m_Text: 'Controls: 589 | 590 | [SPACE] to execute a task with the current 591 | settings 592 | 593 | [ESCAPE] to kill the current task 594 | 595 | [UP ARROW] 596 | to increase the value of currentIteration 597 | 598 | [DOWN ARROW] to decrease the 599 | value of currentIteration' 600 | --- !u!222 &1536235275 601 | CanvasRenderer: 602 | m_ObjectHideFlags: 0 603 | m_CorrespondingSourceObject: {fileID: 0} 604 | m_PrefabInstance: {fileID: 0} 605 | m_PrefabAsset: {fileID: 0} 606 | m_GameObject: {fileID: 1536235272} 607 | m_CullTransparentMesh: 1 608 | -------------------------------------------------------------------------------- /Assets/STasks/Examples/ConsoleTests/STask.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bdfce9b304bf59e4eae5cd6062a0e3e0 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/STasks/Examples/ConsoleTests/STaskSimpleTest.cs: -------------------------------------------------------------------------------- 1 | /* This is a simple script to test different settings in the editor 2 | * Press SPACE to start executing a task with the current settings 3 | * Press ESCAPE to kill the current task while it's running 4 | * Press UP/DOWN ARROWS to increase/decrease the value of the iteration variable (useful for testing conditional tasks) */ 5 | using UnityEngine; 6 | 7 | namespace Koffie.SimpleTasks.Examples 8 | { 9 | public class STaskSimpleTest : MonoBehaviour 10 | { 11 | public enum STaskType 12 | { 13 | Simple, 14 | Repeating, 15 | When, 16 | Times, 17 | Until, 18 | AfterFrames 19 | } 20 | 21 | 22 | [Tooltip("Whether to execute a task with the current settings when entering play mode")] 23 | public bool autoExecuteOnStart = true; 24 | 25 | [Tooltip("The value of currentIteration before starting a task")] 26 | public int iterationsOnTaskStart = 0; 27 | 28 | [Tooltip("If true, a new task with the current settings will be started when the current task is completed")] 29 | public bool restartTaskOnComplete = false; 30 | 31 | [Tooltip("For visualization only. The value of the current iteration. Represents how many times a task's action has been executed")] 32 | public int currentIteration = 0; 33 | 34 | [Header("Task Settings")] 35 | [Tooltip("The type of task to execute")] 36 | public STaskType TaskType = STaskType.Simple; 37 | 38 | [Header("Shared Settings")] 39 | [Tooltip("The time between executions of a repeating task (DoRepeating, DoUntil or DoTimes)")] 40 | public float frequency = 0.1f; 41 | 42 | [Tooltip("A delay before starting the task")] 43 | public float startAfter = 0.0f; 44 | 45 | [Tooltip("The maximum duration of the task. If this value is negative, the task will run until manually killed.")] 46 | public float maxDuration = -1.0f; 47 | 48 | [Header("Conditional Task Settings")] 49 | [Tooltip("The number of iterations used for condition comparissons.\n\nFor DoUntil, the task will be executed repeatedly until" + 50 | " the current iteration is greater than or equal to this value.\n\nFor DoWhen, the task will be executed when the current iteration is greater than or equal to this value.")] 51 | public float maxIterations = 10; 52 | 53 | [Header("DoTimes")] 54 | [Tooltip("How many times we should execute the DoTimes task")] 55 | public int repeatTimes = 10; 56 | 57 | [Header("DoAfterFrames")] 58 | [Tooltip("How many frames we should wait before executing the DoAfterFrames task")] 59 | public int frames = 10; 60 | 61 | private STask _currentTask; 62 | 63 | private void Start() 64 | { 65 | if (autoExecuteOnStart) 66 | { 67 | ExecuteTaskWithCurrentSettings(); 68 | } 69 | } 70 | 71 | private void ExecuteTaskWithCurrentSettings() 72 | { 73 | _currentTask?.Kill(); 74 | currentIteration = iterationsOnTaskStart; 75 | 76 | if (TaskType == STaskType.Repeating) 77 | { 78 | _currentTask = STasks.DoRepeating(() => IncreaseIterationAndPrint(ref currentIteration), frequency, startAfter, maxDuration); 79 | } 80 | else if (TaskType == STaskType.Until) 81 | { 82 | _currentTask = STasks.DoUntil(() => IncreaseIterationAndPrint(ref currentIteration), () => currentIteration >= maxIterations, frequency, startAfter, maxDuration); 83 | } 84 | else if (TaskType == STaskType.Simple) 85 | { 86 | _currentTask = STasks.Do(() => IncreaseIterationAndPrint(ref currentIteration), startAfter); 87 | } 88 | else if (TaskType == STaskType.When) 89 | { 90 | _currentTask = STasks.DoWhen(() => Debug.Log($"DoWhen iteration: {currentIteration}"), () => currentIteration >= maxIterations, startAfter); 91 | } 92 | else if (TaskType == STaskType.Times) 93 | { 94 | _currentTask = STasks.DoTimes(() => IncreaseIterationAndPrint(ref currentIteration), repeatTimes, frequency, startAfter, maxDuration); 95 | } 96 | else if (TaskType == STaskType.AfterFrames) 97 | { 98 | _currentTask = STasks.DoAfterFrames(() => IncreaseIterationAndPrint(ref currentIteration), frames, startAfter); 99 | } 100 | 101 | string taskName = _currentTask.GetType().Name; 102 | _currentTask.OnStart(() => Debug.Log($"{taskName} started after {_currentTask.ElapsedTime.ToString("0.00")} seconds with iterations = {currentIteration}")); 103 | _currentTask.OnComplete(() => 104 | { 105 | Debug.Log($"{taskName} completed after {currentIteration} iterations. Time since started: {_currentTask.TimeSinceStart.ToString("0.00")} seconds"); 106 | 107 | if (restartTaskOnComplete) 108 | ExecuteTaskWithCurrentSettings(); 109 | }); 110 | _currentTask.OnKill(() => Debug.Log($"{taskName} killed after {currentIteration} iterations. Time since created: {_currentTask.ElapsedTime.ToString("0.00")} seconds")); 111 | _currentTask.OnTimeout(() => Debug.Log($"{taskName} timed out after {currentIteration} iterations")); 112 | } 113 | 114 | private void Update() 115 | { 116 | if (Input.GetKeyDown(KeyCode.Space)) 117 | ExecuteTaskWithCurrentSettings(); 118 | 119 | if (Input.GetKeyDown(KeyCode.Escape)) 120 | { 121 | _currentTask?.Kill(); 122 | } 123 | 124 | if (Input.GetKeyDown(KeyCode.UpArrow)) 125 | currentIteration++; 126 | 127 | if (Input.GetKeyDown(KeyCode.DownArrow)) 128 | currentIteration--; 129 | } 130 | 131 | private void IncreaseIterationAndPrint(ref int iteration) 132 | { 133 | iteration++; 134 | Debug.Log($"Current iteration: {iteration} at {_currentTask.TimeSinceStart.ToString("0.00")} seconds."); 135 | } 136 | } 137 | } -------------------------------------------------------------------------------- /Assets/STasks/Examples/ConsoleTests/STaskSimpleTest.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 708ad056a7a1d9e4484ded32f50516d9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/STasks/Examples/Koffie.SimpleTasks.Examples.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Koffie.SimpleTasks.Examples", 3 | "rootNamespace": "", 4 | "references": [ 5 | "GUID:b2b74bea20f643446bd5c9ac75b9b0aa" 6 | ], 7 | "includePlatforms": [], 8 | "excludePlatforms": [], 9 | "allowUnsafeCode": false, 10 | "overrideReferences": false, 11 | "precompiledReferences": [], 12 | "autoReferenced": true, 13 | "defineConstraints": [], 14 | "versionDefines": [], 15 | "noEngineReferences": false 16 | } -------------------------------------------------------------------------------- /Assets/STasks/Examples/Koffie.SimpleTasks.Examples.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5d327a0be0632b645994778f37600420 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/STasks/Examples/STaskCooldownUI.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.UI; 3 | 4 | namespace Koffie.SimpleTasks.Examples 5 | { 6 | public class STaskCooldownUI : MonoBehaviour 7 | { 8 | [SerializeField] 9 | private Image _donutImage; 10 | 11 | public void Show() 12 | { 13 | gameObject.SetActive(true); 14 | } 15 | 16 | public void Hide() 17 | { 18 | gameObject.SetActive(false); 19 | } 20 | 21 | public void SetProgress(float progress) 22 | { 23 | _donutImage.fillAmount = progress; 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /Assets/STasks/Examples/STaskCooldownUI.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: edc78a4f55e12ce4ea4b70695e11a274 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/STasks/Examples/STaskExamples.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace Koffie.SimpleTasks.Examples 4 | { 5 | public class STaskExamples : MonoBehaviour 6 | { 7 | [SerializeField] 8 | private Camera _camera; 9 | 10 | private STask _randomizeCameraColorTask; 11 | private Color _startColor; 12 | 13 | private void Start() 14 | { 15 | PrintHelloWorldAfterThreeSeconds(); 16 | RandomizeCameraColorThreeTimes(); 17 | } 18 | 19 | private void RandomizeCameraColorThreeTimes() 20 | { 21 | // Randomizes the color of the camera three times, with a 1.5 seconds wait between changes. 22 | _startColor = _camera.backgroundColor; 23 | int timesRandomized = 0; 24 | 25 | // If we already have a task doing this, kill it 26 | _randomizeCameraColorTask?.Kill(); 27 | _randomizeCameraColorTask = STasks.DoUntil( 28 | action: () => 29 | { 30 | timesRandomized++; 31 | _camera.backgroundColor = new Color(Random.value, Random.value, Random.value); 32 | }, 33 | condition: () => timesRandomized > 3, 34 | every: 1.5f); 35 | 36 | // Reset the color on complete 37 | _randomizeCameraColorTask.OnComplete(() => _camera.backgroundColor = _startColor); 38 | } 39 | 40 | private void PrintHelloWorldAfterThreeSeconds() 41 | { 42 | // Print "hello world" after three seconds 43 | STasks.Do(() => Debug.Log("Hello world!"), after: 3.0f); 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /Assets/STasks/Examples/STaskExamples.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 79c2bb1a87761144798bbccd900712db 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/STasks/Examples/STaskLivesUI.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.UI; 3 | 4 | namespace Koffie.SimpleTasks.Examples 5 | { 6 | public class STaskLivesUI : MonoBehaviour 7 | { 8 | [SerializeField] 9 | private Text _text; 10 | 11 | public void SetLives(int lives) 12 | { 13 | _text.text = $"Lives: {lives}"; 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /Assets/STasks/Examples/STaskLivesUI.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 814f1ef0a6e668f4d8c289db509980cf 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/STasks/Examples/STaskPlayer.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace Koffie.SimpleTasks.Examples 4 | { 5 | public class STaskPlayer : MonoBehaviour 6 | { 7 | [SerializeField] 8 | private STaskCooldownUI _cooldownUI; 9 | 10 | [SerializeField] 11 | private STaskLivesUI _livesUI; 12 | 13 | [SerializeField] 14 | private GameObject _gameOverScreen; 15 | 16 | [SerializeField] 17 | private int _startLives = 30; 18 | 19 | [SerializeField] 20 | private float _healingCooldown; 21 | 22 | private int _currentLives; 23 | private bool _canExecuteHealingAbility; 24 | 25 | private SpriteRenderer _renderer; 26 | 27 | private STask _loseLivesTask; 28 | private STask _healingAbilityCooldownTask; 29 | 30 | private void Awake() 31 | { 32 | _renderer = GetComponent(); 33 | } 34 | 35 | private void Start() 36 | { 37 | _currentLives = _startLives; 38 | _canExecuteHealingAbility = true; 39 | 40 | // Start losing lives when the game starts 41 | _loseLivesTask = STasks.DoUntil(LoseOneLife, () => _currentLives == 0, 1.0f).OnComplete(OnGameOver); 42 | } 43 | 44 | private void OnGameOver() 45 | { 46 | _gameOverScreen.SetActive(true); 47 | Destroy(gameObject); 48 | } 49 | 50 | private void Update() 51 | { 52 | if (_canExecuteHealingAbility && Input.GetKeyDown(KeyCode.Space)) 53 | { 54 | GainOneLife(); 55 | } 56 | } 57 | 58 | private void GainOneLife() 59 | { 60 | _canExecuteHealingAbility = false; 61 | _currentLives++; 62 | _livesUI.SetLives(_currentLives); 63 | 64 | // Show the cooldown UI 65 | _cooldownUI.Show(); 66 | 67 | _healingAbilityCooldownTask?.Kill(); 68 | 69 | // Reenable the healing ability after the cooldown 70 | _healingAbilityCooldownTask = STasks.Do(() => _canExecuteHealingAbility = true, _healingCooldown); 71 | 72 | // Update the cooldown UI every frame 73 | _healingAbilityCooldownTask.OnUpdate(() => _cooldownUI.SetProgress(_healingAbilityCooldownTask.Progress)); 74 | 75 | // Hide the cooldown UI when the task is complete 76 | _healingAbilityCooldownTask.OnComplete(() => _cooldownUI.Hide()); 77 | } 78 | 79 | private void LoseOneLife() 80 | { 81 | _currentLives--; 82 | _renderer.color = Color.Lerp(Color.red, Color.white, (float)_currentLives / _startLives); 83 | _livesUI.SetLives(_currentLives); 84 | } 85 | 86 | private void OnDestroy() 87 | { 88 | // Kill the Lose Lives task when the player is destroyed 89 | _loseLivesTask?.Kill(); 90 | _healingAbilityCooldownTask?.Kill(); 91 | } 92 | } 93 | } -------------------------------------------------------------------------------- /Assets/STasks/Examples/STaskPlayer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bcfdbc463cdbc5843b8ee2cb9ea27245 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/STasks/Examples/STasksExamples.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 9 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 3 28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} 29 | m_SkyboxMaterial: {fileID: 0} 30 | m_HaloStrength: 0.5 31 | m_FlareStrength: 1 32 | m_FlareFadeSpeed: 3 33 | m_HaloTexture: {fileID: 0} 34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 35 | m_DefaultReflectionMode: 0 36 | m_DefaultReflectionResolution: 128 37 | m_ReflectionBounces: 1 38 | m_ReflectionIntensity: 1 39 | m_CustomReflection: {fileID: 0} 40 | m_Sun: {fileID: 0} 41 | m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} 42 | m_UseRadianceAmbientProbe: 0 43 | --- !u!157 &3 44 | LightmapSettings: 45 | m_ObjectHideFlags: 0 46 | serializedVersion: 11 47 | m_GIWorkflowMode: 1 48 | m_GISettings: 49 | serializedVersion: 2 50 | m_BounceScale: 1 51 | m_IndirectOutputScale: 1 52 | m_AlbedoBoost: 1 53 | m_EnvironmentLightingMode: 0 54 | m_EnableBakedLightmaps: 0 55 | m_EnableRealtimeLightmaps: 0 56 | m_LightmapEditorSettings: 57 | serializedVersion: 12 58 | m_Resolution: 2 59 | m_BakeResolution: 40 60 | m_AtlasSize: 1024 61 | m_AO: 0 62 | m_AOMaxDistance: 1 63 | m_CompAOExponent: 1 64 | m_CompAOExponentDirect: 0 65 | m_ExtractAmbientOcclusion: 0 66 | m_Padding: 2 67 | m_LightmapParameters: {fileID: 0} 68 | m_LightmapsBakeMode: 1 69 | m_TextureCompression: 1 70 | m_FinalGather: 0 71 | m_FinalGatherFiltering: 1 72 | m_FinalGatherRayCount: 256 73 | m_ReflectionCompression: 2 74 | m_MixedBakeMode: 2 75 | m_BakeBackend: 0 76 | m_PVRSampling: 1 77 | m_PVRDirectSampleCount: 32 78 | m_PVRSampleCount: 500 79 | m_PVRBounces: 2 80 | m_PVREnvironmentSampleCount: 500 81 | m_PVREnvironmentReferencePointCount: 2048 82 | m_PVRFilteringMode: 2 83 | m_PVRDenoiserTypeDirect: 0 84 | m_PVRDenoiserTypeIndirect: 0 85 | m_PVRDenoiserTypeAO: 0 86 | m_PVRFilterTypeDirect: 0 87 | m_PVRFilterTypeIndirect: 0 88 | m_PVRFilterTypeAO: 0 89 | m_PVREnvironmentMIS: 0 90 | m_PVRCulling: 1 91 | m_PVRFilteringGaussRadiusDirect: 1 92 | m_PVRFilteringGaussRadiusIndirect: 5 93 | m_PVRFilteringGaussRadiusAO: 2 94 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 95 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 96 | m_PVRFilteringAtrousPositionSigmaAO: 1 97 | m_ExportTrainingData: 0 98 | m_TrainingDataDestination: TrainingData 99 | m_LightProbeSampleCountMultiplier: 4 100 | m_LightingDataAsset: {fileID: 0} 101 | m_UseShadowmask: 1 102 | --- !u!196 &4 103 | NavMeshSettings: 104 | serializedVersion: 2 105 | m_ObjectHideFlags: 0 106 | m_BuildSettings: 107 | serializedVersion: 2 108 | agentTypeID: 0 109 | agentRadius: 0.5 110 | agentHeight: 2 111 | agentSlope: 45 112 | agentClimb: 0.4 113 | ledgeDropHeight: 0 114 | maxJumpAcrossDistance: 0 115 | minRegionArea: 2 116 | manualCellSize: 0 117 | cellSize: 0.16666667 118 | manualTileSize: 0 119 | tileSize: 256 120 | accuratePlacement: 0 121 | debug: 122 | m_Flags: 0 123 | m_NavMeshData: {fileID: 0} 124 | --- !u!1 &57937951 125 | GameObject: 126 | m_ObjectHideFlags: 0 127 | m_CorrespondingSourceObject: {fileID: 0} 128 | m_PrefabInstance: {fileID: 0} 129 | m_PrefabAsset: {fileID: 0} 130 | serializedVersion: 6 131 | m_Component: 132 | - component: {fileID: 57937952} 133 | - component: {fileID: 57937954} 134 | - component: {fileID: 57937953} 135 | m_Layer: 5 136 | m_Name: Text 137 | m_TagString: Untagged 138 | m_Icon: {fileID: 0} 139 | m_NavMeshLayer: 0 140 | m_StaticEditorFlags: 0 141 | m_IsActive: 1 142 | --- !u!224 &57937952 143 | RectTransform: 144 | m_ObjectHideFlags: 0 145 | m_CorrespondingSourceObject: {fileID: 0} 146 | m_PrefabInstance: {fileID: 0} 147 | m_PrefabAsset: {fileID: 0} 148 | m_GameObject: {fileID: 57937951} 149 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 150 | m_LocalPosition: {x: 0, y: 0, z: 0} 151 | m_LocalScale: {x: 0.5, y: 0.5, z: 1} 152 | m_Children: [] 153 | m_Father: {fileID: 572542673} 154 | m_RootOrder: 0 155 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 156 | m_AnchorMin: {x: 0.5, y: 0.5} 157 | m_AnchorMax: {x: 0.5, y: 0.5} 158 | m_AnchoredPosition: {x: 0, y: 0} 159 | m_SizeDelta: {x: 800, y: 150} 160 | m_Pivot: {x: 0.5, y: 0.5} 161 | --- !u!114 &57937953 162 | MonoBehaviour: 163 | m_ObjectHideFlags: 0 164 | m_CorrespondingSourceObject: {fileID: 0} 165 | m_PrefabInstance: {fileID: 0} 166 | m_PrefabAsset: {fileID: 0} 167 | m_GameObject: {fileID: 57937951} 168 | m_Enabled: 1 169 | m_EditorHideFlags: 0 170 | m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} 171 | m_Name: 172 | m_EditorClassIdentifier: 173 | m_Material: {fileID: 0} 174 | m_Color: {r: 1, g: 1, b: 1, a: 1} 175 | m_RaycastTarget: 1 176 | m_Maskable: 1 177 | m_OnCullStateChanged: 178 | m_PersistentCalls: 179 | m_Calls: [] 180 | m_FontData: 181 | m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} 182 | m_FontSize: 125 183 | m_FontStyle: 0 184 | m_BestFit: 0 185 | m_MinSize: 1 186 | m_MaxSize: 300 187 | m_Alignment: 4 188 | m_AlignByGeometry: 0 189 | m_RichText: 1 190 | m_HorizontalOverflow: 0 191 | m_VerticalOverflow: 0 192 | m_LineSpacing: 1 193 | m_Text: Game Over 194 | --- !u!222 &57937954 195 | CanvasRenderer: 196 | m_ObjectHideFlags: 0 197 | m_CorrespondingSourceObject: {fileID: 0} 198 | m_PrefabInstance: {fileID: 0} 199 | m_PrefabAsset: {fileID: 0} 200 | m_GameObject: {fileID: 57937951} 201 | m_CullTransparentMesh: 0 202 | --- !u!1 &519420028 203 | GameObject: 204 | m_ObjectHideFlags: 0 205 | m_CorrespondingSourceObject: {fileID: 0} 206 | m_PrefabInstance: {fileID: 0} 207 | m_PrefabAsset: {fileID: 0} 208 | serializedVersion: 6 209 | m_Component: 210 | - component: {fileID: 519420032} 211 | - component: {fileID: 519420031} 212 | - component: {fileID: 519420029} 213 | m_Layer: 0 214 | m_Name: Main Camera 215 | m_TagString: MainCamera 216 | m_Icon: {fileID: 0} 217 | m_NavMeshLayer: 0 218 | m_StaticEditorFlags: 0 219 | m_IsActive: 1 220 | --- !u!81 &519420029 221 | AudioListener: 222 | m_ObjectHideFlags: 0 223 | m_CorrespondingSourceObject: {fileID: 0} 224 | m_PrefabInstance: {fileID: 0} 225 | m_PrefabAsset: {fileID: 0} 226 | m_GameObject: {fileID: 519420028} 227 | m_Enabled: 1 228 | --- !u!20 &519420031 229 | Camera: 230 | m_ObjectHideFlags: 0 231 | m_CorrespondingSourceObject: {fileID: 0} 232 | m_PrefabInstance: {fileID: 0} 233 | m_PrefabAsset: {fileID: 0} 234 | m_GameObject: {fileID: 519420028} 235 | m_Enabled: 1 236 | serializedVersion: 2 237 | m_ClearFlags: 2 238 | m_BackGroundColor: {r: 0.4433962, g: 0.4433962, b: 0.4433962, a: 0} 239 | m_projectionMatrixMode: 1 240 | m_GateFitMode: 2 241 | m_FOVAxisMode: 0 242 | m_SensorSize: {x: 36, y: 24} 243 | m_LensShift: {x: 0, y: 0} 244 | m_FocalLength: 50 245 | m_NormalizedViewPortRect: 246 | serializedVersion: 2 247 | x: 0 248 | y: 0 249 | width: 1 250 | height: 1 251 | near clip plane: 0.3 252 | far clip plane: 1000 253 | field of view: 60 254 | orthographic: 1 255 | orthographic size: 5 256 | m_Depth: -1 257 | m_CullingMask: 258 | serializedVersion: 2 259 | m_Bits: 4294967295 260 | m_RenderingPath: -1 261 | m_TargetTexture: {fileID: 0} 262 | m_TargetDisplay: 0 263 | m_TargetEye: 0 264 | m_HDR: 1 265 | m_AllowMSAA: 0 266 | m_AllowDynamicResolution: 0 267 | m_ForceIntoRT: 0 268 | m_OcclusionCulling: 0 269 | m_StereoConvergence: 10 270 | m_StereoSeparation: 0.022 271 | --- !u!4 &519420032 272 | Transform: 273 | m_ObjectHideFlags: 0 274 | m_CorrespondingSourceObject: {fileID: 0} 275 | m_PrefabInstance: {fileID: 0} 276 | m_PrefabAsset: {fileID: 0} 277 | m_GameObject: {fileID: 519420028} 278 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 279 | m_LocalPosition: {x: 0, y: 0, z: -10} 280 | m_LocalScale: {x: 1, y: 1, z: 1} 281 | m_Children: [] 282 | m_Father: {fileID: 0} 283 | m_RootOrder: 0 284 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 285 | --- !u!1 &572542672 286 | GameObject: 287 | m_ObjectHideFlags: 0 288 | m_CorrespondingSourceObject: {fileID: 0} 289 | m_PrefabInstance: {fileID: 0} 290 | m_PrefabAsset: {fileID: 0} 291 | serializedVersion: 6 292 | m_Component: 293 | - component: {fileID: 572542673} 294 | - component: {fileID: 572542675} 295 | - component: {fileID: 572542674} 296 | m_Layer: 5 297 | m_Name: Game Over Screen 298 | m_TagString: Untagged 299 | m_Icon: {fileID: 0} 300 | m_NavMeshLayer: 0 301 | m_StaticEditorFlags: 0 302 | m_IsActive: 0 303 | --- !u!224 &572542673 304 | RectTransform: 305 | m_ObjectHideFlags: 0 306 | m_CorrespondingSourceObject: {fileID: 0} 307 | m_PrefabInstance: {fileID: 0} 308 | m_PrefabAsset: {fileID: 0} 309 | m_GameObject: {fileID: 572542672} 310 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 311 | m_LocalPosition: {x: 0, y: 0, z: 0} 312 | m_LocalScale: {x: 1, y: 1, z: 1} 313 | m_Children: 314 | - {fileID: 57937952} 315 | m_Father: {fileID: 1096071321} 316 | m_RootOrder: 0 317 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 318 | m_AnchorMin: {x: 0, y: 0} 319 | m_AnchorMax: {x: 1, y: 1} 320 | m_AnchoredPosition: {x: 0, y: 0} 321 | m_SizeDelta: {x: 0, y: 0} 322 | m_Pivot: {x: 0.5, y: 0.5} 323 | --- !u!114 &572542674 324 | MonoBehaviour: 325 | m_ObjectHideFlags: 0 326 | m_CorrespondingSourceObject: {fileID: 0} 327 | m_PrefabInstance: {fileID: 0} 328 | m_PrefabAsset: {fileID: 0} 329 | m_GameObject: {fileID: 572542672} 330 | m_Enabled: 1 331 | m_EditorHideFlags: 0 332 | m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} 333 | m_Name: 334 | m_EditorClassIdentifier: 335 | m_Material: {fileID: 0} 336 | m_Color: {r: 0, g: 0, b: 0, a: 1} 337 | m_RaycastTarget: 1 338 | m_Maskable: 1 339 | m_OnCullStateChanged: 340 | m_PersistentCalls: 341 | m_Calls: [] 342 | m_Sprite: {fileID: 0} 343 | m_Type: 0 344 | m_PreserveAspect: 0 345 | m_FillCenter: 1 346 | m_FillMethod: 4 347 | m_FillAmount: 1 348 | m_FillClockwise: 1 349 | m_FillOrigin: 0 350 | m_UseSpriteMesh: 0 351 | m_PixelsPerUnitMultiplier: 1 352 | --- !u!222 &572542675 353 | CanvasRenderer: 354 | m_ObjectHideFlags: 0 355 | m_CorrespondingSourceObject: {fileID: 0} 356 | m_PrefabInstance: {fileID: 0} 357 | m_PrefabAsset: {fileID: 0} 358 | m_GameObject: {fileID: 572542672} 359 | m_CullTransparentMesh: 0 360 | --- !u!1 &1096071317 361 | GameObject: 362 | m_ObjectHideFlags: 0 363 | m_CorrespondingSourceObject: {fileID: 0} 364 | m_PrefabInstance: {fileID: 0} 365 | m_PrefabAsset: {fileID: 0} 366 | serializedVersion: 6 367 | m_Component: 368 | - component: {fileID: 1096071321} 369 | - component: {fileID: 1096071320} 370 | - component: {fileID: 1096071319} 371 | - component: {fileID: 1096071318} 372 | m_Layer: 5 373 | m_Name: Canvas 374 | m_TagString: Untagged 375 | m_Icon: {fileID: 0} 376 | m_NavMeshLayer: 0 377 | m_StaticEditorFlags: 0 378 | m_IsActive: 1 379 | --- !u!114 &1096071318 380 | MonoBehaviour: 381 | m_ObjectHideFlags: 0 382 | m_CorrespondingSourceObject: {fileID: 0} 383 | m_PrefabInstance: {fileID: 0} 384 | m_PrefabAsset: {fileID: 0} 385 | m_GameObject: {fileID: 1096071317} 386 | m_Enabled: 1 387 | m_EditorHideFlags: 0 388 | m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} 389 | m_Name: 390 | m_EditorClassIdentifier: 391 | m_IgnoreReversedGraphics: 1 392 | m_BlockingObjects: 0 393 | m_BlockingMask: 394 | serializedVersion: 2 395 | m_Bits: 4294967295 396 | --- !u!114 &1096071319 397 | MonoBehaviour: 398 | m_ObjectHideFlags: 0 399 | m_CorrespondingSourceObject: {fileID: 0} 400 | m_PrefabInstance: {fileID: 0} 401 | m_PrefabAsset: {fileID: 0} 402 | m_GameObject: {fileID: 1096071317} 403 | m_Enabled: 1 404 | m_EditorHideFlags: 0 405 | m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} 406 | m_Name: 407 | m_EditorClassIdentifier: 408 | m_UiScaleMode: 0 409 | m_ReferencePixelsPerUnit: 100 410 | m_ScaleFactor: 1 411 | m_ReferenceResolution: {x: 800, y: 600} 412 | m_ScreenMatchMode: 0 413 | m_MatchWidthOrHeight: 0 414 | m_PhysicalUnit: 3 415 | m_FallbackScreenDPI: 96 416 | m_DefaultSpriteDPI: 96 417 | m_DynamicPixelsPerUnit: 1 418 | --- !u!223 &1096071320 419 | Canvas: 420 | m_ObjectHideFlags: 0 421 | m_CorrespondingSourceObject: {fileID: 0} 422 | m_PrefabInstance: {fileID: 0} 423 | m_PrefabAsset: {fileID: 0} 424 | m_GameObject: {fileID: 1096071317} 425 | m_Enabled: 1 426 | serializedVersion: 3 427 | m_RenderMode: 0 428 | m_Camera: {fileID: 0} 429 | m_PlaneDistance: 100 430 | m_PixelPerfect: 0 431 | m_ReceivesEvents: 1 432 | m_OverrideSorting: 0 433 | m_OverridePixelPerfect: 0 434 | m_SortingBucketNormalizedSize: 0 435 | m_AdditionalShaderChannelsFlag: 0 436 | m_SortingLayerID: 0 437 | m_SortingOrder: 0 438 | m_TargetDisplay: 0 439 | --- !u!224 &1096071321 440 | RectTransform: 441 | m_ObjectHideFlags: 0 442 | m_CorrespondingSourceObject: {fileID: 0} 443 | m_PrefabInstance: {fileID: 0} 444 | m_PrefabAsset: {fileID: 0} 445 | m_GameObject: {fileID: 1096071317} 446 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 447 | m_LocalPosition: {x: 0, y: 0, z: 0} 448 | m_LocalScale: {x: 0, y: 0, z: 0} 449 | m_Children: 450 | - {fileID: 572542673} 451 | m_Father: {fileID: 0} 452 | m_RootOrder: 3 453 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 454 | m_AnchorMin: {x: 0, y: 0} 455 | m_AnchorMax: {x: 0, y: 0} 456 | m_AnchoredPosition: {x: 0, y: 0} 457 | m_SizeDelta: {x: 0, y: 0} 458 | m_Pivot: {x: 0, y: 0} 459 | --- !u!1 &1134275395 460 | GameObject: 461 | m_ObjectHideFlags: 0 462 | m_CorrespondingSourceObject: {fileID: 0} 463 | m_PrefabInstance: {fileID: 0} 464 | m_PrefabAsset: {fileID: 0} 465 | serializedVersion: 6 466 | m_Component: 467 | - component: {fileID: 1134275396} 468 | - component: {fileID: 1134275398} 469 | - component: {fileID: 1134275397} 470 | - component: {fileID: 1134275399} 471 | m_Layer: 5 472 | m_Name: Text 473 | m_TagString: Untagged 474 | m_Icon: {fileID: 0} 475 | m_NavMeshLayer: 0 476 | m_StaticEditorFlags: 0 477 | m_IsActive: 1 478 | --- !u!224 &1134275396 479 | RectTransform: 480 | m_ObjectHideFlags: 0 481 | m_CorrespondingSourceObject: {fileID: 0} 482 | m_PrefabInstance: {fileID: 0} 483 | m_PrefabAsset: {fileID: 0} 484 | m_GameObject: {fileID: 1134275395} 485 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 486 | m_LocalPosition: {x: 0, y: 0, z: 0} 487 | m_LocalScale: {x: 0.01, y: 0.01, z: 1} 488 | m_Children: [] 489 | m_Father: {fileID: 1555508619} 490 | m_RootOrder: 1 491 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 492 | m_AnchorMin: {x: 1, y: 1} 493 | m_AnchorMax: {x: 1, y: 1} 494 | m_AnchoredPosition: {x: 0, y: 0} 495 | m_SizeDelta: {x: 300, y: 100} 496 | m_Pivot: {x: 1, y: 1} 497 | --- !u!114 &1134275397 498 | MonoBehaviour: 499 | m_ObjectHideFlags: 0 500 | m_CorrespondingSourceObject: {fileID: 0} 501 | m_PrefabInstance: {fileID: 0} 502 | m_PrefabAsset: {fileID: 0} 503 | m_GameObject: {fileID: 1134275395} 504 | m_Enabled: 1 505 | m_EditorHideFlags: 0 506 | m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} 507 | m_Name: 508 | m_EditorClassIdentifier: 509 | m_Material: {fileID: 0} 510 | m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} 511 | m_RaycastTarget: 1 512 | m_Maskable: 1 513 | m_OnCullStateChanged: 514 | m_PersistentCalls: 515 | m_Calls: [] 516 | m_FontData: 517 | m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} 518 | m_FontSize: 57 519 | m_FontStyle: 0 520 | m_BestFit: 0 521 | m_MinSize: 1 522 | m_MaxSize: 76 523 | m_Alignment: 2 524 | m_AlignByGeometry: 0 525 | m_RichText: 1 526 | m_HorizontalOverflow: 0 527 | m_VerticalOverflow: 0 528 | m_LineSpacing: 1 529 | m_Text: 'Lives: 30 530 | 531 | ' 532 | --- !u!222 &1134275398 533 | CanvasRenderer: 534 | m_ObjectHideFlags: 0 535 | m_CorrespondingSourceObject: {fileID: 0} 536 | m_PrefabInstance: {fileID: 0} 537 | m_PrefabAsset: {fileID: 0} 538 | m_GameObject: {fileID: 1134275395} 539 | m_CullTransparentMesh: 0 540 | --- !u!114 &1134275399 541 | MonoBehaviour: 542 | m_ObjectHideFlags: 0 543 | m_CorrespondingSourceObject: {fileID: 0} 544 | m_PrefabInstance: {fileID: 0} 545 | m_PrefabAsset: {fileID: 0} 546 | m_GameObject: {fileID: 1134275395} 547 | m_Enabled: 1 548 | m_EditorHideFlags: 0 549 | m_Script: {fileID: 11500000, guid: 814f1ef0a6e668f4d8c289db509980cf, type: 3} 550 | m_Name: 551 | m_EditorClassIdentifier: 552 | _text: {fileID: 1134275397} 553 | --- !u!1 &1224492597 554 | GameObject: 555 | m_ObjectHideFlags: 0 556 | m_CorrespondingSourceObject: {fileID: 0} 557 | m_PrefabInstance: {fileID: 0} 558 | m_PrefabAsset: {fileID: 0} 559 | serializedVersion: 6 560 | m_Component: 561 | - component: {fileID: 1224492599} 562 | - component: {fileID: 1224492598} 563 | - component: {fileID: 1224492600} 564 | m_Layer: 0 565 | m_Name: Player 566 | m_TagString: Untagged 567 | m_Icon: {fileID: 0} 568 | m_NavMeshLayer: 0 569 | m_StaticEditorFlags: 0 570 | m_IsActive: 1 571 | --- !u!212 &1224492598 572 | SpriteRenderer: 573 | m_ObjectHideFlags: 0 574 | m_CorrespondingSourceObject: {fileID: 0} 575 | m_PrefabInstance: {fileID: 0} 576 | m_PrefabAsset: {fileID: 0} 577 | m_GameObject: {fileID: 1224492597} 578 | m_Enabled: 1 579 | m_CastShadows: 0 580 | m_ReceiveShadows: 0 581 | m_DynamicOccludee: 1 582 | m_MotionVectors: 1 583 | m_LightProbeUsage: 1 584 | m_ReflectionProbeUsage: 1 585 | m_RayTracingMode: 0 586 | m_RenderingLayerMask: 1 587 | m_RendererPriority: 0 588 | m_Materials: 589 | - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} 590 | m_StaticBatchInfo: 591 | firstSubMesh: 0 592 | subMeshCount: 0 593 | m_StaticBatchRoot: {fileID: 0} 594 | m_ProbeAnchor: {fileID: 0} 595 | m_LightProbeVolumeOverride: {fileID: 0} 596 | m_ScaleInLightmap: 1 597 | m_ReceiveGI: 1 598 | m_PreserveUVs: 0 599 | m_IgnoreNormalsForChartDetection: 0 600 | m_ImportantGI: 0 601 | m_StitchLightmapSeams: 1 602 | m_SelectedEditorRenderState: 0 603 | m_MinimumChartSize: 4 604 | m_AutoUVMaxDistance: 0.5 605 | m_AutoUVMaxAngle: 89 606 | m_LightmapParameters: {fileID: 0} 607 | m_SortingLayerID: 0 608 | m_SortingLayer: 0 609 | m_SortingOrder: 0 610 | m_Sprite: {fileID: 21300000, guid: 174aac81e8e6f964fbe5c7556c22e449, type: 3} 611 | m_Color: {r: 1, g: 1, b: 1, a: 1} 612 | m_FlipX: 0 613 | m_FlipY: 0 614 | m_DrawMode: 0 615 | m_Size: {x: 1, y: 1} 616 | m_AdaptiveModeThreshold: 0.5 617 | m_SpriteTileMode: 0 618 | m_WasSpriteAssigned: 1 619 | m_MaskInteraction: 0 620 | m_SpriteSortPoint: 0 621 | --- !u!4 &1224492599 622 | Transform: 623 | m_ObjectHideFlags: 0 624 | m_CorrespondingSourceObject: {fileID: 0} 625 | m_PrefabInstance: {fileID: 0} 626 | m_PrefabAsset: {fileID: 0} 627 | m_GameObject: {fileID: 1224492597} 628 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 629 | m_LocalPosition: {x: 0, y: -2.31, z: 0} 630 | m_LocalScale: {x: 1, y: 1, z: 1} 631 | m_Children: 632 | - {fileID: 1555508619} 633 | m_Father: {fileID: 0} 634 | m_RootOrder: 1 635 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 636 | --- !u!114 &1224492600 637 | MonoBehaviour: 638 | m_ObjectHideFlags: 0 639 | m_CorrespondingSourceObject: {fileID: 0} 640 | m_PrefabInstance: {fileID: 0} 641 | m_PrefabAsset: {fileID: 0} 642 | m_GameObject: {fileID: 1224492597} 643 | m_Enabled: 1 644 | m_EditorHideFlags: 0 645 | m_Script: {fileID: 11500000, guid: bcfdbc463cdbc5843b8ee2cb9ea27245, type: 3} 646 | m_Name: 647 | m_EditorClassIdentifier: 648 | _cooldownUI: {fileID: 1641373982} 649 | _livesUI: {fileID: 1134275399} 650 | _gameOverScreen: {fileID: 572542672} 651 | _startLives: 30 652 | _healingCooldown: 3 653 | --- !u!1 &1439454505 654 | GameObject: 655 | m_ObjectHideFlags: 0 656 | m_CorrespondingSourceObject: {fileID: 0} 657 | m_PrefabInstance: {fileID: 0} 658 | m_PrefabAsset: {fileID: 0} 659 | serializedVersion: 6 660 | m_Component: 661 | - component: {fileID: 1439454507} 662 | - component: {fileID: 1439454506} 663 | m_Layer: 0 664 | m_Name: Other Examples 665 | m_TagString: Untagged 666 | m_Icon: {fileID: 0} 667 | m_NavMeshLayer: 0 668 | m_StaticEditorFlags: 0 669 | m_IsActive: 1 670 | --- !u!114 &1439454506 671 | MonoBehaviour: 672 | m_ObjectHideFlags: 0 673 | m_CorrespondingSourceObject: {fileID: 0} 674 | m_PrefabInstance: {fileID: 0} 675 | m_PrefabAsset: {fileID: 0} 676 | m_GameObject: {fileID: 1439454505} 677 | m_Enabled: 1 678 | m_EditorHideFlags: 0 679 | m_Script: {fileID: 11500000, guid: 79c2bb1a87761144798bbccd900712db, type: 3} 680 | m_Name: 681 | m_EditorClassIdentifier: 682 | _camera: {fileID: 519420031} 683 | --- !u!4 &1439454507 684 | Transform: 685 | m_ObjectHideFlags: 0 686 | m_CorrespondingSourceObject: {fileID: 0} 687 | m_PrefabInstance: {fileID: 0} 688 | m_PrefabAsset: {fileID: 0} 689 | m_GameObject: {fileID: 1439454505} 690 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 691 | m_LocalPosition: {x: 0, y: 0, z: -10} 692 | m_LocalScale: {x: 1, y: 1, z: 1} 693 | m_Children: [] 694 | m_Father: {fileID: 0} 695 | m_RootOrder: 4 696 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 697 | --- !u!1 &1555508615 698 | GameObject: 699 | m_ObjectHideFlags: 0 700 | m_CorrespondingSourceObject: {fileID: 0} 701 | m_PrefabInstance: {fileID: 0} 702 | m_PrefabAsset: {fileID: 0} 703 | serializedVersion: 6 704 | m_Component: 705 | - component: {fileID: 1555508619} 706 | - component: {fileID: 1555508618} 707 | - component: {fileID: 1555508617} 708 | - component: {fileID: 1555508616} 709 | m_Layer: 5 710 | m_Name: Player Canvas 711 | m_TagString: Untagged 712 | m_Icon: {fileID: 0} 713 | m_NavMeshLayer: 0 714 | m_StaticEditorFlags: 0 715 | m_IsActive: 1 716 | --- !u!114 &1555508616 717 | MonoBehaviour: 718 | m_ObjectHideFlags: 0 719 | m_CorrespondingSourceObject: {fileID: 0} 720 | m_PrefabInstance: {fileID: 0} 721 | m_PrefabAsset: {fileID: 0} 722 | m_GameObject: {fileID: 1555508615} 723 | m_Enabled: 1 724 | m_EditorHideFlags: 0 725 | m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} 726 | m_Name: 727 | m_EditorClassIdentifier: 728 | m_IgnoreReversedGraphics: 1 729 | m_BlockingObjects: 0 730 | m_BlockingMask: 731 | serializedVersion: 2 732 | m_Bits: 4294967295 733 | --- !u!114 &1555508617 734 | MonoBehaviour: 735 | m_ObjectHideFlags: 0 736 | m_CorrespondingSourceObject: {fileID: 0} 737 | m_PrefabInstance: {fileID: 0} 738 | m_PrefabAsset: {fileID: 0} 739 | m_GameObject: {fileID: 1555508615} 740 | m_Enabled: 1 741 | m_EditorHideFlags: 0 742 | m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} 743 | m_Name: 744 | m_EditorClassIdentifier: 745 | m_UiScaleMode: 0 746 | m_ReferencePixelsPerUnit: 100 747 | m_ScaleFactor: 1 748 | m_ReferenceResolution: {x: 800, y: 600} 749 | m_ScreenMatchMode: 0 750 | m_MatchWidthOrHeight: 0 751 | m_PhysicalUnit: 3 752 | m_FallbackScreenDPI: 96 753 | m_DefaultSpriteDPI: 96 754 | m_DynamicPixelsPerUnit: 1 755 | --- !u!223 &1555508618 756 | Canvas: 757 | m_ObjectHideFlags: 0 758 | m_CorrespondingSourceObject: {fileID: 0} 759 | m_PrefabInstance: {fileID: 0} 760 | m_PrefabAsset: {fileID: 0} 761 | m_GameObject: {fileID: 1555508615} 762 | m_Enabled: 1 763 | serializedVersion: 3 764 | m_RenderMode: 2 765 | m_Camera: {fileID: 0} 766 | m_PlaneDistance: 100 767 | m_PixelPerfect: 0 768 | m_ReceivesEvents: 1 769 | m_OverrideSorting: 0 770 | m_OverridePixelPerfect: 0 771 | m_SortingBucketNormalizedSize: 0 772 | m_AdditionalShaderChannelsFlag: 0 773 | m_SortingLayerID: 0 774 | m_SortingOrder: 0 775 | m_TargetDisplay: 0 776 | --- !u!224 &1555508619 777 | RectTransform: 778 | m_ObjectHideFlags: 0 779 | m_CorrespondingSourceObject: {fileID: 0} 780 | m_PrefabInstance: {fileID: 0} 781 | m_PrefabAsset: {fileID: 0} 782 | m_GameObject: {fileID: 1555508615} 783 | m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 784 | m_LocalPosition: {x: 0, y: 0, z: 0} 785 | m_LocalScale: {x: 1, y: 1, z: 1} 786 | m_Children: 787 | - {fileID: 1641373979} 788 | - {fileID: 1134275396} 789 | m_Father: {fileID: 1224492599} 790 | m_RootOrder: 0 791 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 792 | m_AnchorMin: {x: 0, y: 0} 793 | m_AnchorMax: {x: 0, y: 0} 794 | m_AnchoredPosition: {x: 0, y: 2.31} 795 | m_SizeDelta: {x: 5, y: 5} 796 | m_Pivot: {x: 0.5, y: 0.5} 797 | --- !u!1 &1634026860 798 | GameObject: 799 | m_ObjectHideFlags: 0 800 | m_CorrespondingSourceObject: {fileID: 0} 801 | m_PrefabInstance: {fileID: 0} 802 | m_PrefabAsset: {fileID: 0} 803 | serializedVersion: 6 804 | m_Component: 805 | - component: {fileID: 1634026863} 806 | - component: {fileID: 1634026862} 807 | - component: {fileID: 1634026861} 808 | m_Layer: 0 809 | m_Name: EventSystem 810 | m_TagString: Untagged 811 | m_Icon: {fileID: 0} 812 | m_NavMeshLayer: 0 813 | m_StaticEditorFlags: 0 814 | m_IsActive: 1 815 | --- !u!114 &1634026861 816 | MonoBehaviour: 817 | m_ObjectHideFlags: 0 818 | m_CorrespondingSourceObject: {fileID: 0} 819 | m_PrefabInstance: {fileID: 0} 820 | m_PrefabAsset: {fileID: 0} 821 | m_GameObject: {fileID: 1634026860} 822 | m_Enabled: 1 823 | m_EditorHideFlags: 0 824 | m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3} 825 | m_Name: 826 | m_EditorClassIdentifier: 827 | m_HorizontalAxis: Horizontal 828 | m_VerticalAxis: Vertical 829 | m_SubmitButton: Submit 830 | m_CancelButton: Cancel 831 | m_InputActionsPerSecond: 10 832 | m_RepeatDelay: 0.5 833 | m_ForceModuleActive: 0 834 | --- !u!114 &1634026862 835 | MonoBehaviour: 836 | m_ObjectHideFlags: 0 837 | m_CorrespondingSourceObject: {fileID: 0} 838 | m_PrefabInstance: {fileID: 0} 839 | m_PrefabAsset: {fileID: 0} 840 | m_GameObject: {fileID: 1634026860} 841 | m_Enabled: 1 842 | m_EditorHideFlags: 0 843 | m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} 844 | m_Name: 845 | m_EditorClassIdentifier: 846 | m_FirstSelected: {fileID: 0} 847 | m_sendNavigationEvents: 1 848 | m_DragThreshold: 10 849 | --- !u!4 &1634026863 850 | Transform: 851 | m_ObjectHideFlags: 0 852 | m_CorrespondingSourceObject: {fileID: 0} 853 | m_PrefabInstance: {fileID: 0} 854 | m_PrefabAsset: {fileID: 0} 855 | m_GameObject: {fileID: 1634026860} 856 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 857 | m_LocalPosition: {x: 0, y: 0, z: 0} 858 | m_LocalScale: {x: 1, y: 1, z: 1} 859 | m_Children: [] 860 | m_Father: {fileID: 0} 861 | m_RootOrder: 2 862 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 863 | --- !u!1 &1641373978 864 | GameObject: 865 | m_ObjectHideFlags: 0 866 | m_CorrespondingSourceObject: {fileID: 0} 867 | m_PrefabInstance: {fileID: 0} 868 | m_PrefabAsset: {fileID: 0} 869 | serializedVersion: 6 870 | m_Component: 871 | - component: {fileID: 1641373979} 872 | - component: {fileID: 1641373981} 873 | - component: {fileID: 1641373980} 874 | - component: {fileID: 1641373982} 875 | m_Layer: 5 876 | m_Name: Image 877 | m_TagString: Untagged 878 | m_Icon: {fileID: 0} 879 | m_NavMeshLayer: 0 880 | m_StaticEditorFlags: 0 881 | m_IsActive: 0 882 | --- !u!224 &1641373979 883 | RectTransform: 884 | m_ObjectHideFlags: 0 885 | m_CorrespondingSourceObject: {fileID: 0} 886 | m_PrefabInstance: {fileID: 0} 887 | m_PrefabAsset: {fileID: 0} 888 | m_GameObject: {fileID: 1641373978} 889 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 890 | m_LocalPosition: {x: 0, y: 0, z: 0} 891 | m_LocalScale: {x: 1, y: 1, z: 1} 892 | m_Children: [] 893 | m_Father: {fileID: 1555508619} 894 | m_RootOrder: 0 895 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 896 | m_AnchorMin: {x: 0.5, y: 0.5} 897 | m_AnchorMax: {x: 0.5, y: 0.5} 898 | m_AnchoredPosition: {x: 0, y: -0.5} 899 | m_SizeDelta: {x: 2, y: 2} 900 | m_Pivot: {x: 0.5, y: 0.5} 901 | --- !u!114 &1641373980 902 | MonoBehaviour: 903 | m_ObjectHideFlags: 0 904 | m_CorrespondingSourceObject: {fileID: 0} 905 | m_PrefabInstance: {fileID: 0} 906 | m_PrefabAsset: {fileID: 0} 907 | m_GameObject: {fileID: 1641373978} 908 | m_Enabled: 1 909 | m_EditorHideFlags: 0 910 | m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} 911 | m_Name: 912 | m_EditorClassIdentifier: 913 | m_Material: {fileID: 0} 914 | m_Color: {r: 1, g: 1, b: 1, a: 1} 915 | m_RaycastTarget: 0 916 | m_Maskable: 1 917 | m_OnCullStateChanged: 918 | m_PersistentCalls: 919 | m_Calls: [] 920 | m_Sprite: {fileID: 21300000, guid: 058e82ad5dda57941a84210b809b15a4, type: 3} 921 | m_Type: 3 922 | m_PreserveAspect: 1 923 | m_FillCenter: 1 924 | m_FillMethod: 4 925 | m_FillAmount: 1 926 | m_FillClockwise: 1 927 | m_FillOrigin: 2 928 | m_UseSpriteMesh: 0 929 | m_PixelsPerUnitMultiplier: 1 930 | --- !u!222 &1641373981 931 | CanvasRenderer: 932 | m_ObjectHideFlags: 0 933 | m_CorrespondingSourceObject: {fileID: 0} 934 | m_PrefabInstance: {fileID: 0} 935 | m_PrefabAsset: {fileID: 0} 936 | m_GameObject: {fileID: 1641373978} 937 | m_CullTransparentMesh: 0 938 | --- !u!114 &1641373982 939 | MonoBehaviour: 940 | m_ObjectHideFlags: 0 941 | m_CorrespondingSourceObject: {fileID: 0} 942 | m_PrefabInstance: {fileID: 0} 943 | m_PrefabAsset: {fileID: 0} 944 | m_GameObject: {fileID: 1641373978} 945 | m_Enabled: 1 946 | m_EditorHideFlags: 0 947 | m_Script: {fileID: 11500000, guid: edc78a4f55e12ce4ea4b70695e11a274, type: 3} 948 | m_Name: 949 | m_EditorClassIdentifier: 950 | _donutImage: {fileID: 1641373980} 951 | -------------------------------------------------------------------------------- /Assets/STasks/Examples/STasksExamples.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2cda990e2423bbf4892e6590ba056729 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/STasks/Examples/Sprites.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 01781daf883233548b1ead38a1f3c6b5 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/STasks/Examples/Sprites/Square.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MartinIsla/STasks/7f6c7f47436ee04d5a14582426140041f75fa598/Assets/STasks/Examples/Sprites/Square.png -------------------------------------------------------------------------------- /Assets/STasks/Examples/Sprites/Square.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 174aac81e8e6f964fbe5c7556c22e449 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 1 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: 0 35 | aniso: 1 36 | mipBias: 0 37 | wrapU: 0 38 | wrapV: 0 39 | wrapW: 0 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 3 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 4 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 0 53 | spriteTessellationDetail: -1 54 | textureType: 8 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | applyGammaDecoding: 0 61 | platformSettings: 62 | - serializedVersion: 3 63 | buildTarget: DefaultTexturePlatform 64 | maxTextureSize: 2048 65 | resizeAlgorithm: 0 66 | textureFormat: 4 67 | textureCompression: 1 68 | compressionQuality: 50 69 | crunchedCompression: 0 70 | allowsAlphaSplitting: 0 71 | overridden: 0 72 | androidETC2FallbackOverride: 0 73 | forceMaximumCompressionQuality_BC6H_BC7: 0 74 | spriteSheet: 75 | serializedVersion: 2 76 | sprites: [] 77 | outline: 78 | - - {x: -2, y: -2} 79 | - {x: -2, y: 2} 80 | - {x: 2, y: 2} 81 | - {x: 2, y: -2} 82 | physicsShape: 83 | - - {x: -2, y: -2} 84 | - {x: -2, y: 2} 85 | - {x: 2, y: 2} 86 | - {x: 2, y: -2} 87 | bones: [] 88 | spriteID: 5e97eb03825dee720800000000000000 89 | internalID: 0 90 | vertices: [] 91 | indices: 92 | edges: [] 93 | weights: [] 94 | secondaryTextures: [] 95 | spritePackingTag: 96 | pSDRemoveMatte: 0 97 | pSDShowRemoveMatteOption: 0 98 | userData: 99 | assetBundleName: 100 | assetBundleVariant: 101 | -------------------------------------------------------------------------------- /Assets/STasks/Examples/Sprites/circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MartinIsla/STasks/7f6c7f47436ee04d5a14582426140041f75fa598/Assets/STasks/Examples/Sprites/circle.png -------------------------------------------------------------------------------- /Assets/STasks/Examples/Sprites/circle.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 058e82ad5dda57941a84210b809b15a4 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -100 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: 1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 1 53 | spriteTessellationDetail: -1 54 | textureType: 8 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | applyGammaDecoding: 0 61 | platformSettings: 62 | - serializedVersion: 3 63 | buildTarget: DefaultTexturePlatform 64 | maxTextureSize: 2048 65 | resizeAlgorithm: 0 66 | textureFormat: -1 67 | textureCompression: 1 68 | compressionQuality: 50 69 | crunchedCompression: 0 70 | allowsAlphaSplitting: 0 71 | overridden: 0 72 | androidETC2FallbackOverride: 0 73 | forceMaximumCompressionQuality_BC6H_BC7: 0 74 | spriteSheet: 75 | serializedVersion: 2 76 | sprites: [] 77 | outline: [] 78 | physicsShape: [] 79 | bones: [] 80 | spriteID: 5e97eb03825dee720800000000000000 81 | internalID: 0 82 | vertices: [] 83 | indices: 84 | edges: [] 85 | weights: [] 86 | secondaryTextures: [] 87 | spritePackingTag: 88 | pSDRemoveMatte: 0 89 | pSDShowRemoveMatteOption: 0 90 | userData: 91 | assetBundleName: 92 | assetBundleVariant: 93 | -------------------------------------------------------------------------------- /Assets/STasks/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 600ec39e2bc71be46ab22e562f16c883 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/STasks/Scripts/Koffie.SimpleTasks.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Koffie.SimpleTasks" 3 | } 4 | -------------------------------------------------------------------------------- /Assets/STasks/Scripts/Koffie.SimpleTasks.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b2b74bea20f643446bd5c9ac75b9b0aa 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/STasks/Scripts/STask.cs: -------------------------------------------------------------------------------- 1 | namespace Koffie.SimpleTasks 2 | { 3 | public abstract class STask 4 | { 5 | internal static float deltaTime; 6 | internal static float fixedDeltaTime; 7 | 8 | /// 9 | /// The time since the task started (after the delay). This is different from , which is the time since the task was created. 10 | /// 11 | public float TimeSinceStart { get; private set; } 12 | 13 | /// 14 | /// The progress (0 to 1) of the task. The progress means different things for the different types of tasks. 15 | /// Usually, the action is invoked when progress is 1. 16 | /// 17 | public float Progress => GetProgress(); 18 | 19 | /// 20 | /// The time since the task was created. 21 | /// 22 | public float ElapsedTime => _elapsedTime; 23 | 24 | /// 25 | /// The delay before starting the task. 26 | /// 27 | public readonly float Delay; 28 | 29 | /// 30 | /// Whether this task has been completed or killed. 31 | /// 32 | public bool isDone; 33 | 34 | /// 35 | /// The delegate invoked when the task is completed. It's recommended that you use to subscribe. 36 | /// 37 | public SAction onComplete; 38 | 39 | /// 40 | /// The delegate invoked when the task is updated. It's recommended that you use to subscribe. 41 | /// 42 | public SAction onUpdate; 43 | 44 | /// 45 | /// The delegate invoked when the task is started after the initial delay. It's recommended that you use to subscribe. 46 | /// 47 | public SAction onStart; 48 | 49 | /// 50 | /// The delegate invoked when the task is killed. It's recommended that you use to subscribe. 51 | /// 52 | public SAction onKill; 53 | 54 | /// 55 | /// The delegate invoked when time exceeds the . It's recommended that you use to subscribe. 56 | /// 57 | public SAction onTimeout; 58 | 59 | /// 60 | /// The maximum lifetime of the task after the delay (). 61 | /// 62 | public readonly float MaxDuration; 63 | 64 | /// 65 | /// Whether a has been set for this task. 66 | /// 67 | public readonly bool HasMaxDuration; 68 | 69 | protected readonly SAction action; 70 | public readonly UpdateType UpdateType; 71 | 72 | private bool _isWaitingForDelay; 73 | private bool _taskStarted; 74 | private bool _isPaused; 75 | private float _elapsedTime; 76 | 77 | protected abstract void OnUpdate(); 78 | protected abstract float GetProgress(); 79 | 80 | 81 | public virtual void Restart() 82 | { 83 | _elapsedTime = 0; 84 | TimeSinceStart = 0; 85 | _isWaitingForDelay = Delay > 0; 86 | _taskStarted = false; 87 | isDone = false; 88 | _isPaused = false; 89 | 90 | STasks.AddTask(this); 91 | } 92 | 93 | public STask(in STaskSettings settings) 94 | { 95 | Delay = settings.delay; 96 | 97 | this.action = settings.action; 98 | this.MaxDuration = settings.maxDuration; 99 | this.UpdateType = settings.updateType; 100 | 101 | _elapsedTime = 0; 102 | 103 | HasMaxDuration = MaxDuration > 0; 104 | _isWaitingForDelay = Delay > 0; 105 | _taskStarted = false; 106 | } 107 | 108 | public void Update() 109 | { 110 | UpdateInternal(); 111 | } 112 | 113 | public void LateUpdate() 114 | { 115 | UpdateInternal(); 116 | } 117 | 118 | public void FixedUpdate() 119 | { 120 | UpdateInternal(); 121 | } 122 | 123 | private void UpdateInternal() 124 | { 125 | if (_isPaused) { return; } 126 | 127 | if (_isWaitingForDelay) 128 | { 129 | _isWaitingForDelay = _elapsedTime < Delay; 130 | 131 | if (!_isWaitingForDelay) 132 | { 133 | OnStart(); 134 | } 135 | } 136 | else 137 | { 138 | if (!_taskStarted) 139 | { 140 | OnStart(); 141 | } 142 | 143 | TimeSinceStart += deltaTime; 144 | OnUpdate(); 145 | 146 | if (HasMaxDuration && TimeSinceStart >= MaxDuration) 147 | { 148 | OnTimeout(); 149 | return; 150 | } 151 | } 152 | 153 | _elapsedTime += deltaTime; 154 | onUpdate?.Invoke(); 155 | } 156 | 157 | protected virtual void OnTimeout() 158 | { 159 | onTimeout?.Invoke(); 160 | isDone = true; 161 | } 162 | 163 | protected virtual void OnStart() 164 | { 165 | TimeSinceStart = 0; 166 | _taskStarted = true; 167 | onStart?.Invoke(); 168 | } 169 | 170 | /// 171 | /// Forces the task to complete, invoking the scheduled action and calling OnComplete 172 | /// 173 | public virtual void Complete() 174 | { 175 | isDone = true; 176 | action.Invoke(); 177 | onComplete?.Invoke(); 178 | } 179 | 180 | /// 181 | /// Forces the task to stop without invoking the action and without calling OnComplete. OnKill will be invoked. 182 | /// 183 | public void Kill() 184 | { 185 | if (isDone) return; 186 | 187 | isDone = true; 188 | onKill?.Invoke(); 189 | } 190 | 191 | /// 192 | /// Resumes the task 193 | /// 194 | public void Resume() 195 | { 196 | _isPaused = false; 197 | } 198 | 199 | /// 200 | /// Pauses the task 201 | /// 202 | public void Pause() 203 | { 204 | _isPaused = true; 205 | } 206 | 207 | /// 208 | /// Subscribe a method that will be invoked when the task is complete 209 | /// 210 | /// The action to be invoked 211 | /// The task 212 | public STask OnComplete(SAction action) 213 | { 214 | onComplete += action; 215 | return this; 216 | } 217 | 218 | /// 219 | /// Subscribe a method that will be invoked when the task is Updated (every frame) 220 | /// 221 | /// The action to be invoked 222 | /// The task 223 | public STask OnUpdate(SAction action) 224 | { 225 | onUpdate += action; 226 | return this; 227 | } 228 | 229 | /// 230 | /// Subscribe a method that will be invoked when the task is started (after the delay) 231 | /// 232 | /// The action to be invoked 233 | /// The task 234 | public STask OnStart(SAction action) 235 | { 236 | onStart += action; 237 | return this; 238 | } 239 | 240 | /// 241 | /// Subscribe a method that will be invoked when the task is killed 242 | /// 243 | /// The action to be invoked 244 | /// The task 245 | public STask OnKill(SAction action) 246 | { 247 | onKill += action; 248 | return this; 249 | } 250 | 251 | /// 252 | /// Subscribe a method that will be invoked when the task's time exceeds its 253 | /// 254 | /// 255 | /// 256 | public STask OnTimeout(SAction action) 257 | { 258 | onTimeout += action; 259 | return this; 260 | } 261 | } 262 | } -------------------------------------------------------------------------------- /Assets/STasks/Scripts/STask.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dd0ed9d17558f8b49a4798036138f2c9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/STasks/Scripts/STaskSettings.cs: -------------------------------------------------------------------------------- 1 | namespace Koffie.SimpleTasks 2 | { 3 | public struct STaskSettings 4 | { 5 | public SAction action; 6 | public SCondition condition; 7 | public float delay; 8 | public float frequency; 9 | public float maxDuration; 10 | public int targetFrames; 11 | public UpdateType updateType; 12 | } 13 | } -------------------------------------------------------------------------------- /Assets/STasks/Scripts/STaskSettings.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b3db34425dabfee49829fb5f0382a8d1 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/STasks/Scripts/STasks.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace Koffie.SimpleTasks 4 | { 5 | public delegate void SAction(); 6 | public delegate bool SCondition(); 7 | 8 | public enum TaskType 9 | { 10 | Simple, 11 | Looped, 12 | OnCondition, 13 | Until 14 | } 15 | 16 | public static class STasks 17 | { 18 | public const int UPDATE_INITIAL_CAPACITY = 64; 19 | public const int LATEUPDATE_INITIAL_CAPACITY = 0; 20 | public const int FIXEDUPDATE_INITIAL_CAPACITY = 0; 21 | 22 | private static STasksCollection _updateTasks; 23 | private static STasksCollection _lateUpdateTasks; 24 | private static STasksCollection _fixedUpdateTasks; 25 | 26 | private static bool _isPaused = false; 27 | 28 | private static bool _isInitialized; 29 | 30 | static STasks() 31 | { 32 | if (!_isInitialized) 33 | Initialize(); 34 | } 35 | 36 | [RuntimeInitializeOnLoadMethod] 37 | private static void Initialize() 38 | { 39 | if (_isInitialized) 40 | return; 41 | 42 | _updateTasks = new STasksCollection(UPDATE_INITIAL_CAPACITY); 43 | _lateUpdateTasks = new STasksCollection(LATEUPDATE_INITIAL_CAPACITY); 44 | _fixedUpdateTasks = new STasksCollection(FIXEDUPDATE_INITIAL_CAPACITY); 45 | 46 | UpdateHelper.AddSubscriber(OnUpdate, UpdateType.Update); 47 | UpdateHelper.AddSubscriber(OnLateUpdate, UpdateType.LateUpdate); 48 | UpdateHelper.AddSubscriber(OnFixedUpdate, UpdateType.FixedUpdate); 49 | 50 | _isInitialized = true; 51 | } 52 | 53 | private static void OnUpdate(float deltaTime) 54 | { 55 | if (_isPaused) { return; } 56 | 57 | STask.deltaTime = deltaTime; 58 | _updateTasks.Update(); 59 | } 60 | 61 | private static void OnLateUpdate(float deltaTime) 62 | { 63 | if (_isPaused) { return; } 64 | 65 | STask.deltaTime = deltaTime; 66 | _lateUpdateTasks.Update(); 67 | } 68 | 69 | private static void OnFixedUpdate(float fixedDeltaTime) 70 | { 71 | if (_isPaused) { return; } 72 | 73 | STask.fixedDeltaTime = fixedDeltaTime; 74 | _fixedUpdateTasks.Update(); 75 | } 76 | 77 | internal static void AddTask(STask task) 78 | { 79 | AddTask(task, task.UpdateType); 80 | } 81 | 82 | /// 83 | /// Pauses all the tasks 84 | /// 85 | public static void PauseAll() 86 | { 87 | _isPaused = true; 88 | } 89 | 90 | /// 91 | /// Unpauses all the tasks 92 | /// 93 | public static void ResumeAll() 94 | { 95 | _isPaused = false; 96 | } 97 | 98 | /// 99 | /// Schedules a task so it's executed after some time 100 | /// 101 | /// The action to be executed 102 | /// The time (in seconds) to wait before executing the task 103 | /// Optional: The update method this task should use (Update/LateUpdate/FixedUpdate) 104 | /// The STask. You can save this task to stop it before it's finished and to subscribe to events such us OnComplete 105 | public static DoTask Do(SAction action, float after, UpdateType updateType = UpdateType.Update) 106 | { 107 | STaskSettings settings = new STaskSettings() 108 | { 109 | action = action, 110 | delay = after, 111 | updateType = updateType 112 | }; 113 | 114 | DoTask task = new DoTask(settings); 115 | AddTask(task, updateType); 116 | return task; 117 | } 118 | 119 | /// 120 | /// Performs a task every few seconds until manually stopped 121 | /// 122 | /// The action to be executed 123 | /// The time (in seconds) to wait between executions 124 | /// Optional: The time (in seconds) to wait before starting the task 125 | /// Optional: The update method this task should use (Update/LateUpdate/FixedUpdate) 126 | /// The STask. You can save this task to stop it before it's finished and to subscribe to events such us OnComplete 127 | public static DoRepeatingTask DoRepeating(SAction action, float every, float startAfter = 0, float maxDuration = -1, UpdateType updateType = UpdateType.Update) 128 | { 129 | STaskSettings settings = new STaskSettings() 130 | { 131 | action = action, 132 | frequency = every, 133 | delay = startAfter, 134 | maxDuration = maxDuration, 135 | updateType = updateType 136 | }; 137 | 138 | DoRepeatingTask task = new DoRepeatingTask(settings); 139 | AddTask(task, updateType); 140 | return task; 141 | } 142 | 143 | /// 144 | /// Performs a given action a fixed number of times (unless a max duration is set) 145 | /// 146 | /// The action to be executed 147 | /// The number of times to execute this task 148 | /// Optional: The time (in seconds) to wait between executions 149 | /// Optional: The time (in seconds) to wait before starting the task 150 | /// Optional: A maximum duration (in seconds) for this task. If set, the task will stop even if the condition isn't met. Note that the action won't be executed. 151 | /// Optional: The update method this task should use (Update/LateUpdate/FixedUpdate) 152 | /// The STask. You can save this task to stop it before it's finished and to subscribe to events such us OnComplete 153 | public static DoUntilTask DoTimes(SAction action, int times, float every = 0, float startAfter = 0, float maxDuration = 0, UpdateType updateType = UpdateType.Update) 154 | { 155 | int elapsedLoops = 0; 156 | SCondition condition = () => elapsedLoops >= times; 157 | action += () => elapsedLoops++; 158 | 159 | return DoUntil(action, condition, every, startAfter, maxDuration, updateType); 160 | } 161 | 162 | /// 163 | /// Performs a task until a condition is met 164 | /// 165 | /// The action to be executed 166 | /// The condition for this task to stop 167 | /// Optional: The time (in seconds) to wait between executions 168 | /// Optional: The time (in seconds) to wait before starting the task 169 | /// Optional: The update method this task should use (Update/LateUpdate/FixedUpdate) 170 | /// Optional: A maximum duration (in seconds) for this task. If set, the task will stop even if the condition isn't met. Note that the action won't be executed. 171 | /// The STask. You can save this task to stop it before it's finished and to subscribe to events such us OnComplete 172 | public static DoUntilTask DoUntil(SAction action, SCondition condition, float every = 0, float startAfter = 0, float maxDuration = -1, UpdateType updateType = UpdateType.Update) 173 | { 174 | STaskSettings settings = new STaskSettings() 175 | { 176 | action = action, 177 | condition = condition, 178 | frequency = every, 179 | delay = startAfter, 180 | maxDuration = maxDuration, 181 | updateType = updateType 182 | }; 183 | 184 | DoUntilTask task = new DoUntilTask(settings); 185 | AddTask(task, updateType); 186 | return task; 187 | } 188 | 189 | /// 190 | /// Performs a task when a condition is met 191 | /// 192 | /// The action to be executed 193 | /// The condition for this task to stop 194 | /// Optional: The time (in seconds) to wait before starting the task 195 | /// Optional: The update method this task should use (Update/LateUpdate/FixedUpdate) 196 | /// The STask. You can save this task to stop it before it's finished and to subscribe to events such us OnComplete 197 | public static DoWhenTask DoWhen(SAction action, SCondition condition, float startAfter = 0, UpdateType updateType = UpdateType.Update) 198 | { 199 | STaskSettings settings = new STaskSettings() 200 | { 201 | action = action, 202 | condition = condition, 203 | delay = startAfter, 204 | updateType = updateType 205 | }; 206 | 207 | DoWhenTask task = new DoWhenTask(settings); 208 | AddTask(task, updateType); 209 | return task; 210 | } 211 | 212 | /// 213 | /// Performs a task after a given number of frames has passed 214 | /// 215 | /// The action to be executed 216 | /// The number of frames to wait 217 | /// Optional: The time (in seconds) to wait before starting to count the frames 218 | /// Optional: The update method this task should use (Update/LateUpdate/FixedUpdate) 219 | /// The STask. You can save this task to stop it before it's finished and to subscribe to events such us OnComplete 220 | public static DoAfterFramesTask DoAfterFrames(SAction action, int frames, float startAfter = 0, UpdateType updateType = UpdateType.Update) 221 | { 222 | STaskSettings settings = new STaskSettings() 223 | { 224 | action = action, 225 | targetFrames = frames, 226 | delay = startAfter, 227 | updateType = updateType 228 | }; 229 | 230 | DoAfterFramesTask task = new DoAfterFramesTask(settings); 231 | AddTask(task, updateType); 232 | return task; 233 | } 234 | 235 | private static void AddTask(STask task, UpdateType updateType) 236 | { 237 | if (updateType == UpdateType.Update) 238 | { 239 | _updateTasks.AddTask(task); 240 | } 241 | else if (updateType == UpdateType.LateUpdate) 242 | { 243 | _lateUpdateTasks.AddTask(task); 244 | } 245 | else 246 | { 247 | _fixedUpdateTasks.AddTask(task); 248 | } 249 | } 250 | } 251 | } -------------------------------------------------------------------------------- /Assets/STasks/Scripts/STasks.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cef3d8db74483ae458268bfacc28351f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/STasks/Scripts/STasksCollection.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Koffie.SimpleTasks 4 | { 5 | public class STasksCollection 6 | { 7 | private List tasks; 8 | 9 | public STasksCollection(int initialSize) 10 | { 11 | tasks = new List(initialSize); 12 | } 13 | 14 | public void Update() 15 | { 16 | STask task; 17 | for (int i = 0; i < tasks.Count; i++) 18 | { 19 | task = tasks[i]; 20 | while (task.isDone && i < tasks.Count) 21 | { 22 | task = tasks[i] = tasks[tasks.Count - 1]; 23 | tasks.RemoveAt(tasks.Count - 1); 24 | } 25 | 26 | if (!task.isDone) 27 | { 28 | task.Update(); 29 | } 30 | } 31 | } 32 | 33 | public void AddTask(STask task) 34 | { 35 | tasks.Add(task); 36 | } 37 | 38 | public void RemoveTask(STask task) 39 | { 40 | int index = tasks.IndexOf(task); 41 | 42 | if (index >= 0) 43 | { 44 | tasks[index] = tasks[tasks.Count - 1]; 45 | tasks.RemoveAt(tasks.Count - 1); 46 | } 47 | } 48 | } 49 | 50 | } -------------------------------------------------------------------------------- /Assets/STasks/Scripts/STasksCollection.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 44d181dfd44677e45a8b5f398d4cdf7b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/STasks/Scripts/Task Variants.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c08a45cb570ef6047a685a816a5fd4cc 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/STasks/Scripts/Task Variants/DoAfterFramesTask.cs: -------------------------------------------------------------------------------- 1 | namespace Koffie.SimpleTasks 2 | { 3 | public class DoAfterFramesTask : STask 4 | { 5 | public int ElapsedFrames => _elapsedFrames; 6 | 7 | private int _targetFrames; 8 | private int _elapsedFrames; 9 | 10 | public DoAfterFramesTask(in STaskSettings settings) : base(settings) 11 | { 12 | _targetFrames = settings.targetFrames; 13 | } 14 | 15 | public override void Restart() 16 | { 17 | base.Restart(); 18 | _elapsedFrames = 0; 19 | } 20 | 21 | protected override float GetProgress() 22 | { 23 | return (float)_elapsedFrames / _targetFrames; 24 | } 25 | 26 | protected override void OnUpdate() 27 | { 28 | _elapsedFrames++; 29 | 30 | if (_elapsedFrames >= _targetFrames) 31 | { 32 | Complete(); 33 | } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Assets/STasks/Scripts/Task Variants/DoAfterFramesTask.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 344deb7026991004bb3c4b4ea5dec1bc 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/STasks/Scripts/Task Variants/DoRepeatingTask.cs: -------------------------------------------------------------------------------- 1 | namespace Koffie.SimpleTasks 2 | { 3 | public class DoRepeatingTask : STask 4 | { 5 | public float frequency; 6 | 7 | private float _timeSinceLastLoop; 8 | 9 | public DoRepeatingTask(in STaskSettings settings) : base(settings) 10 | { 11 | this.frequency = settings.frequency; 12 | _timeSinceLastLoop = 0; 13 | } 14 | 15 | public override void Restart() 16 | { 17 | base.Restart(); 18 | _timeSinceLastLoop = 0; 19 | } 20 | 21 | protected override void OnTimeout() 22 | { 23 | onTimeout?.Invoke(); 24 | Complete(); 25 | } 26 | 27 | public override void Complete() 28 | { 29 | onComplete?.Invoke(); 30 | isDone = true; 31 | } 32 | 33 | protected override float GetProgress() 34 | { 35 | return _timeSinceLastLoop / frequency; 36 | } 37 | 38 | protected override void OnUpdate() 39 | { 40 | _timeSinceLastLoop += deltaTime; 41 | 42 | if (_timeSinceLastLoop > frequency) 43 | { 44 | action.Invoke(); 45 | _timeSinceLastLoop -= frequency; 46 | } 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Assets/STasks/Scripts/Task Variants/DoRepeatingTask.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0ee9e004a0b0bc744a0fcb0a4c241b4e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/STasks/Scripts/Task Variants/DoTask.cs: -------------------------------------------------------------------------------- 1 | namespace Koffie.SimpleTasks 2 | { 3 | public class DoTask : STask 4 | { 5 | public DoTask(in STaskSettings settings) : base(settings) { } 6 | 7 | protected override float GetProgress() 8 | { 9 | return ElapsedTime / Delay; 10 | } 11 | 12 | protected override void OnUpdate() 13 | { 14 | if (ElapsedTime > Delay) 15 | { 16 | Complete(); 17 | } 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /Assets/STasks/Scripts/Task Variants/DoTask.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bbeccb67215e1984a9d759287e98a5a2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/STasks/Scripts/Task Variants/DoUntilTask.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace Koffie.SimpleTasks 4 | { 5 | public class DoUntilTask : DoRepeatingTask 6 | { 7 | private readonly SCondition _condition; 8 | 9 | public DoUntilTask(in STaskSettings settings) : base(settings) 10 | { 11 | _condition = settings.condition; 12 | } 13 | 14 | protected override void OnTimeout() 15 | { 16 | onTimeout?.Invoke(); 17 | isDone = true; 18 | } 19 | 20 | protected override float GetProgress() 21 | { 22 | Debug.LogWarning($"{nameof(DoUntilTask)} can't keep track of the progress, you'll need to write your own implementation for this. Returning -1."); 23 | return -1; 24 | } 25 | 26 | protected override void OnUpdate() 27 | { 28 | base.OnUpdate(); 29 | 30 | if (_condition()) 31 | { 32 | Complete(); 33 | } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Assets/STasks/Scripts/Task Variants/DoUntilTask.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dc042fc6103a85e47bb4c1174f97ae88 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/STasks/Scripts/Task Variants/DoWhenTask.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace Koffie.SimpleTasks 4 | { 5 | public class DoWhenTask : STask 6 | { 7 | public SCondition condition; 8 | 9 | public DoWhenTask(in STaskSettings settings) : base(settings) 10 | { 11 | this.condition = settings.condition; 12 | } 13 | 14 | protected override float GetProgress() 15 | { 16 | Debug.LogWarning("DoWhen can't keep track of the progress, you'll need to write your own implementation for this. Returning -1."); 17 | return -1; 18 | } 19 | 20 | protected override void OnUpdate() 21 | { 22 | if (condition()) 23 | { 24 | Complete(); 25 | } 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /Assets/STasks/Scripts/Task Variants/DoWhenTask.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 83a017c141e894a44a218d3327003815 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/STasks/Scripts/UpdateHelper.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace Koffie.SimpleTasks 4 | { 5 | public delegate void UpdateAction(float deltaTime); 6 | 7 | public enum UpdateType 8 | { 9 | Update = 0, 10 | LateUpdate, 11 | FixedUpdate 12 | } 13 | 14 | public class UpdateHelper : MonoBehaviour 15 | { 16 | 17 | private static UpdateHelper _instance; 18 | 19 | private static UpdateAction _onUpdate; 20 | private static UpdateAction _onLateUpdate; 21 | private static UpdateAction _onFixedUpdate; 22 | 23 | public static void AddSubscriber(UpdateAction action, UpdateType updateType) 24 | { 25 | ValidateInstance(); 26 | 27 | switch (updateType) 28 | { 29 | case UpdateType.Update: 30 | _onUpdate += action; 31 | break; 32 | 33 | case UpdateType.LateUpdate: 34 | _onLateUpdate += action; 35 | break; 36 | 37 | case UpdateType.FixedUpdate: 38 | _onFixedUpdate += action; 39 | break; 40 | } 41 | } 42 | 43 | private static void ValidateInstance() 44 | { 45 | if (_instance == null) 46 | { 47 | _instance = new GameObject("Update Helper").AddComponent(); 48 | DontDestroyOnLoad(_instance); 49 | } 50 | } 51 | 52 | private void Update() 53 | { 54 | _onUpdate?.Invoke(Time.deltaTime); 55 | } 56 | 57 | private void LateUpdate() 58 | { 59 | _onLateUpdate?.Invoke(Time.deltaTime); 60 | } 61 | 62 | private void FixedUpdate() 63 | { 64 | _onFixedUpdate?.Invoke(Time.fixedDeltaTime); 65 | } 66 | } 67 | } -------------------------------------------------------------------------------- /Assets/STasks/Scripts/UpdateHelper.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d6e0ade04fe38a54b8eea0aacc4f0780 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/STasks/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.martinisla.stasks", 3 | "displayName": "STasks", 4 | "version": "2.1.0", 5 | "unity": "2018.4", 6 | "description": "A simple library that aims at replacing most common uses of coroutines. It's easy to use, faster to write and performance-first.", 7 | "documentationUrl": "https://github.com/MartinIsla/STasks/", 8 | "author": { 9 | "name": "Martin Isla", 10 | "email": "mmartin.isla@gmail.com", 11 | "url": "https://github.com/MartinIsla/" 12 | }, 13 | "type": "library" 14 | } -------------------------------------------------------------------------------- /Assets/STasks/package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d6c04198416d8ea4db41d03e0d65e7f1 3 | PackageManifestImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 MartinIsla 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /LICENSE.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c04aa0f6726cc8b4e82aab11e766f98f 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # STasks for Unity 2 | 3 | STasks is a simple library that aims at replacing most common uses of coroutines. It's easy to use, faster to write and performance-first. 4 | 5 | ## Installation 6 | ### Importing as a UnityPackage (recommended) 7 | 8 | Download [the UnityPackage](https://github.com/MartinIsla/STasks/blob/master/STasks.unitypackage) and import it into your project. 9 | 10 | ### Package Manager (not recommended, really) 11 | > I added this option and now I regret it. It makes collaboration hard because all your teammates need to have Git installed, which is pretty unusual for non-programmer teammates. And even for programmers, Git's system PATH can break. 12 | 13 | > Also, by importing STasks as a package, you can't change the code if you want to fix bugs or add new types of tasks, which would be happily received by me :) 14 | Anyway, I strongly suggest you don't use this method. 15 | 16 | First, make sure you have installed Git. If you haven't, you can download it from [the official website](https://www.git-scm.com/download/). 17 | 18 | In Unity, go to `Window -> Package Manager` to open the Package Manager. 19 | Click the little `+` button at the top-left corner, select `Add package from git URL` and paste the following URL 20 | ``` 21 | https://github.com/MartinIsla/STasks.git?path=Assets/STasks/ 22 | ``` 23 | Click the `Add` button and wait. 24 | 25 | ## Usage 26 | 27 | ### Perform a task after some time has passed 28 | This is probably the most common case for coroutines. 29 | 30 | ```c# 31 | private IEnumerator DoSomethingAfterThreeSeconds () 32 | { 33 | yield return new WaitForSeconds(3); 34 | Debug.Log("Do Something"); 35 | } 36 | ``` 37 | 38 | With STasks, you can make this easily using `STasks.Do(action, time)`: 39 | ```c# 40 | STasks.Do(() => Debug.Log("Do Something"), after: 3.0f) 41 | ``` 42 | 43 | > Print "do something" after 3 seconds 44 | 45 | ### Perform a task repeatedly forever 46 | Unity provides a way of invoking a method repeatedly every a given number of seconds. 47 | 48 | ```c# 49 | InvokeRepeating("PrintDoSomething", 1.0f, 3.0f); 50 | ``` 51 | >After one second, start printing "do something" every three seconds. 52 | 53 | Using STasks, you can use `STasks.DoRepeating(action, every, startAfter)`. 54 | 55 | ```c# 56 | STasks.DoRepeating(() => Debug.Log("Do Something"), every: 3.0f, startAfter: 1.0f); 57 | ``` 58 | >After one second, start printing "do something" every three seconds. 59 | 60 | ### Perform a task repeatedly until a condition is met 61 | Using coroutines, you can use loops to perform a task indefinitely after a certain condition is met. 62 | ```c# 63 | private IEnumerator TakeDamageSlowly () 64 | { 65 | int currentLives = 10; 66 | while (currentLives > 0) 67 | { 68 | currentLives--; 69 | yield return new WaitForSeconds(1); 70 | } 71 | } 72 | ``` 73 | > Take a life from the player every second until they're dead 74 | 75 | With STasks, you can do this using `STasks.DoUntil(action, condition, every)` 76 | ```c# 77 | int currentLives = 10; 78 | STasks.DoUntil(action: () => currentLives--, condition: () => currentLives == 0, every: 1.0f); 79 | ``` 80 | Please note the `every` parameter is optional. It has a value of 0 by default, meaning the action will be executed every frame. 81 | 82 | ### Perform a task when a condition is met 83 | Coroutines can also be used to wait until a certain condition is met before executing a task. 84 | 85 | ```c# 86 | private IEnumerator PlayCutscene () 87 | { 88 | input.enabled = false; 89 | cutscene.Play(); 90 | 91 | while (cutscene.IsPlaying) 92 | { 93 | yield return null; 94 | } 95 | 96 | input.enabled = true; 97 | } 98 | ``` 99 | > Start playing a cutscene and disable the input until the cutscene has ended. 100 | 101 | To do this with STasks, you can use `STasks.DoWhen(action, condition)` 102 | 103 | ```c# 104 | private void PlayCutscene () 105 | { 106 | input.enabled = false; 107 | cutscene.Play(); 108 | STasks.DoWhen (action: () => input.enabled = true, condition: () => !cutscene.IsPlaying); 109 | } 110 | ``` 111 | 112 | ### Saving an STask 113 | All the methods shown in the previous examples return the STasks they create. You can (and are encouraged to) save these tasks to read values from them or, more importantly, perform additional actions. 114 | 115 | The most common usage for this is manually killing the task. There are cases where a single task needs to be called multiple times. If these tasks overlap, they'll affect the same values at the same time, causing extremely unexpected behaviour. 116 | 117 | Let's take our previous example where we took a life from the player once per second: 118 | ```c# 119 | private int currentLives = 10; 120 | private void StartTakingLivesFromPlayer () 121 | { 122 | STasks.DoUntil(action: () => currentLives--, condition: () => currentLives == 0, every: 1.0f); 123 | } 124 | ``` 125 | If `StartTakingLivesFromPlayer()` is called again before the task is complete, we'll have two different tasks taking lives from the player at the same time. The player will be sad, confused and frustrated. To avoid this, let's save the task. 126 | 127 | ```c# 128 | private STask takeLivesFromPlayerTask; 129 | private int currentLives = 10; 130 | 131 | private void StartTakingLivesFromPlayer () 132 | { 133 | // If there's already taking lives from the player, stop it. 134 | takeLivesFromPlayerTask?.Kill(); 135 | 136 | // Save the new task 137 | takeLivesFromPlayerTask = STasks.DoUntil(action: () => currentLives--, condition: () => currentLives == 0, every: 1.0f); 138 | } 139 | 140 | ``` 141 | Alternatively, we could stop a new task from being created if we already have one by checking if `takeLivesFromPlayerTask` is not null. 142 | 143 | 144 | ### STask callbacks 145 | 146 | STask provides callbacks to help you execute additional actions when a task is complete or when it's been updated. It's also fluent, meaning you can easily append callbacks one after the other in a single instruction. 147 | 148 | #### OnComplete 149 | It's often useful to know when a task has finished. In a previous example, we took a life from our player every second until they're dead. It would be nice if we showed a "Game Over" screen when that happens. 150 | ```c# 151 | int currentLives = 10; 152 | STasks.DoUntil(action: () => currentLives--, condition: () => currentLives == 0, every: 1.0f) 153 | .OnComplete(() => gameOverScreen.Show()); 154 | ``` 155 | 156 | #### OnUpdate 157 | We might want to do something else every time the task is updated. 158 | Let's add a cooldown to one of our player's abilities and update a UI image's fill amount until it's usable again. 159 | 160 | ```c# 161 | public Image cooldownImage; 162 | 163 | private float abilityCooldown = 3.0f; 164 | private bool isUsable = true; 165 | 166 | private void ExecuteAbility () 167 | { 168 | // Execute our ability 169 | Debug.Log("Printing to the console is not a real ability, but makes for a good example."); 170 | 171 | // Disable the ability and start the cooldown 172 | isUsable = false; 173 | STask cooldownTask = STasks.Do(() => isUsable = true, after: abilityCooldown); 174 | 175 | // Update the fill amount of our image using the Progress property of our task 176 | cooldownTask.OnUpdate(() => cooldownImage.fillAmount = cooldownTask.Progress); 177 | } 178 | ``` 179 | 180 | 181 | ## Contributing 182 | Whether it's new task variants, performance or quality of life improvements, better examples or whatever you think would improve STasks is welcome. Pull requests are encouraged and begged for. 183 | 184 | ## License 185 | This project uses the MIT license. TLDR: feel free to use, copy, modify and redistribute STasks. Creditting me would be really, really nice but not a requirement. If you use STasks for bad things it's your fault, not mine. Sending me a key to your game is greatly appreciated but the license says nothing about that. 186 | 187 | [Full details here](https://github.com/MartinIsla/stasks/blob/master/LICENSE). 188 | -------------------------------------------------------------------------------- /README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f39896888219e8942a254d75bc9f0067 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /STasks.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MartinIsla/STasks/7f6c7f47436ee04d5a14582426140041f75fa598/STasks.unitypackage --------------------------------------------------------------------------------