shoot and spawn in time with music

This commit is contained in:
Dom Harris 2021-01-06 15:10:11 +00:00
parent 2858a66892
commit 41879dad57
34 changed files with 390 additions and 323 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

BIN
Assets/.DS_Store vendored Normal file

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 130 B

After

Width:  |  Height:  |  Size: 34 KiB

View File

@ -26,10 +26,11 @@ Material:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 2000
m_CustomRenderQueue: 3000
stringTagMap:
RenderType: Opaque
disabledShaderPasses: []
RenderType: Transparent
disabledShaderPasses:
- SHADOWCASTER
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
@ -99,7 +100,7 @@ Material:
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _DstBlend: 10
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
@ -113,10 +114,10 @@ Material:
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _Surface: 0
- _SrcBlend: 5
- _Surface: 1
- _WorkflowMode: 1
- _ZWrite: 1
- _ZWrite: 0
m_Colors:
- _BaseColor: {r: 0.8396226, g: 0.09109115, b: 0.09109115, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 129 B

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 129 B

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 129 B

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 130 B

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -32,7 +32,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
Path: Assets/FMOD/Desktop/Master.bank
Name: Master
lastModified: 637454772435834869
lastModified: 637455188020000000
LoadResult: 0
FileSizes: []
Exists: 1
@ -81,7 +81,7 @@ MonoBehaviour:
- {fileID: -5408626126966111271}
StringsBanks:
- {fileID: 6606792957875447575}
stringsBankWriteTime: 637454772435864900
stringsBankWriteTime: 637455188020000000
cacheVersion: 4
--- !u!114 &6606792957875447575
MonoBehaviour:
@ -97,7 +97,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
Path: Assets/FMOD/Desktop/Master.strings.bank
Name: Master.strings
lastModified: 637454772435864900
lastModified: 637455188020000000
LoadResult: 0
FileSizes:
- Name:

View File

@ -14,7 +14,7 @@ GameObject:
- component: {fileID: 233269787904781725}
- component: {fileID: 2766037370157449026}
- component: {fileID: 2122656558574222561}
- component: {fileID: 5433566675603670693}
- component: {fileID: 499203000553078885}
m_Layer: 7
m_Name: Enemy
m_TagString: Untagged
@ -123,7 +123,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 5b2c8b098025f4e2f997759b5c00fef7, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &5433566675603670693
--- !u!114 &499203000553078885
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
@ -135,5 +135,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 331122d8907f44ed9b0f8f2337d176b9, type: 3}
m_Name:
m_EditorClassIdentifier:
delayMin: 3.4
delayMax: 3.6
beatsBeforeMove: 160
scaleAmount: 1.5
numBeatsAfterScale: 0

View File

@ -132,8 +132,8 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 186457104}
- component: {fileID: 186457106}
- component: {fileID: 186457105}
- component: {fileID: 186457106}
m_Layer: 0
m_Name: EnemySpawner
m_TagString: Untagged
@ -153,7 +153,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 5
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0}
--- !u!114 &186457105
MonoBehaviour:
@ -186,9 +186,17 @@ MonoBehaviour:
m_GameObject: {fileID: 186457103}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1e7507b4cab524d08a774a399662b3ad, type: 3}
m_Script: {fileID: 11500000, guid: 4f8399031f014bee928b07d26fe8ee4c, type: 3}
m_Name:
m_EditorClassIdentifier:
pauseOnBeat: 160
pauseLengthInBeats: 72
beatOffset: 16
--- !u!20 &502054319 stripped
Camera:
m_CorrespondingSourceObject: {fileID: 3397488660173986648, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
m_PrefabInstance: {fileID: 1077224733}
m_PrefabAsset: {fileID: 0}
--- !u!1 &660289115
GameObject:
m_ObjectHideFlags: 0
@ -314,7 +322,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1942400137}
m_RootOrder: 2
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
@ -349,7 +357,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
pool: {fileID: 710724062}
cam: {fileID: 1421772844}
cam: {fileID: 502054319}
--- !u!1 &763784687
GameObject:
m_ObjectHideFlags: 0
@ -424,140 +432,6 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &859797326
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 859797327}
- component: {fileID: 859797329}
- component: {fileID: 859797328}
m_Layer: 5
m_Name: Text (TMP)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &859797327
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 859797326}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1942400137}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 197.5}
m_SizeDelta: {x: 0, y: -395}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &859797328
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 859797326}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: my font is better than your font
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 0f0f54895994248b0bf34c4b4d27beef, type: 2}
m_sharedMaterial: {fileID: -3347474280721358513, guid: 0f0f54895994248b0bf34c4b4d27beef, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 55.9
m_fontSizeBase: 55.9
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 16
m_HorizontalAlignment: 2
m_VerticalAlignment: 8192
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 1
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!222 &859797329
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 859797326}
m_CullTransparentMesh: 1
--- !u!1001 &1077224733
PrefabInstance:
m_ObjectHideFlags: 0
@ -569,13 +443,17 @@ PrefabInstance:
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3397488660842926093, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: m_LocalScale.x
value: 1847.5209
objectReference: {fileID: 0}
- target: {fileID: 3397488660859550700, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: m_Name
value: Rendering
objectReference: {fileID: 0}
- target: {fileID: 3397488660859550701, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: m_RootOrder
value: 7
value: 6
objectReference: {fileID: 0}
- target: {fileID: 3397488660859550701, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: m_LocalPosition.x
@ -719,7 +597,7 @@ Transform:
- {fileID: 1639649351}
- {fileID: 1222495243}
m_Father: {fileID: 0}
m_RootOrder: 3
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1173812009
MonoBehaviour:
@ -751,7 +629,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: ee402da2b1ce44634affa14c193a5d3b, type: 3}
m_Name:
m_EditorClassIdentifier:
cam: {fileID: 1421772844}
cam: {fileID: 502054319}
distance: 30
lookAt: {fileID: 660289116}
--- !u!114 &1173812011
@ -775,7 +653,7 @@ MonoBehaviour:
OnBulletCollide:
m_PersistentCalls:
m_Calls: []
delayBetweenTargets: 0.05
numTargets: 4
--- !u!114 &1173812012
MonoBehaviour:
m_ObjectHideFlags: 0
@ -800,12 +678,10 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 3d3bf172892f141e5a18148a06f708cb, type: 3}
m_Name:
m_EditorClassIdentifier:
cam: {fileID: 1421772844}
cam: {fileID: 502054319}
cursor: {fileID: 660289116}
maxTargets: 100
targetTime: 1
targetSize: 1
delay: 2
collideWith:
serializedVersion: 2
m_Bits: 128
@ -851,6 +727,9 @@ MonoBehaviour:
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
shootOnBeat: 160
noTargetLengthInBeats: 72
beatOffset: 16
--- !u!1 &1215971662
GameObject:
m_ObjectHideFlags: 0
@ -891,11 +770,11 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1215971662}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalPosition: {x: 0, y: -2, z: 30}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 6
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1222495242
GameObject:
@ -927,6 +806,77 @@ Transform:
m_Father: {fileID: 1173812008}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1250063706
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1250063708}
- component: {fileID: 1250063707}
m_Layer: 0
m_Name: Audio
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1250063707
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1250063706}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 30d54cd9cbc0b4024b4c5af11532f553, type: 3}
m_Name:
m_EditorClassIdentifier:
bpm: 180
OnBeat:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 186457106}
m_TargetAssemblyTypeName: BeatSpawner, Assembly-CSharp
m_MethodName: OnBeat
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_Target: {fileID: 1173812013}
m_TargetAssemblyTypeName: TargetLockOn, Assembly-CSharp
m_MethodName: OnBeat
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
--- !u!4 &1250063708
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1250063706}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1395215960
GameObject:
m_ObjectHideFlags: 0
@ -956,7 +906,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 4
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1395215962
MonoBehaviour:
@ -973,122 +923,6 @@ MonoBehaviour:
numObjects: 3000
prefab: {fileID: 1738226812227614580, guid: e084e082567284f79a41423c4fe1adab, type: 3}
numToSpawnPerFrame: 10
--- !u!1 &1421772842
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1421772845}
- component: {fileID: 1421772844}
- component: {fileID: 1421772843}
- component: {fileID: 1421772847}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!81 &1421772843
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1421772842}
m_Enabled: 1
--- !u!20 &1421772844
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1421772842}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 2
m_BackGroundColor: {r: 0, g: 0, b: 0, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &1421772845
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1421772842}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1421772847
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1421772842}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a79441f348de89743a2939f4d699eac1, type: 3}
m_Name:
m_EditorClassIdentifier:
m_RenderShadows: 1
m_RequiresDepthTextureOption: 2
m_RequiresOpaqueTextureOption: 2
m_CameraType: 0
m_Cameras: []
m_RendererIndex: -1
m_VolumeLayerMask:
serializedVersion: 2
m_Bits: 1
m_VolumeTrigger: {fileID: 0}
m_RenderPostProcessing: 0
m_Antialiasing: 0
m_AntialiasingQuality: 2
m_StopNaN: 0
m_Dithering: 0
m_ClearDepth: 1
m_AllowXRRendering: 1
m_RequiresDepthTexture: 0
m_RequiresColorTexture: 0
m_Version: 2
--- !u!1 &1639649350
GameObject:
m_ObjectHideFlags: 0
@ -1276,7 +1110,6 @@ RectTransform:
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 660289116}
- {fileID: 859797327}
- {fileID: 710724061}
m_Father: {fileID: 0}
m_RootOrder: 0

