Browse Source

ammo gui

master
Josh 2 years ago
parent
commit
fa834cdac2
  1. 91
      unity/Assets/Prefabs/Cloud.prefab
  2. 5620
      unity/Assets/Scenes/SampleScene.unity
  3. 33
      unity/Assets/Scripts/DragonMovement.cs
  4. BIN
      unity/Assets/Sprites/ammo.png
  5. 109
      unity/Assets/Sprites/ammo.png.meta
  6. BIN
      unity/Assets/Sprites/rain.png
  7. 109
      unity/Assets/Sprites/rain.png.meta
  8. 2
      unity/ProjectSettings/Physics2DSettings.asset

91
unity/Assets/Prefabs/Cloud.prefab

@ -25,8 +25,8 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1043090684} m_GameObject: {fileID: 1043090684}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: -65.62, z: 0.86} m_LocalPosition: {x: -2.2083, y: -47.8, z: 0.86}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 0.65114, y: 0.65114, z: 0.65114}
m_Children: m_Children:
- {fileID: 1880512418} - {fileID: 1880512418}
m_Father: {fileID: 8093627333698608787} m_Father: {fileID: 8093627333698608787}
@ -140,6 +140,88 @@ SpriteRenderer:
m_WasSpriteAssigned: 1 m_WasSpriteAssigned: 1
m_MaskInteraction: 0 m_MaskInteraction: 0
m_SpriteSortPoint: 0 m_SpriteSortPoint: 0
--- !u!1 &4636940789921123840
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 545282094367413959}
- component: {fileID: 6161226756571430359}
m_Layer: 0
m_Name: hitbox
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &545282094367413959
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4636940789921123840}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: -52.5, z: 0}
m_LocalScale: {x: 1059.2882, y: 638.48303, z: 638.48303}
m_Children: []
m_Father: {fileID: 8093627333698608787}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &6161226756571430359
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4636940789921123840}
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: c47df59d6ad6b79419bb28a6b140fc43, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 0.21176471}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 4, y: 2}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!1 &8093627333698608799 --- !u!1 &8093627333698608799
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -172,6 +254,7 @@ Transform:
m_LocalScale: {x: 1.5063, y: 1.5063, z: 1.5063} m_LocalScale: {x: 1.5063, y: 1.5063, z: 1.5063}
m_Children: m_Children:
- {fileID: 1043090685} - {fileID: 1043090685}
- {fileID: 545282094367413959}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -255,7 +338,7 @@ BoxCollider2D:
m_IsTrigger: 1 m_IsTrigger: 1
m_UsedByEffector: 0 m_UsedByEffector: 0
m_UsedByComposite: 0 m_UsedByComposite: 0
m_Offset: {x: 0, y: -71.1} m_Offset: {x: 0, y: -57.31}
m_SpriteTilingProperty: m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0} border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0.5, y: 0.5} pivot: {x: 0.5, y: 0.5}
@ -266,7 +349,7 @@ BoxCollider2D:
adaptiveTiling: 0 adaptiveTiling: 0
m_AutoTiling: 0 m_AutoTiling: 0
serializedVersion: 2 serializedVersion: 2
m_Size: {x: 134.6, y: 81.7} m_Size: {x: 134.6, y: 64.7}
m_EdgeRadius: 0 m_EdgeRadius: 0
--- !u!114 &950892130 --- !u!114 &950892130
MonoBehaviour: MonoBehaviour:

5620
unity/Assets/Scenes/SampleScene.unity

File diff suppressed because it is too large

33
unity/Assets/Scripts/DragonMovement.cs

