diff --git a/unity/Assets/Restart.cs b/unity/Assets/Restart.cs new file mode 100644 index 0000000..c6f4d92 --- /dev/null +++ b/unity/Assets/Restart.cs @@ -0,0 +1,22 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.SceneManagement; + +public class Restart : MonoBehaviour +{ + // Start is called before the first frame update + void Start() + { + + } + + // Update is called once per frame + void Update() + { + if (Input.GetKeyDown(KeyCode.R)) + { + SceneManager.LoadScene(SceneManager.GetActiveScene().name); + } + } +} diff --git a/unity/Assets/Restart.cs.meta b/unity/Assets/Restart.cs.meta new file mode 100644 index 0000000..53f2ed6 --- /dev/null +++ b/unity/Assets/Restart.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bd0942714573af045aa267da5977c91f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/unity/Assets/Scenes/SampleScene.unity b/unity/Assets/Scenes/SampleScene.unity index 2b7683c..4f24daf 100644 --- a/unity/Assets/Scenes/SampleScene.unity +++ b/unity/Assets/Scenes/SampleScene.unity @@ -322,7 +322,7 @@ SpriteRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 1 - m_Sprite: {fileID: 6278745784159507077, guid: a0e17cad4342ba34eb84f9fd99fad50a, type: 3} + m_Sprite: {fileID: 4601113484269595429, guid: a0e17cad4342ba34eb84f9fd99fad50a, type: 3} m_Color: {r: 1, g: 1, b: 1, a: 1} m_FlipX: 0 m_FlipY: 0 @@ -345,6 +345,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 1850103815} + - {fileID: 1001794175} m_Father: {fileID: 0} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -406,6 +407,7 @@ MonoBehaviour: _fireballPrefab: {fileID: 3013654646655086450, guid: a0ff208e909d8cd469c02ed1f8eda034, type: 3} _fireballSpawnPoint: {fileID: 1850103814} _coneSpawnPoint: {fileID: 0} + _flash: {fileID: 1001794173} _attackType: 0 --- !u!114 &480143059 MonoBehaviour: @@ -746,6 +748,7 @@ MonoBehaviour: _fireballPrefab: {fileID: 3013654646655086450, guid: cd9f6311325042848a69aead7b010b4e, type: 3} _fireballSpawnPoint: {fileID: 702048807} _coneSpawnPoint: {fileID: 1094877703} + _flash: {fileID: 1754293195} _attackType: 1 --- !u!95 &629347648 Animator: @@ -830,6 +833,7 @@ Transform: m_Children: - {fileID: 702048808} - {fileID: 1094877704} + - {fileID: 1754293197} m_Father: {fileID: 0} m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -1073,6 +1077,88 @@ BoxCollider2D: serializedVersion: 2 m_Size: {x: 111.25, y: 28.93} m_EdgeRadius: 0 +--- !u!1 &1001794173 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1001794175} + - component: {fileID: 1001794174} + m_Layer: 0 + m_Name: Flash + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!212 &1001794174 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1001794173} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 986ea2d4c47b62e4486f856920e2bac5, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 200, y: 200} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!4 &1001794175 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1001794173} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 4.13, y: -10.88, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 480143055} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1001 &1060111564 PrefabInstance: m_ObjectHideFlags: 0 @@ -1330,6 +1416,7 @@ MonoBehaviour: _fireballPrefab: {fileID: 3013654646655086450, guid: a0ff208e909d8cd469c02ed1f8eda034, type: 3} _fireballSpawnPoint: {fileID: 833231468} _coneSpawnPoint: {fileID: 0} + _flash: {fileID: 2065535042} _attackType: 0 --- !u!95 &1208042750 Animator: @@ -1413,9 +1500,92 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 833231469} + - {fileID: 2065535044} m_Father: {fileID: 0} m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1754293195 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1754293197} + - component: {fileID: 1754293196} + m_Layer: 0 + m_Name: Flash (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!212 &1754293196 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1754293195} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 986ea2d4c47b62e4486f856920e2bac5, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 200, y: 200} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!4 &1754293197 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1754293195} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 4.13, y: -10.88, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 629347650} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1001 &1817051803 PrefabInstance: m_ObjectHideFlags: 0 @@ -1687,6 +1857,7 @@ GameObject: m_Component: - component: {fileID: 2039228493} - component: {fileID: 2039228492} + - component: {fileID: 2039228494} m_Layer: 0 m_Name: bg m_TagString: Untagged @@ -1759,3 +1930,97 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2039228494 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2039228491} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: bd0942714573af045aa267da5977c91f, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &2065535042 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2065535044} + - component: {fileID: 2065535043} + m_Layer: 0 + m_Name: Flash (2) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!212 &2065535043 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2065535042} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 986ea2d4c47b62e4486f856920e2bac5, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 200, y: 200} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!4 &2065535044 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2065535042} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 4.13, y: -10.88, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1208042752} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/unity/Assets/Scripts/DragonMovement.cs b/unity/Assets/Scripts/DragonMovement.cs index 752ec2f..8985e9a 100644 --- a/unity/Assets/Scripts/DragonMovement.cs +++ b/unity/Assets/Scripts/DragonMovement.cs @@ -14,7 +14,9 @@ public class DragonMovement : MonoBehaviour [SerializeField] GameObject _fireballPrefab; [SerializeField] GameObject _fireballSpawnPoint; [SerializeField] GameObject _coneSpawnPoint; + [SerializeField] GameObject _flash; float _stunTime = 0f; + float _debugCurSpeed; public enum AttackType { @@ -28,6 +30,7 @@ public class DragonMovement : MonoBehaviour { Debug.Log("ontriggerenter"); _inCloud = true; + Flash(); if (collision.CompareTag("Fireball")) { @@ -106,10 +109,11 @@ public class DragonMovement : MonoBehaviour _flapTime -= Time.deltaTime; _stunTime -= Time.deltaTime; - float horizontalSpeed = .6f; + const float SPEED = .6f; + float horizontalSpeed = SPEED; float verticalSpeed = 0f; - const float GLIDE_TIME = 0.7f; + const float GLIDE_TIME = 0.6f; if (_flapTime < - GLIDE_TIME) { _animator.Play("speedup"); @@ -138,12 +142,30 @@ public class DragonMovement : MonoBehaviour if (_stunTime > 0f) { - horizontalSpeed = -2f; + horizontalSpeed = -5f; } + const float MAX_SPEED = SPEED * 2.2f; + if (horizontalSpeed > MAX_SPEED) + { + horizontalSpeed = MAX_SPEED; + } + + _debugCurSpeed = horizontalSpeed; float x = transform.position.x + horizontalSpeed; x = Mathf.Max(x, 32); transform.position = new Vector3(x, transform.position.y+ verticalSpeed, transform.position.z); } + + public void Flash() + { + _flash.SetActive(true); + Invoke("Unflash", .2f); + } + + public void Unflash() + { + _flash.SetActive(false); + } } diff --git a/unity/Assets/Sprites/babydragon_sheets/green/speedup.anim b/unity/Assets/Sprites/babydragon_sheets/green/speedup.anim index f41e529..0c83ee7 100644 --- a/unity/Assets/Sprites/babydragon_sheets/green/speedup.anim +++ b/unity/Assets/Sprites/babydragon_sheets/green/speedup.anim @@ -21,8 +21,6 @@ AnimationClip: - curve: - time: 0 value: {fileID: -9138000820624713200, guid: f1f52452aedff1d49a96e61902445920, type: 3} - - time: 1 - value: {fileID: 6278745784159507077, guid: a0e17cad4342ba34eb84f9fd99fad50a, type: 3} attribute: m_Sprite path: classID: 212 @@ -43,13 +41,12 @@ AnimationClip: isPPtrCurve: 1 pptrCurveMapping: - {fileID: -9138000820624713200, guid: f1f52452aedff1d49a96e61902445920, type: 3} - - {fileID: 6278745784159507077, guid: a0e17cad4342ba34eb84f9fd99fad50a, type: 3} m_AnimationClipSettings: serializedVersion: 2 m_AdditiveReferencePoseClip: {fileID: 0} m_AdditiveReferencePoseTime: 0 m_StartTime: 0 - m_StopTime: 1.0166667 + m_StopTime: 0.016666668 m_OrientationOffsetY: 0 m_Level: 0 m_CycleOffset: 0 diff --git a/unity/Assets/Sprites/babydragon_sheets/red/speedup.anim b/unity/Assets/Sprites/babydragon_sheets/red/speedup.anim index 27cbfc3..9e0ec9c 100644 --- a/unity/Assets/Sprites/babydragon_sheets/red/speedup.anim +++ b/unity/Assets/Sprites/babydragon_sheets/red/speedup.anim @@ -21,8 +21,6 @@ AnimationClip: - curve: - time: 0 value: {fileID: 5050621076385859653, guid: ffd02a844a873414d975517da88b67e9, type: 3} - - time: 1 - value: {fileID: 6278745784159507077, guid: a0e17cad4342ba34eb84f9fd99fad50a, type: 3} attribute: m_Sprite path: classID: 212 @@ -43,13 +41,12 @@ AnimationClip: isPPtrCurve: 1 pptrCurveMapping: - {fileID: 5050621076385859653, guid: ffd02a844a873414d975517da88b67e9, type: 3} - - {fileID: 6278745784159507077, guid: a0e17cad4342ba34eb84f9fd99fad50a, type: 3} m_AnimationClipSettings: serializedVersion: 2 m_AdditiveReferencePoseClip: {fileID: 0} m_AdditiveReferencePoseTime: 0 m_StartTime: 0 - m_StopTime: 1.0166667 + m_StopTime: 0.016666668 m_OrientationOffsetY: 0 m_Level: 0 m_CycleOffset: 0 diff --git a/unity/Assets/Sprites/dragon_flash.png b/unity/Assets/Sprites/dragon_flash.png new file mode 100644 index 0000000..2d00227 Binary files /dev/null and b/unity/Assets/Sprites/dragon_flash.png differ diff --git a/unity/Assets/Sprites/dragon_flash.png.meta b/unity/Assets/Sprites/dragon_flash.png.meta new file mode 100644 index 0000000..7a904e6 --- /dev/null +++ b/unity/Assets/Sprites/dragon_flash.png.meta @@ -0,0 +1,108 @@ +fileFormatVersion: 2 +guid: 986ea2d4c47b62e4486f856920e2bac5 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 0 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 0.5 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: