diff --git a/unity/Assets/Prefabs/Bird.prefab b/unity/Assets/Prefabs/Bird.prefab index 074e4e7..62bd10b 100644 --- a/unity/Assets/Prefabs/Bird.prefab +++ b/unity/Assets/Prefabs/Bird.prefab @@ -96,8 +96,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: fd8ad88e69cd45a4ebfb8515d31be3d1, type: 3} m_Name: m_EditorClassIdentifier: - _blueBird: {fileID: 21300000, guid: 96ac1047b12197a429d1c6396c1a4675, type: 3} - _yellowBird: {fileID: 21300000, guid: b618c1b99c40e3a4c87d042969b1dcc0, type: 3} + _boostBird: {fileID: 21300000, guid: f38f5ee8b3c44574986f6897bd30c60b, type: 3} + _fireBird: {fileID: 21300000, guid: 088595d78fed12e4f9eab45ee4e74f5b, type: 3} --- !u!58 &8800180563921210496 CircleCollider2D: m_ObjectHideFlags: 0 diff --git a/unity/Assets/Scripts/Bird.cs b/unity/Assets/Scripts/Bird.cs index e2a5d79..c4c1a00 100644 --- a/unity/Assets/Scripts/Bird.cs +++ b/unity/Assets/Scripts/Bird.cs @@ -4,14 +4,15 @@ using UnityEngine; public class Bird : MonoBehaviour { + const int CHANCE_FOR_BOOST = 30; //out of 100 const float horizontalSpeed = 100f; const float verticalSpeed = 5f; const float amplitude = 30f; private float startTime; float _startingY; - [SerializeField] Sprite _blueBird; - [SerializeField] Sprite _yellowBird; + [SerializeField] Sprite _boostBird; + [SerializeField] Sprite _fireBird; DragonMovement.AttackType _attackType; public DragonMovement.AttackType AttackType { get => _attackType; set => _attackType = value; } @@ -21,15 +22,18 @@ public class Bird : MonoBehaviour startTime = Time.time; _startingY = transform.position.y; - int type = Random.Range(0, 2); + int r = Random.Range(0, 100); + + int type = r < CHANCE_FOR_BOOST ? 0 : 1; + if (type == 0) { AttackType = DragonMovement.AttackType.CONE; - GetComponent().sprite = _blueBird; + GetComponent().sprite = _boostBird; } else { AttackType = DragonMovement.AttackType.FIREBALL; - GetComponent().sprite = _yellowBird; + GetComponent().sprite = _fireBird; } } diff --git a/unity/Assets/Scripts/DragonMovement.cs b/unity/Assets/Scripts/DragonMovement.cs index a8fc9cc..f1558e5 100644 --- a/unity/Assets/Scripts/DragonMovement.cs +++ b/unity/Assets/Scripts/DragonMovement.cs @@ -37,6 +37,7 @@ public class DragonMovement : MonoBehaviour float _speedBoostTime = 0f; float _timeToUpdateGhosts = 0f; bool _isInDive = false; + bool _superFlap = false; public enum AttackType { @@ -178,8 +179,18 @@ public class DragonMovement : MonoBehaviour _rigidbody = this.GetComponent(); _animator = this.GetComponent(); - //Ammo = 5; - //_attackType = AttackType.CONE; + //StartWithAmmo(); + } + + void StartWithAmmo() + { + Ammo = 5; + _attackType = AttackType.CONE; + + if (_attackType == AttackType.FIREBALL) + ColorizeAmmo(Color.red); + else + ColorizeAmmo(Color.green); } private void Update() @@ -207,6 +218,11 @@ public class DragonMovement : MonoBehaviour void Flap() { + if (Ammo > 0 && _attackType == AttackType.CONE) + _superFlap = true; + else + _superFlap = false; + _flapTime = FlapLength; _animator.Play("fly"); transform.eulerAngles = new Vector3(-45f, transform.eulerAngles.y, transform.eulerAngles.z); @@ -230,7 +246,7 @@ public class DragonMovement : MonoBehaviour if (Ammo <= 0) return; - _speedBoostTime = .25f; + Ammo--; @@ -240,12 +256,16 @@ public class DragonMovement : MonoBehaviour } else if (_attackType == AttackType.CONE) { + /* GameObject fireball = GameObject.Instantiate(_fireballPrefab, _coneSpawnPoint.transform.position, Quaternion.identity); fireball.name = CONE_NAME; fireball.GetComponent().AttackType = AttackType.CONE; fireball.transform.parent = this.transform; Rigidbody2D rigidBody = fireball.AddComponent(); rigidBody.isKinematic = true; + */ + + _speedBoostTime = .3f; } } @@ -253,7 +273,11 @@ public class DragonMovement : MonoBehaviour { if (_flapTime > 0f && _stunTime < 0f) { - _rigidbody.AddForce(new Vector2(0f, FlapForce)); + float force = FlapForce; + + if (_superFlap) + force *= 2f; + _rigidbody.AddForce(new Vector2(0f, force)); } if (_stunTime > 0f) { diff --git a/unity/Assets/Sprites/birds/bird_blue_1.png.meta b/unity/Assets/Sprites/birds/bird_blue_1.png.meta index ee8e879..95700b9 100644 --- a/unity/Assets/Sprites/birds/bird_blue_1.png.meta +++ b/unity/Assets/Sprites/birds/bird_blue_1.png.meta @@ -32,7 +32,7 @@ TextureImporter: maxTextureSize: 2048 textureSettings: serializedVersion: 2 - filterMode: 1 + filterMode: 0 aniso: 1 mipBias: 0 wrapU: 1 diff --git a/unity/Assets/Sprites/birds/bird_green_1.png b/unity/Assets/Sprites/birds/bird_green_1.png new file mode 100644 index 0000000..b3c20d7 Binary files /dev/null and b/unity/Assets/Sprites/birds/bird_green_1.png differ diff --git a/unity/Assets/Sprites/birds/bird_green_1.png.meta b/unity/Assets/Sprites/birds/bird_green_1.png.meta new file mode 100644 index 0000000..285e728 --- /dev/null +++ b/unity/Assets/Sprites/birds/bird_green_1.png.meta @@ -0,0 +1,109 @@ +fileFormatVersion: 2 +guid: f38f5ee8b3c44574986f6897bd30c60b +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 12 + 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: 3 + 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 + cookieLightType: 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: diff --git a/unity/Assets/Sprites/birds/bird_red_1.png b/unity/Assets/Sprites/birds/bird_red_1.png new file mode 100644 index 0000000..2705149 Binary files /dev/null and b/unity/Assets/Sprites/birds/bird_red_1.png differ diff --git a/unity/Assets/Sprites/birds/bird_red_1.png.meta b/unity/Assets/Sprites/birds/bird_red_1.png.meta new file mode 100644 index 0000000..2a4330b --- /dev/null +++ b/unity/Assets/Sprites/birds/bird_red_1.png.meta @@ -0,0 +1,109 @@ +fileFormatVersion: 2 +guid: 088595d78fed12e4f9eab45ee4e74f5b +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 12 + 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: 3 + 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 + cookieLightType: 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: diff --git a/unity/Assets/Sprites/birds/bird_yellow_1.png.meta b/unity/Assets/Sprites/birds/bird_yellow_1.png.meta index 57c9c6c..57215b6 100644 --- a/unity/Assets/Sprites/birds/bird_yellow_1.png.meta +++ b/unity/Assets/Sprites/birds/bird_yellow_1.png.meta @@ -32,7 +32,7 @@ TextureImporter: maxTextureSize: 2048 textureSettings: serializedVersion: 2 - filterMode: 1 + filterMode: 0 aniso: 1 mipBias: 0 wrapU: 1