@ -19,6 +19,10 @@ public class DragonMovement : MonoBehaviour
[SerializeField] Color _color; [SerializeField] Color _color;
[SerializeField] TrailRenderer _trail; [SerializeField] TrailRenderer _trail;
[SerializeField] List<SpriteRenderer> _ammoGui = new List<SpriteRenderer>(); [SerializeField] List<SpriteRenderer> _ammoGui = new List<SpriteRenderer>();
[SerializeField] List<SpriteRenderer> _ammoGui2 = new List<SpriteRenderer>();
[SerializeField] GameObject _ammoNormal;
[SerializeField] GameObject _ammoGlide;
float _stunTime = 0f; float _stunTime = 0f;
float _debugCurSpeed; float _debugCurSpeed;
@ -46,10 +50,12 @@ public class DragonMovement : MonoBehaviour
if (i < _ammo) if (i < _ammo)
{ {
_ammoGui[i].enabled = true; _ammoGui[i].enabled = true;
_ammoGui2[i].enabled = true;
} }
else else
{ {
_ammoGui[i].enabled = false; _ammoGui[i].enabled = false;
_ammoGui2[i].enabled = false;
} }
} }
@ -71,9 +77,15 @@ public class DragonMovement : MonoBehaviour
{ {
Bird bird = collision.GetComponent<Bird>(); Bird bird = collision.GetComponent<Bird>();
bird.Eat(); bird.Eat();
Ammo = 3; Ammo = 5;
_speedBoostTime = 1f; _speedBoostTime = 1f;
_attackType = bird.AttackType; _attackType = bird.AttackType;
if (_attackType == AttackType.FIREBALL)
ColorizeAmmo(Color.red);
else
ColorizeAmmo(Color.green);
} }
if (collision.CompareTag("FinishLine")) if (collision.CompareTag("FinishLine"))
@ -102,6 +114,15 @@ public class DragonMovement : MonoBehaviour
} }
} }
void ColorizeAmmo(Color color)
{
for (int i = 0; i < _ammoGui.Count; ++i)
{
_ammoGui[i].color = color;
_ammoGui2[i].color = color;
}
}
private void OnTriggerStay2D(Collider2D collision) private void OnTriggerStay2D(Collider2D collision)
{ {
CheckCloudCollision(collision); CheckCloudCollision(collision);
@ -120,6 +141,7 @@ public class DragonMovement : MonoBehaviour
{ {
_stunTime = length; _stunTime = length;
_animator.Play("fall"); _animator.Play("fall");
ShowNormalAmmo();
} }
private void OnTriggerExit2D(Collider2D collision) private void OnTriggerExit2D(Collider2D collision)
@ -156,6 +178,13 @@ public class DragonMovement : MonoBehaviour
{ {
_flapTime = FlapLength; _flapTime = FlapLength;
_animator.Play("fly"); _animator.Play("fly");
ShowNormalAmmo();
}
void ShowNormalAmmo()
{
_ammoNormal.SetActive(true);
_ammoGlide.SetActive(false);
} }
void Shoot() void Shoot()
@ -219,6 +248,8 @@ public class DragonMovement : MonoBehaviour
_trail.Clear(); _trail.Clear();
_trail.enabled = true; _trail.enabled = true;
} }
_ammoNormal.SetActive(false);
_ammoGlide.SetActive(true);
_animator.Play("speedup"); _animator.Play("speedup");
horizontalSpeed += (_flapTime + GLIDE_TIME) * -2f; horizontalSpeed += (_flapTime + GLIDE_TIME) * -2f;
} }

BIN
unity/Assets/Sprites/ammo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 B

109
unity/Assets/Sprites/ammo.png.meta

@ -0,0 +1,109 @@
fileFormatVersion: 2
guid: 117d15c42cd673e4a9ddd5e2b7b71980
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: 0.2
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:

BIN
unity/Assets/Sprites/rain.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

109
unity/Assets/Sprites/rain.png.meta

@ -0,0 +1,109 @@
fileFormatVersion: 2
guid: c47df59d6ad6b79419bb28a6b140fc43
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: 1
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: 2222
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:

2
unity/ProjectSettings/Physics2DSettings.asset

@ -4,7 +4,7 @@
Physics2DSettings: Physics2DSettings:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
serializedVersion: 5 serializedVersion: 5
m_Gravity: {x: 0, y: -332.82} m_Gravity: {x: 0, y: -500}
m_DefaultMaterial: {fileID: 0} m_DefaultMaterial: {fileID: 0}
m_VelocityIterations: 8 m_VelocityIterations: 8
m_PositionIterations: 3 m_PositionIterations: 3

Loading…
Cancel
Save