View File

@ -0,0 +1,35 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AudioBeatManager : MonoBehaviour
{
[SerializeField] private float bpm;
public float TimeBetweenBeats => _bps * Time.deltaTime;
private float _bps;
private int _currentBeat = 0;
private float _timer;
public IntEvent OnBeat;
public event Action<int> OnBeatEvent;
private void Awake()
{
_bps = bpm / 60f;
_timer = 0;
}
// Update is called once per frame
void Update()
{
_timer += Time.deltaTime;
if (_timer >= TimeBetweenBeats)
{
_timer = 0;
++_currentBeat;
OnBeat?.Invoke(_currentBeat);
OnBeatEvent?.Invoke(_currentBeat);
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 30d54cd9cbc0b4024b4c5af11532f553
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
using UnityEngine;
[CreateAssetMenu]
public abstract class BaseBulletBehaviour : ScriptableObject
{
public abstract void DoBehaviour(Transform bullet, float size, Vector3 pos);
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 8f703513405a4df3a54c31bda56dafe0
timeCreated: 1609933720

View File

@ -0,0 +1,39 @@
using System;
using UnityEngine;
using UnityEngine.Scripting;
public class BeatSpawner : ShootInputBase
{
[SerializeField] private int pauseOnBeat;
[SerializeField] private int pauseLengthInBeats;
[SerializeField] private int beatOffset;
private AudioBeatManager _audio;
private bool _shoot;
private bool _isPaused = false;
private void Awake()
{
_audio = FindObjectOfType<AudioBeatManager>();
}
public void OnBeat(int beat)
{
if ((beat + beatOffset) % pauseOnBeat == 0)
_isPaused = true;
if ((beat + beatOffset + pauseLengthInBeats) % pauseOnBeat == 0)
_isPaused = false;
_shoot = !_isPaused;
}
public override bool IsShooting()
{
if (!_shoot) return false;
_shoot = false;
return true;
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 4f8399031f014bee928b07d26fe8ee4c
timeCreated: 1609940672

View File

@ -0,0 +1,14 @@
using DG.Tweening;
using UnityEngine;
[CreateAssetMenu]
public class BulletScaleBehaviour : BaseBulletBehaviour
{
[SerializeField] private float scaleTime = 0.5f;
[SerializeField] private Ease scaleEase = Ease.OutQuint;
public override void DoBehaviour(Transform bullet, float size, Vector3 pos)
{
bullet.localScale = Vector3.zero;
bullet.DOScale(Vector3.one * size, scaleTime).SetEase(scaleEase);
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 8d6fb9bb806b4efcbd8aefb293811842
timeCreated: 1609934177

View File

@ -6,14 +6,20 @@ using Weapons.Scripts;
public class DisableOnDeath : MonoBehaviour
{
private EntityHealth _health;
private Renderer _renderer;
private Color _color;
private void Awake()
{
_health = GetComponent<EntityHealth>();
_renderer = GetComponentInChildren<Renderer>();
_color = _renderer.material.color;
}
private void OnEnable()
{
_health.Die += Die;
_renderer.material.color = _color;
}
private void OnDisable()
@ -25,7 +31,9 @@ public class DisableOnDeath : MonoBehaviour
{
var oldName = gameObject.name;
gameObject.name = "disabled";
transform.DOScale(Vector3.zero, 0.33f).SetEase(Ease.InBack).OnComplete(() =>
_renderer.material.DOColor(Color.white, 0.1f);
_renderer.material.DOFade(0, 0.2f).SetDelay(0.3f);
transform.DOScale(Vector3.one * 1.5f, 0.5f).SetEase(Ease.OutQuint).OnComplete(() =>
{
gameObject.name = oldName;
gameObject.SetActive(false);

View File

@ -0,0 +1,23 @@
using System;
using DG.Tweening;
using UnityEngine;
[CreateAssetMenu]
public class EnemyAppearBehaviour : BaseBulletBehaviour
{
[SerializeField] private float zPos = 50f;
[SerializeField] private float moveInDuration = 0.5f;
[SerializeField] private float scaleUpDuration = 0.3f;
[SerializeField] private float scaleUpDelay = 0.2f;
[SerializeField] private float moveOutPos = -15f;
[SerializeField] private float moveOutDuration = 2f;
public override void DoBehaviour(Transform bullet, float size, Vector3 pos)
{
bullet.localScale = Vector3.zero;
bullet.localPosition = new Vector3(pos.x, pos.y, zPos);
DOTween.Sequence()
.Append(bullet.DOMove(pos, moveInDuration).SetEase(Ease.OutQuint))
.Insert(scaleUpDelay, bullet.DOScale(Vector3.one * size, scaleUpDuration).SetEase(Ease.OutQuint));
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 30cbf16431f04e4fbc6c1de5330ec41c
timeCreated: 1609934222

View File

@ -14,8 +14,7 @@ public class FireAtTargets : MonoBehaviour
[SerializeField] private UnityEvent OnFire;
[SerializeField] private Vector3Event OnBulletCollide;
[SerializeField] private float delayBetweenTargets;
[SerializeField] private int numTargets = 4;
private void Awake()
{
@ -48,13 +47,14 @@ public class FireAtTargets : MonoBehaviour
private IEnumerator FireIE(List<Transform> targets)
{
var currentTargets = new List<Transform>(targets);
foreach (var target in currentTargets)
for (var i = 0; i < currentTargets.Count; i++)
{
bulletPos.LookAt(target);
bulletPos.LookAt(currentTargets[i]);
if (weapon.Fire(bulletPool, bulletPos))
OnFire?.Invoke();
yield return delayBetweenTargets;
if (i % numTargets == 0)
yield return null;
}
}

View File

@ -7,10 +7,36 @@ using Random = UnityEngine.Random;
public class MoveAfterDelay : MonoBehaviour
{
[SerializeField] private float delayMin;
[SerializeField] private float delayMax;
[SerializeField] private int beatsBeforeMove = 16;
[SerializeField] private float scaleAmount = 1.5f;
[SerializeField] private int numBeatsAfterScale = 4;
private static AudioBeatManager _audio;
private void Awake()
{
if (_audio == null)
_audio = FindObjectOfType<AudioBeatManager>();
}
private void OnEnable()
{
transform.DOMoveZ(-15, 2.0f).SetEase(Ease.InQuint).SetDelay(Random.Range(delayMin, delayMax));
_audio.OnBeatEvent += AudioOnBeat;
}
}
private void OnDisable()
{
_audio.OnBeatEvent -= AudioOnBeat;
}
private void AudioOnBeat(int beat)
{
if (beat % beatsBeforeMove != 0) return;
DOTween.Sequence()
.Append(transform.DOScale(Vector3.one * scaleAmount, _audio.TimeBetweenBeats*16).SetEase(Ease.InQuint))
.Append(transform.DOScale(Vector3.one, _audio.TimeBetweenBeats*16).SetEase(Ease.OutQuint))
.Append(transform.DOMoveZ(-30, 1.0f).SetEase(Ease.InOutQuint).SetDelay(_audio.TimeBetweenBeats * numBeatsAfterScale))
.Play();
}
}

View File

@ -1,5 +1,3 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@ -11,44 +9,49 @@ public class TargetLockOn : MonoBehaviour
[SerializeField] private int maxTargets;
[SerializeField] private float targetTime;
[SerializeField] private float targetSize;
[SerializeField] private float delay;
[SerializeField] private LayerMask collideWith;
[SerializeField] private TransformEvent OnTargetFound;
[SerializeField] private TransformListEvent OnTargetLock;
[SerializeField] private int shootOnBeat;
[SerializeField] private int noTargetLengthInBeats;
[SerializeField] private float beatOffset;
private float _targetCountdown;
private List<Transform> _targets;
private bool _canTarget = true;
private RaycastHit[] _colliders = new RaycastHit[128];
private AudioBeatManager _audio;
private void Awake()
{
_targets = new List<Transform>(maxTargets);
_audio = FindObjectOfType<AudioBeatManager>();
}
public void OnBeat(int beat)
{
if ((beat + beatOffset) % shootOnBeat == 0)
{
OnTargetLock?.Invoke(_targets);
_targets.Clear();
_canTarget = false;
}
if ((beat + beatOffset + noTargetLengthInBeats) % shootOnBeat == 0)
_canTarget = true;
}
private void FixedUpdate()
{
if (!_canTarget) return;
_targetCountdown -= Time.deltaTime;
if (_targetCountdown <= 0)
{
_targetCountdown = targetTime;
OnTargetLock?.Invoke(_targets);
_targets.Clear();
_canTarget = false;
WaitUtils.Wait(delay, true, () => _canTarget = true);
}
var ray = cam.ScreenPointToRay(cursor.position + Vector3.forward);
var numHits = Physics.SphereCastNonAlloc(ray, targetSize, _colliders, 50, collideWith, QueryTriggerInteraction.Collide);
@ -64,4 +67,4 @@ public class TargetLockOn : MonoBehaviour
break;
}
}
}
}

View File

@ -52,6 +52,8 @@ public class Weapon : ScriptableObject
[SerializeField] private float accuracy;
[SerializeField] private SpawnZone zone;
[SerializeField] private bool manualFire;
[SerializeField] private BaseBulletBehaviour behaviour;
[SerializeField] private bool useDeltaTime;
private List<Bullet> _bullets;
private List<Transform> _bulletTransforms;
@ -73,7 +75,7 @@ public class Weapon : ScriptableObject
_job = new BulletMoveJob();
_bullets = new List<Bullet>();
_bulletTransforms = new List<Transform>();
_currentCooldown = fireRate;
_currentCooldown = fireRate * Time.deltaTime;
}
public void Update()
@ -163,7 +165,7 @@ public class Weapon : ScriptableObject
if (!manualFire)
{
if (_currentCooldown < fireRate) return false;
if (_currentCooldown > fireRate * (useDeltaTime ? Time.deltaTime : 1)) return false;
_currentCooldown = 0;
}
@ -196,9 +198,8 @@ public class Weapon : ScriptableObject
// point the bullet in the right direction
bullet.forward = new Vector3(dir.x, dir.y);
bullet.transform.localScale = Vector3.zero;
bullet.transform.DOScale(Vector3.one * bulletSize.EvaluateMinMaxCurve(), 0.33f).SetEase(Ease.OutQuint);
bullet.transform.localScale = Vector3.one * bulletSize.EvaluateMinMaxCurve();
behaviour.DoBehaviour(bullet, bulletSize.EvaluateMinMaxCurve(), bullet.position);
if (zone.SpawnDir != SpawnDir.Spherised)
{
var y = bullet.eulerAngles.y;
@ -219,8 +220,6 @@ public class Weapon : ScriptableObject
Idx = idx
});
});
}
/// <summary>

View File

@ -12,7 +12,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 2bc932693ed0a470d9cf39b1c3168afb, type: 3}
m_Name: Enemy
m_EditorClassIdentifier:
fireRate: 6
fireRate: 3
bulletSpeed:
m_Mode: 0
m_CurveMultiplier: 1
@ -108,15 +108,17 @@ MonoBehaviour:
zone:
numToSpawn: 1
offset: {x: 0, y: 0}
spawnType: 2
spawnType: 0
spawnDir: 0
width: 0
height: 0
surfaceOnly: 1
evenDistribution: 1
surfaceOnly: 0
evenDistribution: 0
numSides: 5
numPerSide: 80
radius: 18
radius: 15
arc: 360
composite: []
manualFire: 0
manualFire: 1
behaviour: {fileID: 11400000, guid: bb1cb2a77c68c42d4900953d18b23a49, type: 2}
useDeltaTime: 0

View File

@ -0,0 +1,20 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 30cbf16431f04e4fbc6c1de5330ec41c, type: 3}
m_Name: EnemyAppear
m_EditorClassIdentifier:
zPos: 50
moveInDuration: 0.5
scaleUpDuration: 0.3
scaleUpDelay: 0.2
moveOutPos: -15
moveOutDuration: 2

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: bb1cb2a77c68c42d4900953d18b23a49
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,16 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8d6fb9bb806b4efcbd8aefb293811842, type: 3}
m_Name: PlayerBulletScale
m_EditorClassIdentifier:
scaleTime: 0.5
scaleEase: 15

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 20de5bc0e86bc4037a85f6c46356a227
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -120,3 +120,4 @@ MonoBehaviour:
arc: 360
composite: []
manualFire: 1
behaviour: {fileID: 11400000, guid: 20de5bc0e86bc4037a85f6c46356a227, type: 2}